Commit 71be4d0f authored by Zhang Yi's avatar Zhang Yi
Browse files

iomap: support invalidating partial folios

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


CVE: NA

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

Current iomap_invalidate_folio() could only invalidate an entire folio,
if we truncate a partial folio on a filesystem with blocksize < folio
size, it will left over the dirty bits of truncated/punched blocks, and
the write back process will try to map the invalid hole range, but
fortunately it hasn't trigger any real problems now since ->map() will
fix the length. Fix this by supporting invalidating partial folios.

Signed-off-by: default avatarZhang Yi <yi.zhang@huawei.com>
parent bc13e40d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -627,6 +627,8 @@ void iomap_invalidate_folio(struct folio *folio, size_t offset, size_t len)
		WARN_ON_ONCE(folio_test_writeback(folio));
		folio_cancel_dirty(folio);
		ifs_free(folio);
	} else {
		iomap_clear_range_dirty(folio, offset, len);
	}
}
EXPORT_SYMBOL_GPL(iomap_invalidate_folio);