btrfs: make should_throttle loop local in btrfs_truncate_inode_items
authorJosef Bacik <josef@toxicpanda.com>
Fri, 3 Dec 2021 22:18:19 +0000 (17:18 -0500)
committerDavid Sterba <dsterba@suse.com>
Fri, 7 Jan 2022 13:18:25 +0000 (14:18 +0100)
We reset this bool on every loop through the truncate loop, make this
variable local to the loop.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode-item.c

index ef1a9efe08c00f30284c7ee4f1b5b1a1a2a0ec7e..0eeb5ea878948e129fe8824a68fe57d9b62a9e3c 100644 (file)
@@ -473,7 +473,6 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
        int ret;
        u64 bytes_deleted = 0;
        bool be_nice = false;
-       bool should_throttle = false;
 
        ASSERT(control->inode || !control->clear_extent_range);
        ASSERT(new_size == 0 || control->min_type == BTRFS_EXTENT_DATA_KEY);
@@ -523,6 +522,7 @@ search_again:
 
        while (1) {
                u64 clear_start = 0, clear_len = 0, extent_start = 0;
+               bool should_throttle = false;
 
                fi = NULL;
                leaf = path->nodes[0];
@@ -665,7 +665,6 @@ delete:
                        control->last_size = new_size;
                        break;
                }
-               should_throttle = false;
 
                if (del_item && extent_start != 0 && !control->skip_ref_updates) {
                        struct btrfs_ref ref = { 0 };