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/node.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/node.c')
-rw-r--r-- | fs/f2fs/node.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 7cc146bcbfed..5e9c38e846a5 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c | |||
@@ -1202,7 +1202,7 @@ static int f2fs_write_node_pages(struct address_space *mapping, | |||
1202 | struct writeback_control *wbc) | 1202 | struct writeback_control *wbc) |
1203 | { | 1203 | { |
1204 | struct f2fs_sb_info *sbi = F2FS_SB(mapping->host->i_sb); | 1204 | struct f2fs_sb_info *sbi = F2FS_SB(mapping->host->i_sb); |
1205 | long nr_to_write = wbc->nr_to_write; | 1205 | long diff; |
1206 | 1206 | ||
1207 | /* balancing f2fs's metadata in background */ | 1207 | /* balancing f2fs's metadata in background */ |
1208 | f2fs_balance_fs_bg(sbi); | 1208 | f2fs_balance_fs_bg(sbi); |
@@ -1211,12 +1211,10 @@ static int f2fs_write_node_pages(struct address_space *mapping, | |||
1211 | if (get_pages(sbi, F2FS_DIRTY_NODES) < nr_pages_to_skip(sbi, NODE)) | 1211 | if (get_pages(sbi, F2FS_DIRTY_NODES) < nr_pages_to_skip(sbi, NODE)) |
1212 | goto skip_write; | 1212 | goto skip_write; |
1213 | 1213 | ||
1214 | /* if mounting is failed, skip writing node pages */ | 1214 | diff = nr_pages_to_write(sbi, NODE, wbc); |
1215 | wbc->nr_to_write = 3 * max_hw_blocks(sbi); | ||
1216 | wbc->sync_mode = WB_SYNC_NONE; | 1215 | wbc->sync_mode = WB_SYNC_NONE; |
1217 | sync_node_pages(sbi, 0, wbc); | 1216 | sync_node_pages(sbi, 0, wbc); |
1218 | wbc->nr_to_write = nr_to_write - (3 * max_hw_blocks(sbi) - | 1217 | wbc->nr_to_write = max((long)0, wbc->nr_to_write - diff); |
1219 | wbc->nr_to_write); | ||
1220 | return 0; | 1218 | return 0; |
1221 | 1219 | ||
1222 | skip_write: | 1220 | skip_write: |