Lines Matching +full:1 +full:p
15 return 1; in btrfs_comp_keys()
17 return -1; in btrfs_comp_keys()
19 return 1; in btrfs_comp_keys()
21 return -1; in btrfs_comp_keys()
23 return 1; in btrfs_comp_keys()
25 return -1; in btrfs_comp_keys()
32 return 1; in btrfs_comp_keys_type()
34 return -1; in btrfs_comp_keys_type()
36 return 1; in btrfs_comp_keys_type()
38 return -1; in btrfs_comp_keys_type()
55 low = mid + 1; in generic_bin_search()
65 return 1; in generic_bin_search()
68 int btrfs_bin_search(union btrfs_tree_node *p, struct btrfs_key *key, in btrfs_bin_search() argument
74 if (p->header.level) { in btrfs_bin_search()
75 addr = p->node.ptrs; in btrfs_bin_search()
78 addr = p->leaf.items; in btrfs_bin_search()
82 return generic_bin_search(addr, size, key, p->header.nritems, slot); in btrfs_bin_search()
85 static void clear_path(struct btrfs_path *p) in clear_path() argument
90 p->nodes[i] = NULL; in clear_path()
91 p->slots[i] = 0; in clear_path()
95 void btrfs_free_path(struct btrfs_path *p) in btrfs_free_path() argument
100 if (p->nodes[i]) in btrfs_free_path()
101 free(p->nodes[i]); in btrfs_free_path()
104 clear_path(p); in btrfs_free_path()
116 return -1; in read_tree_node()
129 return -1; in read_tree_node()
135 return -1; in read_tree_node()
152 struct btrfs_path *p) in btrfs_search_tree() argument
159 clear_path(p); in btrfs_search_tree()
165 if (physical == -1ULL) in btrfs_search_tree()
172 if (i && prev_lvl != lvl + 1) { in btrfs_search_tree()
183 slot -= 1; in btrfs_search_tree()
185 p->slots[lvl] = slot; in btrfs_search_tree()
186 p->nodes[lvl] = buf; in btrfs_search_tree()
196 btrfs_free_path(p); in btrfs_search_tree()
197 return -1; in btrfs_search_tree()
202 struct btrfs_path p; in jump_leaf() local
204 int level = 1, from_level, i; in jump_leaf()
206 dir = dir >= 0 ? 1 : -1; in jump_leaf()
208 p = *path; in jump_leaf()
211 if (!p.nodes[level]) in jump_leaf()
212 return 1; in jump_leaf()
214 slot = p.slots[level]; in jump_leaf()
215 if ((dir > 0 && slot + dir >= p.nodes[level]->header.nritems) in jump_leaf()
223 return 1; in jump_leaf()
225 p.slots[level] = slot + dir; in jump_leaf()
232 slot = p.slots[level + 1]; in jump_leaf()
233 logical = p.nodes[level + 1]->node.ptrs[slot].blockptr; in jump_leaf()
235 if (physical == -1ULL) in jump_leaf()
238 if (read_tree_node(physical, &p.nodes[level])) in jump_leaf()
242 p.slots[level] = 0; in jump_leaf()
244 p.slots[level] = p.nodes[level]->header.nritems - 1; in jump_leaf()
252 *path = p; in jump_leaf()
256 /* Free rewritten nodes in p */ in jump_leaf()
257 for (i = level + 1; i <= from_level; ++i) in jump_leaf()
258 free(p.nodes[i]); in jump_leaf()
259 return -1; in jump_leaf()
262 int btrfs_prev_slot(struct btrfs_path *p) in btrfs_prev_slot() argument
264 if (!p->slots[0]) in btrfs_prev_slot()
265 return jump_leaf(p, -1); in btrfs_prev_slot()
267 p->slots[0]--; in btrfs_prev_slot()
271 int btrfs_next_slot(struct btrfs_path *p) in btrfs_next_slot() argument
273 struct btrfs_leaf *leaf = &p->nodes[0]->leaf; in btrfs_next_slot()
275 if (p->slots[0] + 1 >= leaf->header.nritems) in btrfs_next_slot()
276 return jump_leaf(p, 1); in btrfs_next_slot()
278 p->slots[0]++; in btrfs_next_slot()