Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752123AbbGMJpJ (ORCPT ); Mon, 13 Jul 2015 05:45:09 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:50957 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750994AbbGMJpH (ORCPT ); Mon, 13 Jul 2015 05:45:07 -0400 X-AuditID: cbfee61a-f79516d000006302-c2-55a388a1e536 From: Chao Yu To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] f2fs: cleanup write_orphan_inodes Date: Mon, 13 Jul 2015 17:44:25 +0800 Message-id: <008001d0bd50$98996f10$c9cc4d30$@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: AdC9UEwdsneGDohDRw2d7PX65JwX3Q== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJLMWRmVeSWpSXmKPExsVy+t9jQd2FHYtDDbr2c1k8WT+L2eLSIneL y7vmsDkwe2xa1cnmsXvBZyaPz5vkApijuGxSUnMyy1KL9O0SuDLeP1nHVLBYsGLL5LMsDYyT +boYOTkkBEwkvnzrYoawxSQu3FvP1sXIxSEkMJ1R4tSB20wQzitGiV9fDrCAVLEJqEgs7/jP BGKLANmHFl1mB7GZBTwkGju+s4LYwgJmEjtWtoDFWQRUJdY/ecsIYvMKWEpsXdrKBmELSvyY fI8FoldLYv3O40wQtrzE5jVvoS5SkNhx9jUjxC49iSd7DzNC1IhLbDxyi2UCo8AsJKNmIRk1 C8moWUhaFjCyrGIUTS1ILihOSs811CtOzC0uzUvXS87P3cQIDuBnUjsYVzZYHGIU4GBU4uFt 2LIoVIg1say4MvcQowQHs5IIb07x4lAh3pTEyqrUovz4otKc1OJDjNIcLErivCfzfUKFBNIT S1KzU1MLUotgskwcnFINjPs65yzZJzWjQFTHcPOH2xN4S6/qS36/udvmy7Q48z9rTj6KErO3 V5K+sVfz2eaq1pfOynrKn3+cW3TfO2pjvnJf5ON0V33FoApmcUfh9sg9nk47V8Q8N/ScXnVp npLUkqnWCsu+7jkg6FsioLh70ru5f9NF2dh1TvIKxEz+r+/X8UT+aPec3UosxRmJhlrMRcWJ ADors5lcAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2397 Lines: 64 Previously, since 'commit 4531929e3922 ("f2fs: move grabing orphan pages out of protection region")' was committed, in write_orphan_inodes(), we will grab all meta page in a batch before we use them under spinlock, so that we can avoid large time delay of grabbing meta pages under spinlock. Now, 'commit d6c67a4fee86 ("f2fs: revmove spin_lock for write_orphan_inodes")' remove the spinlock in write_orphan_inodes, so there is no issue we describe above, we'd better recover to move the grab operation to original place for readability. Signed-off-by: Chao Yu --- fs/f2fs/checkpoint.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index de7a0d6..6032702 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -504,7 +504,7 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk) struct list_head *head; struct f2fs_orphan_block *orphan_blk = NULL; unsigned int nentries = 0; - unsigned short index; + unsigned short index = 1; unsigned short orphan_blocks; struct page *page = NULL; struct ino_entry *orphan = NULL; @@ -512,11 +512,6 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk) orphan_blocks = GET_ORPHAN_BLOCKS(im->ino_num); - for (index = 0; index < orphan_blocks; index++) - grab_meta_page(sbi, start_blk + index); - - index = 1; - /* * we don't need to do spin_lock(&im->ino_lock) here, since all the * orphan inode operations are covered under f2fs_lock_op(). @@ -527,12 +522,10 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk) /* loop for each orphan inode entry and write them in Jornal block */ list_for_each_entry(orphan, head, list) { if (!page) { - page = find_get_page(META_MAPPING(sbi), start_blk++); - f2fs_bug_on(sbi, !page); + page = grab_meta_page(sbi, start_blk++); orphan_blk = (struct f2fs_orphan_block *)page_address(page); memset(orphan_blk, 0, sizeof(*orphan_blk)); - f2fs_put_page(page, 0); } orphan_blk->ino[nentries++] = cpu_to_le32(orphan->ino); -- 2.4.2 -- 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/