summaryrefslogtreecommitdiff
path: root/fs/f2fs/checkpoint.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2014-03-18 08:47:11 +0400
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2014-03-18 11:37:53 +0400
commit50c8cdb35ad8016c52fb2326ef9d65542e3a3e1b (patch)
treedb261148aaa96080b35d61f8b1ac09d1fecb87a4 /fs/f2fs/checkpoint.c
parentd3baf95da5b0bce9fe980eeff6140817d63fabdf (diff)
downloadlinux-50c8cdb35ad8016c52fb2326ef9d65542e3a3e1b.tar.xz
f2fs: introduce nr_pages_to_write for segment alignment
This patch introduces nr_pages_to_write to align page writes to the segment or other operational unit size, which can be tuned according to the system environment. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/checkpoint.c')
-rw-r--r--fs/f2fs/checkpoint.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index aef32f36e2f3..2a00c94726fb 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -187,18 +187,19 @@ static int f2fs_write_meta_pages(struct address_space *mapping,
struct writeback_control *wbc)
{
struct f2fs_sb_info *sbi = F2FS_SB(mapping->host->i_sb);
- int nrpages = nr_pages_to_skip(sbi, META);
- long written;
+ long diff, written;
/* collect a number of dirty meta pages and write together */
- if (wbc->for_kupdate || get_pages(sbi, F2FS_DIRTY_META) < nrpages)
+ if (wbc->for_kupdate ||
+ get_pages(sbi, F2FS_DIRTY_META) < nr_pages_to_skip(sbi, META))
goto skip_write;
/* if mounting is failed, skip writing node pages */
mutex_lock(&sbi->cp_mutex);
- written = sync_meta_pages(sbi, META, nrpages);
+ diff = nr_pages_to_write(sbi, META, wbc);
+ written = sync_meta_pages(sbi, META, wbc->nr_to_write);
mutex_unlock(&sbi->cp_mutex);
- wbc->nr_to_write -= written;
+ wbc->nr_to_write = max((long)0, wbc->nr_to_write - written - diff);
return 0;
skip_write: