Commit 0b4d2d8f authored by Zhang Yi's avatar Zhang Yi
Browse files

iomap: correct the dirty length in page mkwrite

hulk inclusion
category: perf
bugzilla: https://gitee.com/openeuler/kernel/issues/IACNS4


CVE: NA

--------------------------------

When doing page mkwrite, iomap_folio_mkwrite_iter() dirty the entire
folio by folio_mark_dirty() even the map length is shorter than one
folio. However, on the filesystem with more than one blocks per folio,
we'd better to only set counterpart block's dirty bit according to
iomap_length(), so open code folio_mark_dirty() and pass the correct
length.

Signed-off-by: default avatarZhang Yi <yi.zhang@huawei.com>
parent 54162b06
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1488,7 +1488,10 @@ static loff_t iomap_folio_mkwrite_iter(struct iomap_iter *iter,
		block_commit_write(&folio->page, 0, length);
	} else {
		WARN_ON_ONCE(!folio_test_uptodate(folio));
		folio_mark_dirty(folio);

		ifs_alloc(iter->inode, folio, 0);
		iomap_set_range_dirty(folio, 0, length);
		filemap_dirty_folio(iter->inode->i_mapping, folio);
	}

	return length;