summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/f2fs/checkpoint.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index f8c074961e0a..2fc3b6beaeb8 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -107,18 +107,19 @@ static int f2fs_write_meta_pages(struct address_space *mapping,
107 struct writeback_control *wbc) 107 struct writeback_control *wbc)
108{ 108{
109 struct f2fs_sb_info *sbi = F2FS_SB(mapping->host->i_sb); 109 struct f2fs_sb_info *sbi = F2FS_SB(mapping->host->i_sb);
110 struct block_device *bdev = sbi->sb->s_bdev; 110 int nrpages = MAX_BIO_BLOCKS(max_hw_blocks(sbi));
111 long written; 111 long written;
112 112
113 if (wbc->for_kupdate) 113 if (wbc->for_kupdate)
114 return 0; 114 return 0;
115 115
116 if (get_pages(sbi, F2FS_DIRTY_META) == 0) 116 /* collect a number of dirty meta pages and write together */
117 if (get_pages(sbi, F2FS_DIRTY_META) < nrpages)
117 return 0; 118 return 0;
118 119
119 /* if mounting is failed, skip writing node pages */ 120 /* if mounting is failed, skip writing node pages */
120 mutex_lock(&sbi->cp_mutex); 121 mutex_lock(&sbi->cp_mutex);
121 written = sync_meta_pages(sbi, META, bio_get_nr_vecs(bdev)); 122 written = sync_meta_pages(sbi, META, nrpages);
122 mutex_unlock(&sbi->cp_mutex); 123 mutex_unlock(&sbi->cp_mutex);
123 wbc->nr_to_write -= written; 124 wbc->nr_to_write -= written;
124 return 0; 125 return 0;