summaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/libxed.py
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2025-03-27 12:44:58 +1030
committerDavid Sterba <dsterba@suse.com>2025-05-15 14:30:40 +0200
commit581bb9e761f93df37c40ff8e6904796aa6d8aa41 (patch)
tree74d6535c7172d976df156efbaaf477086aec3584 /tools/perf/scripts/python/libxed.py
parent5c41f6010ef8139bf19c63419498fd1d38d3ed2b (diff)
downloadlinux-581bb9e761f93df37c40ff8e6904796aa6d8aa41.tar.gz
linux-581bb9e761f93df37c40ff8e6904796aa6d8aa41.zip
btrfs: refactor how we handle reserved space inside copy_one_range()
There are several things not ideal in copy_one_range(): - Unnecessary temporary variables * block_offset * reserve_bytes * dirty_blocks * num_blocks * release_bytes These are utilized to handle short-copy cases. - Inconsistent handling of btrfs_delalloc_release_extents() There is a hidden behavior that, after reserving metadata for X bytes of data write, we have to call btrfs_delalloc_release_extents() with X once and only once. Calling btrfs_delalloc_release_extents(X - 4K) and btrfs_delalloc_release_extents(4K) will cause outstanding extents accounting to go wrong. This is because the outstanding extents mechanism is not designed to handle shrinking of reserved space. Improve above situations by: - Use a single @reserved_start and @reserved_len pair Now we reserve space for the initial range, and if a short copy happened and we need to shrink the reserved space, we can easily calculate the new length, and update @reserved_len. - Introduce helpers to shrink reserved data and metadata space This is done by two new helpers, shrink_reserved_space() and btrfs_delalloc_shrink_extents(). The later will do a better calculation if we need to modify the outstanding extents, and the first one will be utilized inside copy_one_range(). - Manually unlock, release reserved space and return if no byte is copied Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tools/perf/scripts/python/libxed.py')
0 files changed, 0 insertions, 0 deletions