diff options
author | Filipe Manana <fdmanana@suse.com> | 2023-03-21 11:13:42 +0000 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-04-17 18:01:18 +0200 |
commit | 3a49a5489490acec43c66ad9db62f090af9d9f73 (patch) | |
tree | 5cdf77189c38b394b3af90b0b30a9196c85b3482 /fs/btrfs/space-info.c | |
parent | 9d0d47d5c3c5b53d444ecf7022bedc5553c544c0 (diff) |
btrfs: initialize ret to -ENOSPC at __reserve_bytes()
At space-info.c:__reserve_bytes(), instead of initializing 'ret' to 0 when
it's declared and then shortly after set it to -ENOSPC under the space
info's spinlock, initialize it to -ENOSPC when declaring it.
Reviewed-by: Josef Bacik <josef@toxicpanda.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/space-info.c')
-rw-r--r-- | fs/btrfs/space-info.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 379a0e778dfb..5eb161d96e35 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -1599,7 +1599,7 @@ static int __reserve_bytes(struct btrfs_fs_info *fs_info, struct reserve_ticket ticket; u64 start_ns = 0; u64 used; - int ret = 0; + int ret = -ENOSPC; bool pending_tickets; ASSERT(orig_bytes); @@ -1622,7 +1622,6 @@ static int __reserve_bytes(struct btrfs_fs_info *fs_info, async_work = &fs_info->async_reclaim_work; spin_lock(&space_info->lock); - ret = -ENOSPC; used = btrfs_space_info_used(space_info, true); /* |