Skip to content

Commit e376283

Browse files
fdmananakdave
authored andcommitted
btrfs: use cached state when falling back from NOCoW write to CoW write
We have a cached extent state record from the previous extent locking so we can use when setting the EXTENT_NORESERVE in the range, allowing the operation to be faster if the extent io tree is relatively large. Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent f3dc116 commit e376283

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/btrfs/inode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1754,7 +1754,8 @@ static int fallback_to_cow(struct btrfs_inode *inode,
17541754
spin_unlock(&sinfo->lock);
17551755

17561756
if (count > 0)
1757-
btrfs_clear_extent_bits(io_tree, start, end, EXTENT_NORESERVE);
1757+
btrfs_clear_extent_bit(io_tree, start, end, EXTENT_NORESERVE,
1758+
&cached_state);
17581759
}
17591760
btrfs_unlock_extent(io_tree, start, end, &cached_state);
17601761

0 commit comments

Comments
 (0)