mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-14 14:42:34 -04:00
btrfs: make btrfs_delete_delayed_insertion_item() return a boolean
There's no need to return an integer as all we need to do is return true or false to tell whether we deleted a delayed item or not. Also the logic is inverted since we return 1 (true) if we didn't delete and 0 (false) if we did, which is somewhat counter intuitive. Change the return type to a boolean and make it return true if we deleted and false otherwise. Reviewed-by: Boris Burkov <boris@bur.io> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
7077d7b872
commit
0187acef35
@@ -1540,8 +1540,8 @@ int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int btrfs_delete_delayed_insertion_item(struct btrfs_delayed_node *node,
|
||||
u64 index)
|
||||
static bool btrfs_delete_delayed_insertion_item(struct btrfs_delayed_node *node,
|
||||
u64 index)
|
||||
{
|
||||
struct btrfs_delayed_item *item;
|
||||
|
||||
@@ -1549,7 +1549,7 @@ static int btrfs_delete_delayed_insertion_item(struct btrfs_delayed_node *node,
|
||||
item = __btrfs_lookup_delayed_item(&node->ins_root.rb_root, index);
|
||||
if (!item) {
|
||||
mutex_unlock(&node->mutex);
|
||||
return 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1584,7 +1584,7 @@ static int btrfs_delete_delayed_insertion_item(struct btrfs_delayed_node *node,
|
||||
}
|
||||
|
||||
mutex_unlock(&node->mutex);
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
int btrfs_delete_delayed_dir_index(struct btrfs_trans_handle *trans,
|
||||
@@ -1598,9 +1598,10 @@ int btrfs_delete_delayed_dir_index(struct btrfs_trans_handle *trans,
|
||||
if (IS_ERR(node))
|
||||
return PTR_ERR(node);
|
||||
|
||||
ret = btrfs_delete_delayed_insertion_item(node, index);
|
||||
if (!ret)
|
||||
if (btrfs_delete_delayed_insertion_item(node, index)) {
|
||||
ret = 0;
|
||||
goto end;
|
||||
}
|
||||
|
||||
item = btrfs_alloc_delayed_item(0, node, BTRFS_DELAYED_DELETION_ITEM);
|
||||
if (!item) {
|
||||
|
||||
Reference in New Issue
Block a user