Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753861AbbLKIJJ (ORCPT ); Fri, 11 Dec 2015 03:09:09 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:33445 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752426AbbLKIJH (ORCPT ); Fri, 11 Dec 2015 03:09:07 -0500 X-AuditID: cbfee61b-f793c6d00000236c-e5-566a84a02882 From: Chao Yu To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] f2fs: clean up node page updating flow Date: Fri, 11 Dec 2015 16:08:22 +0800 Message-id: <03ba01d133eb$331a2e60$994e8b20$@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: AdEz4nxY5XsKOsKcTKaJjOWtcN+FpA== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsVy+t9jQd2FLVlhBu0TWS2erJ/FbHFpkbvF 5V1z2ByYPTat6mTz2L3gM5PH501yAcxRXDYpqTmZZalF+nYJXBkz3l1hL9jFV3F382z2BsY1 3F2MnBwSAiYSh2+sY4ewxSQu3FvP1sXIxSEkMItR4mnPTEaQhJDAK0aJ5QfKQWw2ARWJ5R3/ mUBsESD70KLLYM3MAh4SjR3fWUFsYQFriQ+b/zCD2CwCqhJ/Xp0Bs3kFLCWeTTgGZQtK/Jh8 jwWiV0ti/c7jTBC2vMTmNW+ZIQ5SkNhx9jUjxC49iSkn/kHViEtsPHKLZQIj0JUIo2YhGTUL yahZSFoWMLKsYpRILUguKE5KzzXKSy3XK07MLS7NS9dLzs/dxAgO4mfSOxgP73I/xCjAwajE w7uAIytMiDWxrLgy9xCjBAezkggvfypQiDclsbIqtSg/vqg0J7X4EKM0B4uSOO++S5FhQgLp iSWp2ampBalFMFkmDk6pBsY4b5/8nIroRY9ZHc/7yW+LcHkRpBWb1Ldxi8geTb2o+UZfPs9Y +2Sy4wTG3yFMaot3ssducL8sU8N0QzDoPP8JidCu17uFf2rP/HVkeogmK/eKqHqmzKB/y6Je TVi14Zr9JSV/YeUaz6/mR3RLsqJf5STGML7T7miwNpFL/lOSGunAcs6RS4mlOCPRUIu5qDgR ABDzMBJeAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2018 Lines: 82 If read_node_page return LOCKED_PAGE, in its caller it's better a) skip unneeded 'Update' flag and mapping info verfication; b) check nid value stored in footer structure of node page. Signed-off-by: Chao Yu --- fs/f2fs/node.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 7bcbc6e..d842b19 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1063,12 +1063,13 @@ repeat: if (err < 0) { f2fs_put_page(page, 1); return ERR_PTR(err); - } else if (err != LOCKED_PAGE) { - lock_page(page); + } else if (err == LOCKED_PAGE) { + goto page_hit; } - if (unlikely(!PageUptodate(page) || nid != nid_of_node(page))) { - ClearPageUptodate(page); + lock_page(page); + + if (unlikely(!PageUptodate(page))) { f2fs_put_page(page, 1); return ERR_PTR(-EIO); } @@ -1076,6 +1077,8 @@ repeat: f2fs_put_page(page, 1); goto repeat; } +page_hit: + f2fs_bug_on(sbi, nid != nid_of_node(page)); return page; } @@ -1114,24 +1117,25 @@ repeat: end = start + MAX_RA_NODE; end = min(end, NIDS_PER_BLOCK); for (i = start + 1; i < end; i++) { - nid = get_nid(parent, i, false); - if (!nid) + nid_t tnid = get_nid(parent, i, false); + if (!tnid) continue; - ra_node_page(sbi, nid); + ra_node_page(sbi, tnid); } blk_finish_plug(&plug); lock_page(page); + if (unlikely(!PageUptodate(page))) { + f2fs_put_page(page, 1); + return ERR_PTR(-EIO); + } if (unlikely(page->mapping != NODE_MAPPING(sbi))) { f2fs_put_page(page, 1); goto repeat; } page_hit: - if (unlikely(!PageUptodate(page))) { - f2fs_put_page(page, 1); - return ERR_PTR(-EIO); - } + f2fs_bug_on(sbi, nid != nid_of_node(page)); return page; } -- 2.6.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/