Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754015AbcCKC4t (ORCPT ); Thu, 10 Mar 2016 21:56:49 -0500 Received: from lucky1.263xmail.com ([211.157.147.132]:43696 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752154AbcCKC4r (ORCPT ); Thu, 10 Mar 2016 21:56:47 -0500 X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 X-RL-SENDER: shawn.lin@rock-chips.com X-FST-TO: jaegeuk@kernel.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: shawn.lin@rock-chips.com X-UNIQUE-TAG: <5b041312c98cde22c156748e1ee7faae> X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 From: Shawn Lin To: Jaegeuk Kim Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Shawn Lin Subject: [PATCH 1/2] f2fs: check inline flag ahead for f2fs_write_inline_data Date: Fri, 11 Mar 2016 10:48:29 +0800 Message-Id: <1457664509-2846-1-git-send-email-shawn.lin@rock-chips.com> X-Mailer: git-send-email 1.8.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 958 Lines: 37 No matter inline data flag is set or not, current code is going to new a dnode. But actually we can avoid it by puting the check of inline data flag in advance to save this cpu cycle. Signed-off-by: Shawn Lin --- fs/f2fs/inline.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index 358214e..0926eab 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -195,16 +195,14 @@ int f2fs_write_inline_data(struct inode *inode, struct page *page) struct dnode_of_data dn; int err; + if (!f2fs_has_inline_data(inode)) + return -EAGAIN; + set_new_dnode(&dn, inode, NULL, NULL, 0); err = get_dnode_of_data(&dn, 0, LOOKUP_NODE); if (err) return err; - if (!f2fs_has_inline_data(inode)) { - f2fs_put_dnode(&dn); - return -EAGAIN; - } - f2fs_bug_on(F2FS_I_SB(inode), page->index); f2fs_wait_on_page_writeback(dn.inode_page, NODE, true); -- 2.3.7