]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: do not assume the full page range is not dirty in extent_writepage_io()
authorQu Wenruo <wqu@suse.com>
Tue, 10 Sep 2024 23:22:36 +0000 (08:52 +0930)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Feb 2025 12:30:13 +0000 (04:30 -0800)
commit1853fd0894166835853cfd1814811ae21ce49da5
tree33ec6da910433b549676aad6a313d0e0c6084321
parentfb96af0daa69f0f087ee2edcea8e3f9700610a41
btrfs: do not assume the full page range is not dirty in extent_writepage_io()

[ Upstream commit 928b4de66ed3b0d9a6f201ce41ab2eed6ea2e7ef ]

The function extent_writepage_io() will submit the dirty sectors inside
the page for the write.

But recently to co-operate with the incoming subpage compression
enhancement, a new bitmap is introduced to
btrfs_bio_ctrl::submit_bitmap, to only avoid a subset of the dirty
range.

This is because we can have the following cases with 64K page size:

    0      16K       32K       48K       64K
    |      |/////////|         |/|
                                 52K

For range [16K, 32K), we queue the dirty range for compression, which is
ran in a delayed workqueue.
Then for range [48K, 52K), we go through the regular submission path.

In that case, our btrfs_bio_ctrl::submit_bitmap will exclude the range
[16K, 32K).

The dirty flags for the range [16K, 32K) is only cleared when the
compression is done, by the extent_clear_unlock_delalloc() call inside
submit_one_async_extent().

This patch fix the false alert by removing the
btrfs_folio_assert_not_dirty() check, since it's no longer correct for
subpage compression cases.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Stable-dep-of: 8bf334beb349 ("btrfs: fix double accounting race when extent_writepage_io() failed")
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/extent_io.c