diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-03-18 00:47:11 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-03-18 03:37:53 -0400 |
commit | 50c8cdb35ad8016c52fb2326ef9d65542e3a3e1b (patch) | |
tree | db261148aaa96080b35d61f8b1ac09d1fecb87a4 /fs/f2fs/checkpoint.c | |
parent | d3baf95da5b0bce9fe980eeff6140817d63fabdf (diff) |
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.c | 11 |
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, | |||
187 | struct writeback_control *wbc) | 187 | struct writeback_control *wbc) |
188 | { | 188 | { |
189 | struct f2fs_sb_info *sbi = F2FS_SB(mapping->host->i_sb); | 189 | struct f2fs_sb_info *sbi = F2FS_SB(mapping->host->i_sb); |
190 | int nrpages = nr_pages_to_skip(sbi, META); | 190 | long diff, written; |
191 | long written; | ||
192 | 191 | ||
193 | /* collect a number of dirty meta pages and write together */ | 192 | /* collect a number of dirty meta pages and write together */ |
194 | if (wbc->for_kupdate || get_pages(sbi, F2FS_DIRTY_META) < nrpages) | 193 | if (wbc->for_kupdate || |
194 | get_pages(sbi, F2FS_DIRTY_META) < nr_pages_to_skip(sbi, META)) | ||
195 | goto skip_write; | 195 | goto skip_write; |
196 | 196 | ||
197 | /* if mounting is failed, skip writing node pages */ | 197 | /* if mounting is failed, skip writing node pages */ |
198 | mutex_lock(&sbi->cp_mutex); | 198 | mutex_lock(&sbi->cp_mutex); |
199 | written = sync_meta_pages(sbi, META, nrpages); | 199 | diff = nr_pages_to_write(sbi, META, wbc); |
200 | written = sync_meta_pages(sbi, META, wbc->nr_to_write); | ||
200 | mutex_unlock(&sbi->cp_mutex); | 201 | mutex_unlock(&sbi->cp_mutex); |
201 | wbc->nr_to_write -= written; | 202 | wbc->nr_to_write = max((long)0, wbc->nr_to_write - written - diff); |
202 | return 0; | 203 | return 0; |
203 | 204 | ||
204 | skip_write: | 205 | skip_write: |