Skip to content

Commit f3dc116

Browse files
fdmananakdave
authored andcommitted
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 <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 0863bd9 commit f3dc116

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/btrfs/inode.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5002,11 +5002,12 @@ int btrfs_truncate_block(struct btrfs_inode *inode, u64 offset, u64 start, u64 e
50025002
block_end + 1 - block_start);
50035003
btrfs_folio_set_dirty(fs_info, folio, block_start,
50045004
block_end + 1 - block_start);
5005-
btrfs_unlock_extent(io_tree, block_start, block_end, &cached_state);
50065005

50075006
if (only_release_metadata)
50085007
btrfs_set_extent_bit(&inode->io_tree, block_start, block_end,
5009-
EXTENT_NORESERVE, NULL);
5008+
EXTENT_NORESERVE, &cached_state);
5009+
5010+
btrfs_unlock_extent(io_tree, block_start, block_end, &cached_state);
50105011

50115012
out_unlock:
50125013
if (ret) {

0 commit comments

Comments
 (0)