]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: unify to use writer locks for subpage locking
authorQu Wenruo <wqu@suse.com>
Wed, 9 Oct 2024 05:51:06 +0000 (16:21 +1030)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Feb 2025 12:30:13 +0000 (04:30 -0800)
commite0922986ea6a46e2ab684a292dcb6ed5c339bfba
treebdf2f7490eb01ab1c0fe6e646eda0519a5edc407
parent93c985ddccc3a21285b83055889d36c861900ea0
btrfs: unify to use writer locks for subpage locking

[ Upstream commit 336e69f3025fb70db9d0dfb7f36ac79887bf5341 ]

Since commit d7172f52e993 ("btrfs: use per-buffer locking for
extent_buffer reading"), metadata read no longer relies on the subpage
reader locking.

This means we do not need to maintain a different metadata/data split
for locking, so we can convert the existing reader lock users by:

- add_ra_bio_pages()
  Convert to btrfs_folio_set_writer_lock()

- end_folio_read()
  Convert to btrfs_folio_end_writer_lock()

- begin_folio_read()
  Convert to btrfs_folio_set_writer_lock()

- folio_range_has_eb()
  Remove the subpage->readers checks, since it is always 0.

- Remove btrfs_subpage_start_reader() and btrfs_subpage_end_reader()

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@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/compression.c
fs/btrfs/extent_io.c
fs/btrfs/subpage.c
fs/btrfs/subpage.h