btrfs: use precomputed end offsets at do_trimming()
authorFilipe Manana <fdmanana@suse.com>
Thu, 4 May 2023 11:04:21 +0000 (12:04 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Jun 2023 11:59:24 +0000 (13:59 +0200)
The are two computations of end offsets at do_trimming() that are not
necessary, as they were previously computed and stored in local const
variables. So just use the variables instead, to make the source code
shorter and easier to read.

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/free-space-cache.c

index 7f69fcc..985bc94 100644 (file)
@@ -3676,7 +3676,7 @@ static int do_trimming(struct btrfs_block_group *block_group,
                __btrfs_add_free_space(block_group, reserved_start,
                                       start - reserved_start,
                                       reserved_trim_state);
-       if (start + bytes < reserved_start + reserved_bytes)
+       if (end < reserved_end)
                __btrfs_add_free_space(block_group, end, reserved_end - end,
                                       reserved_trim_state);
        __btrfs_add_free_space(block_group, start, bytes, trim_state);