Skip to contentSkip to conversation

f2fs: skip writing in ->writepages when no dirty pages exist

PATCH New Chao Yu 1 participant 1 message Jul 17, 2015 F2FS file system

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 1/3 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.

---
 fs/f2fs/data.c | 4 ++++
 1 file changed, 4 insertions(+)
fs/f2fs/data.c +4 -0
index b621c08..5370a74 100644
@@ -1284,6 +1284,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))
Signature · 1 line
2.4.2