aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorGu Zheng <guz.fnst@cn.fujitsu.com>2014-01-10 05:09:02 -0500
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2014-01-14 04:11:20 -0500
commit4531929e3922f2cdd34208d7dc1404ac06e6ced5 (patch)
treee0f22e7ba24e7303595f6cb554e9d4a87401c40b /fs
parent5514f0aadddcdfaaaea697b60203f5402552eb7b (diff)
f2fs: move grabing orphan pages out of protection region
Move grabing orphan block page out of protection region, and grab all the orphan block pages ahead. Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com> Reviewed-by: Chao Yu <chao2.yu@samsung.com> [Jaegeuk Kim: remove unnecessary code pointed by Chao Yu] Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/checkpoint.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 0d78bbe79f98..fdc5a12c0edd 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)
303{ 303{
304 struct list_head *head; 304 struct list_head *head;
305 struct f2fs_orphan_block *orphan_blk = NULL; 305 struct f2fs_orphan_block *orphan_blk = NULL;
306 struct page *page = NULL;
307 unsigned int nentries = 0; 306 unsigned int nentries = 0;
308 unsigned short index = 1; 307 unsigned short index;
309 unsigned short orphan_blocks; 308 unsigned short orphan_blocks = (unsigned short)((sbi->n_orphans +
309 (F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK);
310 struct page *page = NULL;
311 struct page *pages[orphan_blocks];
310 struct orphan_inode_entry *orphan = NULL; 312 struct orphan_inode_entry *orphan = NULL;
311 313
312 orphan_blocks = (unsigned short)((sbi->n_orphans + 314 for (index = 0; index < orphan_blocks; index++)
313 (F2FS_ORPHANS_PER_BLOCK - 1)) / F2FS_ORPHANS_PER_BLOCK); 315 pages[index] = grab_meta_page(sbi, start_blk + index);
314 316
317 index = 1;
315 mutex_lock(&sbi->orphan_inode_mutex); 318 mutex_lock(&sbi->orphan_inode_mutex);
316 head = &sbi->orphan_inode_list; 319 head = &sbi->orphan_inode_list;
317 320
318 /* loop for each orphan inode entry and write them in Jornal block */ 321 /* loop for each orphan inode entry and write them in Jornal block */
319 list_for_each_entry(orphan, head, list) { 322 list_for_each_entry(orphan, head, list) {
320 if (!page) { 323 if (!page) {
321 page = grab_meta_page(sbi, start_blk); 324 page = pages[index - 1];
322 orphan_blk = 325 orphan_blk =
323 (struct f2fs_orphan_block *)page_address(page); 326 (struct f2fs_orphan_block *)page_address(page);
324 memset(orphan_blk, 0, sizeof(*orphan_blk)); 327 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)
338 set_page_dirty(page); 341 set_page_dirty(page);
339 f2fs_put_page(page, 1); 342 f2fs_put_page(page, 1);
340 index++; 343 index++;
341 start_blk++;
342 nentries = 0; 344 nentries = 0;
343 page = NULL; 345 page = NULL;
344 } 346 }