Commit 0187acef authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba
Browse files

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: default avatarBoris Burkov <boris@bur.io>
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 7077d7b8
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -1540,7 +1540,7 @@ 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,
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) {