diff options
| author | Filipe Manana <fdmanana@suse.com> | 2026-01-16 10:24:06 +0000 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-02-03 07:54:36 +0100 |
| commit | 4ac81c381102bebf09a47946b343d70ed455c646 (patch) | |
| tree | 06ca0357746c5de131903bb47d50859c936b6401 /fs/btrfs/extent-tree.c | |
| parent | 57a4a863cda8b02dc0d46a36ec5cd5f86993b7aa (diff) | |
| download | linux-next-4ac81c381102bebf09a47946b343d70ed455c646.tar.gz linux-next-4ac81c381102bebf09a47946b343d70ed455c646.zip | |
btrfs: use the btrfs_block_group_end() helper everywhere
We have a helper to calculate a block group's exclusive end offset, but
we only use it in some places. Update every site that open codes the
calculation to use the helper.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
| -rw-r--r-- | fs/btrfs/extent-tree.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 6fab7765057e..bd4d134a3380 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -2784,8 +2784,7 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info, u64 len; bool readonly; - if (!cache || - start >= cache->start + cache->length) { + if (!cache || start >= btrfs_block_group_end(cache)) { if (cache) btrfs_put_block_group(cache); total_unpinned = 0; @@ -2801,7 +2800,7 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info, empty_cluster <<= 1; } - len = cache->start + cache->length - start; + len = btrfs_block_group_end(cache) - start; len = min(len, end + 1 - start); if (return_free_space) @@ -4683,7 +4682,7 @@ have_block_group: /* move on to the next group */ if (ffe_ctl->search_start + ffe_ctl->num_bytes > - block_group->start + block_group->length) { + btrfs_block_group_end(block_group)) { btrfs_add_free_space_unused(block_group, ffe_ctl->found_offset, ffe_ctl->num_bytes); @@ -6651,7 +6650,7 @@ int btrfs_trim_fs(struct btrfs_fs_info *fs_info, struct fstrim_range *range) } start = max(range->start, cache->start); - end = min(range_end, cache->start + cache->length); + end = min(range_end, btrfs_block_group_end(cache)); if (end - start >= range->minlen) { if (!btrfs_block_group_done(cache)) { |
