hulk inclusion category: perf bugzilla: https://gitee.com/openeuler/kernel/issues/IACNS4 CVE: NA
--------------------------------
In ext4_iomap_write_begin(), we speed up mapping check by checking the folio dirty bit. If the folio is dirty, it means this folio has just been written and must have a counterpart allocated block or delalloc extent, so we don't need to map the folio again if we write to the same place, this could speed up a lot for the case of repeated overwrite to the same folio.
However, we only check the entire folio has been dirty or not, so it doesn't support if we have more than one blocks per folio yet. After iomap could handle sub-folio properly, let's extend this improvement by checking partial blocks in one folio.
Signed-off-by: Zhang Yi yi.zhang@huawei.com --- fs/ext4/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 642522ace038..9ed6014246dc 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3988,7 +3988,7 @@ static int ext4_iomap_write_begin(struct file *file,
WARN_ON_ONCE(pos + len > folio_pos(folio) + folio_size(folio));
- if (folio_test_dirty(folio) && (i_blocks_per_folio(inode, folio) == 1)) + if (iomap_is_fully_dirty(folio, offset_in_folio(folio, pos), len)) goto out;
do {