aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2017-12-13 02:38:14 -0500
committerDavid Sterba <dsterba@suse.com>2018-01-22 10:08:19 -0500
commit4271ecea64f40683d28d83ad433ddc43e5ca2ee9 (patch)
treeedb58cbd52b4c2651f8538d0a2e945069f9f34b4
parent36243c9199d6df63a0fbebd4fc49a1af21f3d8a8 (diff)
btrfs: Improve btrfs_search_slot description
Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/ctree.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 2a09577580b8..b88a79e69ddf 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -2654,17 +2654,29 @@ int btrfs_find_item(struct btrfs_root *fs_root, struct btrfs_path *path,
2654} 2654}
2655 2655
2656/* 2656/*
2657 * look for key in the tree. path is filled in with nodes along the way 2657 * btrfs_search_slot - look for a key in a tree and perform necessary
2658 * if key is found, we return zero and you can find the item in the leaf 2658 * modifications to preserve tree invariants.
2659 * level of the path (level 0)
2660 * 2659 *
2661 * If the key isn't found, the path points to the slot where it should 2660 * @trans: Handle of transaction, used when modifying the tree
2662 * be inserted, and 1 is returned. If there are other errors during the 2661 * @p: Holds all btree nodes along the search path
2663 * search a negative error number is returned. 2662 * @root: The root node of the tree
2663 * @key: The key we are looking for
2664 * @ins_len: Indicates purpose of search, for inserts it is 1, for
2665 * deletions it's -1. 0 for plain searches
2666 * @cow: boolean should CoW operations be performed. Must always be 1
2667 * when modifying the tree.
2664 * 2668 *
2665 * if ins_len > 0, nodes and leaves will be split as we walk down the 2669 * If @ins_len > 0, nodes and leaves will be split as we walk down the tree.
2666 * tree. if ins_len < 0, nodes will be merged as we walk down the tree (if 2670 * If @ins_len < 0, nodes will be merged as we walk down the tree (if possible)
2667 * possible) 2671 *
2672 * If @key is found, 0 is returned and you can find the item in the leaf level
2673 * of the path (level 0)
2674 *
2675 * If @key isn't found, 1 is returned and the leaf level of the path (level 0)
2676 * points to the slot where it should be inserted
2677 *
2678 * If an error is encountered while searching the tree a negative error number
2679 * is returned
2668 */ 2680 */
2669int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root, 2681int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root,
2670 const struct btrfs_key *key, struct btrfs_path *p, 2682 const struct btrfs_key *key, struct btrfs_path *p,