• Home
  • Raw
  • Download

Lines Matching refs:level

28 		      *root, struct btrfs_path *path, int level);
40 struct btrfs_path *path, int level, int slot);
243 int level; in btrfs_copy_root() local
250 level = btrfs_header_level(buf); in btrfs_copy_root()
251 if (level == 0) in btrfs_copy_root()
257 new_root_objectid, &disk_key, level, in btrfs_copy_root()
439 int level, ret; in __btrfs_cow_block() local
453 level = btrfs_header_level(buf); in __btrfs_cow_block()
455 if (level == 0) in __btrfs_cow_block()
470 level, search_start, empty_size, 1); in __btrfs_cow_block()
855 int level, int *slot) in bin_search() argument
857 if (level == 0) { in bin_search()
874 int level, int *slot) in btrfs_bin_search() argument
876 return bin_search(eb, key, level, slot); in btrfs_bin_search()
902 int level = btrfs_header_level(parent); in read_node_slot() local
908 BUG_ON(level == 0); in read_node_slot()
911 btrfs_level_size(root, level - 1), in read_node_slot()
922 struct btrfs_path *path, int level) in balance_level() argument
931 int orig_slot = path->slots[level]; in balance_level()
934 if (level == 0) in balance_level()
937 mid = path->nodes[level]; in balance_level()
939 WARN_ON(path->locks[level] != BTRFS_WRITE_LOCK && in balance_level()
940 path->locks[level] != BTRFS_WRITE_LOCK_BLOCKING); in balance_level()
945 if (level < BTRFS_MAX_LEVEL - 1) { in balance_level()
946 parent = path->nodes[level + 1]; in balance_level()
947 pslot = path->slots[level + 1]; in balance_level()
982 path->locks[level] = 0; in balance_level()
983 path->nodes[level] = NULL; in balance_level()
1043 del_ptr(trans, root, path, level + 1, pslot + 1); in balance_level()
1085 del_ptr(trans, root, path, level + 1, pslot); in balance_level()
1103 path->nodes[level] = left; in balance_level()
1104 path->slots[level + 1] -= 1; in balance_level()
1105 path->slots[level] = orig_slot; in balance_level()
1112 path->slots[level] = orig_slot; in balance_level()
1117 btrfs_node_blockptr(path->nodes[level], path->slots[level])) in balance_level()
1125 if (path->nodes[level] != left) in balance_level()
1138 struct btrfs_path *path, int level) in push_nodes_for_insert() argument
1147 int orig_slot = path->slots[level]; in push_nodes_for_insert()
1149 if (level == 0) in push_nodes_for_insert()
1152 mid = path->nodes[level]; in push_nodes_for_insert()
1155 if (level < BTRFS_MAX_LEVEL - 1) { in push_nodes_for_insert()
1156 parent = path->nodes[level + 1]; in push_nodes_for_insert()
1157 pslot = path->slots[level + 1]; in push_nodes_for_insert()
1194 path->nodes[level] = left; in push_nodes_for_insert()
1195 path->slots[level + 1] -= 1; in push_nodes_for_insert()
1196 path->slots[level] = orig_slot; in push_nodes_for_insert()
1202 path->slots[level] = orig_slot; in push_nodes_for_insert()
1246 path->nodes[level] = right; in push_nodes_for_insert()
1247 path->slots[level + 1] += 1; in push_nodes_for_insert()
1248 path->slots[level] = orig_slot - in push_nodes_for_insert()
1270 int level, int slot, u64 objectid) in reada_for_search() argument
1285 if (level != 1) in reada_for_search()
1288 if (!path->nodes[level]) in reada_for_search()
1291 node = path->nodes[level]; in reada_for_search()
1294 blocksize = btrfs_level_size(root, level - 1); in reada_for_search()
1339 struct btrfs_path *path, int level) in reada_for_balance() argument
1351 parent = path->nodes[level + 1]; in reada_for_balance()
1356 slot = path->slots[level + 1]; in reada_for_balance()
1357 blocksize = btrfs_level_size(root, level); in reada_for_balance()
1418 static noinline void unlock_up(struct btrfs_path *path, int level, in unlock_up() argument
1423 int skip_level = level; in unlock_up()
1427 for (i = level; i < BTRFS_MAX_LEVEL; i++) { in unlock_up()
1470 noinline void btrfs_unlock_up_safe(struct btrfs_path *path, int level) in btrfs_unlock_up_safe() argument
1477 for (i = level; i < BTRFS_MAX_LEVEL; i++) { in btrfs_unlock_up_safe()
1498 struct extent_buffer **eb_ret, int level, int slot, in read_block_for_search() argument
1510 blocksize = btrfs_level_size(root, level - 1); in read_block_for_search()
1553 btrfs_unlock_up_safe(p, level + 1); in read_block_for_search()
1558 reada_for_search(root, p, level, slot, key->objectid); in read_block_for_search()
1590 struct extent_buffer *b, int level, int ins_len, in setup_nodes_for_search() argument
1598 if (*write_lock_level < level + 1) { in setup_nodes_for_search()
1599 *write_lock_level = level + 1; in setup_nodes_for_search()
1604 sret = reada_for_balance(root, p, level); in setup_nodes_for_search()
1609 sret = split_node(trans, root, p, level); in setup_nodes_for_search()
1617 b = p->nodes[level]; in setup_nodes_for_search()
1622 if (*write_lock_level < level + 1) { in setup_nodes_for_search()
1623 *write_lock_level = level + 1; in setup_nodes_for_search()
1628 sret = reada_for_balance(root, p, level); in setup_nodes_for_search()
1633 sret = balance_level(trans, root, p, level); in setup_nodes_for_search()
1640 b = p->nodes[level]; in setup_nodes_for_search()
1676 int level; in btrfs_search_slot() local
1717 level = 0; in btrfs_search_slot()
1725 level = btrfs_header_level(b); in btrfs_search_slot()
1731 level = btrfs_header_level(b); in btrfs_search_slot()
1737 level = btrfs_header_level(b); in btrfs_search_slot()
1738 if (level <= write_lock_level) { in btrfs_search_slot()
1746 level = btrfs_header_level(b); in btrfs_search_slot()
1750 p->nodes[level] = b; in btrfs_search_slot()
1752 p->locks[level] = root_lock; in btrfs_search_slot()
1755 level = btrfs_header_level(b); in btrfs_search_slot()
1776 if (level + 1 > write_lock_level) { in btrfs_search_slot()
1777 write_lock_level = level + 1; in btrfs_search_slot()
1783 p->nodes[level + 1], in btrfs_search_slot()
1784 p->slots[level + 1], &b); in btrfs_search_slot()
1793 p->nodes[level] = b; in btrfs_search_slot()
1808 btrfs_unlock_up_safe(p, level + 1); in btrfs_search_slot()
1810 ret = bin_search(b, key, level, &slot); in btrfs_search_slot()
1812 if (level != 0) { in btrfs_search_slot()
1818 p->slots[level] = slot; in btrfs_search_slot()
1819 err = setup_nodes_for_search(trans, root, p, b, level, in btrfs_search_slot()
1827 b = p->nodes[level]; in btrfs_search_slot()
1828 slot = p->slots[level]; in btrfs_search_slot()
1837 write_lock_level < level + 1) { in btrfs_search_slot()
1838 write_lock_level = level + 1; in btrfs_search_slot()
1843 unlock_up(p, level, lowest_unlock, in btrfs_search_slot()
1846 if (level == lowest_level) { in btrfs_search_slot()
1848 p->slots[level]++; in btrfs_search_slot()
1853 &b, level, slot, key); in btrfs_search_slot()
1862 level = btrfs_header_level(b); in btrfs_search_slot()
1863 if (level <= write_lock_level) { in btrfs_search_slot()
1871 p->locks[level] = BTRFS_WRITE_LOCK; in btrfs_search_slot()
1880 p->locks[level] = BTRFS_READ_LOCK; in btrfs_search_slot()
1882 p->nodes[level] = b; in btrfs_search_slot()
1885 p->slots[level] = slot; in btrfs_search_slot()
1906 unlock_up(p, level, lowest_unlock, in btrfs_search_slot()
1934 struct btrfs_disk_key *key, int level) in fixup_low_keys() argument
1939 for (i = level; i < BTRFS_MAX_LEVEL; i++) { in fixup_low_keys()
2113 struct btrfs_path *path, int level) in insert_new_root() argument
2121 BUG_ON(path->nodes[level]); in insert_new_root()
2122 BUG_ON(path->nodes[level-1] != root->node); in insert_new_root()
2124 lower = path->nodes[level-1]; in insert_new_root()
2125 if (level == 1) in insert_new_root()
2132 level, root->node->start, 0, 0); in insert_new_root()
2140 btrfs_set_header_level(c, level); in insert_new_root()
2171 path->nodes[level] = c; in insert_new_root()
2172 path->locks[level] = BTRFS_WRITE_LOCK; in insert_new_root()
2173 path->slots[level] = 0; in insert_new_root()
2187 int slot, int level) in insert_ptr() argument
2192 BUG_ON(!path->nodes[level]); in insert_ptr()
2193 btrfs_assert_tree_locked(path->nodes[level]); in insert_ptr()
2194 lower = path->nodes[level]; in insert_ptr()
2223 struct btrfs_path *path, int level) in split_node() argument
2232 c = path->nodes[level]; in split_node()
2236 ret = insert_new_root(trans, root, path, level + 1); in split_node()
2240 ret = push_nodes_for_insert(trans, root, path, level); in split_node()
2241 c = path->nodes[level]; in split_node()
2255 &disk_key, level, c->start, 0, 0); in split_node()
2287 path->slots[level + 1] + 1, level + 1); in split_node()
2289 if (path->slots[level] >= mid) { in split_node()
2290 path->slots[level] -= mid; in split_node()
2293 path->nodes[level] = split; in split_node()
2294 path->slots[level + 1] += 1; in split_node()
3752 struct btrfs_path *path, int level, int slot) in del_ptr() argument
3754 struct extent_buffer *parent = path->nodes[level]; in del_ptr()
3775 fixup_low_keys(trans, root, path, &disk_key, level + 1); in del_ptr()
3993 int level; in btrfs_search_forward() local
3999 level = btrfs_header_level(cur); in btrfs_search_forward()
4000 WARN_ON(path->nodes[level]); in btrfs_search_forward()
4001 path->nodes[level] = cur; in btrfs_search_forward()
4002 path->locks[level] = BTRFS_READ_LOCK; in btrfs_search_forward()
4010 level = btrfs_header_level(cur); in btrfs_search_forward()
4011 sret = bin_search(cur, min_key, level, &slot); in btrfs_search_forward()
4014 if (level == path->lowest_level) { in btrfs_search_forward()
4018 path->slots[level] = slot; in btrfs_search_forward()
4053 btrfs_level_size(root, level - 1)); in btrfs_search_forward()
4069 path->slots[level] = slot; in btrfs_search_forward()
4071 sret = btrfs_find_next_key(root, path, min_key, level, in btrfs_search_forward()
4082 path->slots[level] = slot; in btrfs_search_forward()
4083 if (level == path->lowest_level) { in btrfs_search_forward()
4085 unlock_up(path, level, 1, 0, NULL); in btrfs_search_forward()
4094 path->locks[level - 1] = BTRFS_READ_LOCK; in btrfs_search_forward()
4095 path->nodes[level - 1] = cur; in btrfs_search_forward()
4096 unlock_up(path, level, 1, 0, NULL); in btrfs_search_forward()
4119 struct btrfs_key *key, int level, in btrfs_find_next_key() argument
4126 while (level < BTRFS_MAX_LEVEL) { in btrfs_find_next_key()
4127 if (!path->nodes[level]) in btrfs_find_next_key()
4130 slot = path->slots[level] + 1; in btrfs_find_next_key()
4131 c = path->nodes[level]; in btrfs_find_next_key()
4137 if (level + 1 >= BTRFS_MAX_LEVEL || in btrfs_find_next_key()
4138 !path->nodes[level + 1]) in btrfs_find_next_key()
4141 if (path->locks[level + 1]) { in btrfs_find_next_key()
4142 level++; in btrfs_find_next_key()
4147 if (level == 0) in btrfs_find_next_key()
4154 path->lowest_level = level; in btrfs_find_next_key()
4161 c = path->nodes[level]; in btrfs_find_next_key()
4162 slot = path->slots[level]; in btrfs_find_next_key()
4168 if (level == 0) in btrfs_find_next_key()
4177 btrfs_level_size(root, level - 1)); in btrfs_find_next_key()
4206 int level; in btrfs_next_leaf() local
4221 level = 1; in btrfs_next_leaf()
4249 while (level < BTRFS_MAX_LEVEL) { in btrfs_next_leaf()
4250 if (!path->nodes[level]) { in btrfs_next_leaf()
4255 slot = path->slots[level] + 1; in btrfs_next_leaf()
4256 c = path->nodes[level]; in btrfs_next_leaf()
4258 level++; in btrfs_next_leaf()
4259 if (level == BTRFS_MAX_LEVEL) { in btrfs_next_leaf()
4272 next_rw_lock = path->locks[level]; in btrfs_next_leaf()
4273 ret = read_block_for_search(NULL, root, path, &next, level, in btrfs_next_leaf()
4295 path->slots[level] = slot; in btrfs_next_leaf()
4297 level--; in btrfs_next_leaf()
4298 c = path->nodes[level]; in btrfs_next_leaf()
4299 if (path->locks[level]) in btrfs_next_leaf()
4300 btrfs_tree_unlock_rw(c, path->locks[level]); in btrfs_next_leaf()
4303 path->nodes[level] = next; in btrfs_next_leaf()
4304 path->slots[level] = 0; in btrfs_next_leaf()
4306 path->locks[level] = next_rw_lock; in btrfs_next_leaf()
4307 if (!level) in btrfs_next_leaf()
4310 ret = read_block_for_search(NULL, root, path, &next, level, in btrfs_next_leaf()