]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: replace clearing extent buffer dirty bit with btrfs_clean_block
authorJosef Bacik <josef@toxicpanda.com>
Thu, 26 Jan 2023 21:00:56 +0000 (16:00 -0500)
committerDavid Sterba <dsterba@suse.com>
Wed, 15 Feb 2023 18:38:53 +0000 (19:38 +0100)
commitc4e54a65711688e78e81d6e2720f19f0747eb176
tree355053e3b5d6270301d9f0bcfbed0a42c8034d3d
parented25dab3a0d1b14b59a3ad74b9d6bb4f4dca03b8
btrfs: replace clearing extent buffer dirty bit with btrfs_clean_block

Now that we're passing in the trans into btrfs_clean_tree_block, we can
easily roll in the handling of the !trans case and replace all
occurrences of

if (test_and_clear_bit(EXTENT_BUFFER_DIRTY, &eb->bflags))
clear_extent_buffer_dirty(eb);

with

btrfs_tree_lock(eb);
btrfs_clean_tree_block(eb);
btrfs_tree_unlock(eb);

We need the lock because if we are actually dirty we need to make sure
we aren't racing with anything that's starting writeout currently.  This
also makes sure that we're accounting fs_info->dirty_metadata_bytes
appropriately.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c
fs/btrfs/tree-log.c