Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751497AbbD3Kgh (ORCPT ); Thu, 30 Apr 2015 06:36:37 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:49979 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751070AbbD3Kge (ORCPT ); Thu, 30 Apr 2015 06:36:34 -0400 X-AuditID: cbfee61b-f79536d000000f1f-99-554205b1af54 From: Chao Yu To: Jaegeuk Kim , Changman Lee Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] f2fs: don not re-lookup nat cache with same nid Date: Thu, 30 Apr 2015 18:35:50 +0800 Message-id: <025901d08331$87a9e940$96fdbbc0$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AdCDMRadu24L7FAJSuyDeGLbnriWaw== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrILMWRmVeSWpSXmKPExsVy+t9jQd2NrE6hBle3yVpc29fIZPFk/Sxm i0uL3C0u75rD5sDisWlVJ5vH7gWfmTz6tqxi9Pi8SS6AJYrLJiU1J7MstUjfLoErY83e7YwF /9krOjZ0sDQwbmHrYuTgkBAwkXh/S6yLkRPIFJO4cG89UJiLQ0hgOqPExXvvGSGcV4wSTR+X soBUsQmoSCzv+M8EYosIeElM2n8CLM4s4CHR2PGdFcQWFnCROPpuAivIAhYBVYnHXzlBwrwC lhKduyYxQtiCEj8m34Nq1ZJYv/M4E4QtL7F5zVtmiIMUJHacfc0IsUpPYuPsXnaIGnGJjUdu sUxgFJiFZNQsJKNmIRk1C0nLAkaWVYyiqQXJBcVJ6blGesWJucWleel6yfm5mxjBAf1Megfj qgaLQ4wCHIxKPLwf2h1DhVgTy4orcw8xSnAwK4nwmvwHCvGmJFZWpRblxxeV5qQWH2KU5mBR EuedoysXKiSQnliSmp2aWpBaBJNl4uCUamBU59DeVVa499/mKWU1P2ZPrncLnbRgc675la5N 1+fNuHPu6u6l10+/nMS6c1aPW0b6zg1//jE4xqz8HdH21vd0W+GCy4usZhTzhXXkr/v1YKJU XNUG/amfjasNq/9y8sxdG2Ct82dS+OVXC2smTmMTk0u6lS7oeNcjsli91/Pd0o1Z+dU37q+N U2Ipzkg01GIuKk4EAPs61GpkAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1236 Lines: 37 In set_node_addr, we try to lookup cached nat entry of inode and then set flag in it. But previously in this function, we have already grabbed nat entry with current node id, if the node id is the same as the one of inode, we do not need to lookup it in cache again. So this patch adds condition judgment for reducing unneeded lookup. Signed-off-by: Chao Yu --- fs/f2fs/node.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 1676c7a..7a6d99f 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -312,7 +312,8 @@ static void set_node_addr(struct f2fs_sb_info *sbi, struct node_info *ni, __set_nat_cache_dirty(nm_i, e); /* update fsync_mark if its inode nat entry is still alive */ - e = __lookup_nat_cache(nm_i, ni->ino); + if (ni->nid != ni->ino) + e = __lookup_nat_cache(nm_i, ni->ino); if (e) { if (fsync_done && ni->nid == ni->ino) set_nat_flag(e, HAS_FSYNCED_INODE, true); -- 2.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/