[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <52D3B540.90407@cn.fujitsu.com>
Date: Mon, 13 Jan 2014 17:43:28 +0800
From: Gu Zheng <guz.fnst@...fujitsu.com>
To: Kim <jaegeuk.kim@...sung.com>
CC: f2fs <linux-f2fs-devel@...ts.sourceforge.net>,
fsdevel <linux-fsdevel@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
俞超 <chao2.yu@...sung.com>
Subject: [f2fs-dev][PATCH V2 1/3] f2fs: move grabbing orphan pages out of
protection region
Move grabbing orphan block page out of protection region, and grab all
the orphan block pages ahead.
v2:
Remove the redundant code as Chao Yu suggested.
Reviewed-by: Chao Yu <chao2.yu@...sung.com>
Signed-off-by: Gu Zheng <guz.fnst@...fujitsu.com>
---
fs/f2fs/checkpoint.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 0d78bbe..fdc5a12 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -303,22 +303,25 @@ 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;
- struct page *page = NULL;
unsigned int nentries = 0;
- unsigned short index = 1;
- unsigned short orphan_blocks;
+ unsigned short index;
+ unsigned short orphan_blocks = (unsigned short)((sbi->n_orphans +
+ (F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK);
+ struct page *page = NULL;
+ struct page *pages[orphan_blocks];
struct orphan_inode_entry *orphan = NULL;
- orphan_blocks = (unsigned short)((sbi->n_orphans +
- (F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK);
+ for (index = 0; index < orphan_blocks; index++)
+ pages[index] = grab_meta_page(sbi, start_blk + index);
+ index = 1;
mutex_lock(&sbi->orphan_inode_mutex);
head = &sbi->orphan_inode_list;
/* loop for each orphan inode entry and write them in Jornal block */
list_for_each_entry(orphan, head, list) {
if (!page) {
- page = grab_meta_page(sbi, start_blk);
+ page = pages[index - 1];
orphan_blk =
(struct f2fs_orphan_block *)page_address(page);
memset(orphan_blk, 0, sizeof(*orphan_blk));
@@ -338,7 +341,6 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk)
set_page_dirty(page);
f2fs_put_page(page, 1);
index++;
- start_blk++;
nentries = 0;
page = NULL;
}
--
1.7.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists