diff options
author | Chao Yu <chao2.yu@samsung.com> | 2015-07-17 13:02:39 +0300 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-08-05 18:08:11 +0300 |
commit | 6a2905443cf27f9c14889428f14fccfb98ed97f4 (patch) | |
tree | 557f15b7959b6ce92909be31693201d20f7c3d3c | |
parent | 737f18992ee81cab897336e84c5c7f4e179dfd61 (diff) | |
download | linux-6a2905443cf27f9c14889428f14fccfb98ed97f4.tar.xz |
f2fs: skip writing in ->writepages when no dirty pages exist
When flushing comes from background, if there is no dirty page in the
mapping of inode, we'd better to skip seeking dirty page from mapping
for writebacking.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fs/f2fs/data.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 801b0b0b08f4..e4081fc91012 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1275,6 +1275,10 @@ static int f2fs_write_data_pages(struct address_space *mapping, if (!mapping->a_ops->writepage) return 0; + /* skip writing if there is no dirty page in this inode */ + if (!get_dirty_pages(inode) && wbc->sync_mode == WB_SYNC_NONE) + return 0; + if (S_ISDIR(inode->i_mode) && wbc->sync_mode == WB_SYNC_NONE && get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) && available_free_memory(sbi, DIRTY_DENTS)) |