aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2025-07-08 16:32:33 +0100
committerDavid Sterba <dsterba@suse.com>2025-07-22 00:09:22 +0200
commitbfc9d71aa41d6cfc32b60318222b3e65352b0776 (patch)
tree7d4f96581fc39c5e540ed675953e5e8456556a9b
parentbtrfs: don't print relocation messages from auto reclaim (diff)
downloadwireguard-linux-bfc9d71aa41d6cfc32b60318222b3e65352b0776.tar.xz
wireguard-linux-bfc9d71aa41d6cfc32b60318222b3e65352b0776.zip
btrfs: set EXTENT_NORESERVE before range unlock in btrfs_truncate_block()
Set the EXTENT_NORESERVE bit in the io tree before unlocking the range so that we can use the cached state and speedup the operation, since the unlock operation releases the cached state. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/inode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index d79a95b3760c..6aa1e66448fa 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5002,11 +5002,12 @@ again:
block_end + 1 - block_start);
btrfs_folio_set_dirty(fs_info, folio, block_start,
block_end + 1 - block_start);
- btrfs_unlock_extent(io_tree, block_start, block_end, &cached_state);
if (only_release_metadata)
btrfs_set_extent_bit(&inode->io_tree, block_start, block_end,
- EXTENT_NORESERVE, NULL);
+ EXTENT_NORESERVE, &cached_state);
+
+ btrfs_unlock_extent(io_tree, block_start, block_end, &cached_state);
out_unlock:
if (ret) {