Commit a06ebc44 authored by Zhang Yi's avatar Zhang Yi
Browse files

ext4: improve sub-polio check in ext4_iomap_write_begin()

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: default avatarZhang Yi <yi.zhang@huawei.com>
parent a8a666d6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 {