Lines Matching full:level
26 int level = NILFS_BTREE_LEVEL_DATA; in nilfs_btree_alloc_path() local
32 for (; level < NILFS_BTREE_LEVEL_MAX; level++) { in nilfs_btree_alloc_path()
33 path[level].bp_bh = NULL; in nilfs_btree_alloc_path()
34 path[level].bp_sib_bh = NULL; in nilfs_btree_alloc_path()
35 path[level].bp_index = 0; in nilfs_btree_alloc_path()
36 path[level].bp_oldreq.bpr_ptr = NILFS_BMAP_INVALID_PTR; in nilfs_btree_alloc_path()
37 path[level].bp_newreq.bpr_ptr = NILFS_BMAP_INVALID_PTR; in nilfs_btree_alloc_path()
38 path[level].bp_op = NULL; in nilfs_btree_alloc_path()
47 int level = NILFS_BTREE_LEVEL_DATA; in nilfs_btree_free_path() local
49 for (; level < NILFS_BTREE_LEVEL_MAX; level++) in nilfs_btree_free_path()
50 brelse(path[level].bp_bh); in nilfs_btree_free_path()
96 nilfs_btree_node_set_level(struct nilfs_btree_node *node, int level) in nilfs_btree_node_set_level() argument
98 node->bn_level = level; in nilfs_btree_node_set_level()
163 int level, int nchildren, int ncmax, in nilfs_btree_node_init() argument
171 nilfs_btree_node_set_level(node, level); in nilfs_btree_node_init()
343 int level, flags, nchildren; in nilfs_btree_node_broken() local
346 level = nilfs_btree_node_get_level(node); in nilfs_btree_node_broken()
350 if (unlikely(level < NILFS_BTREE_LEVEL_NODE_MIN || in nilfs_btree_node_broken()
351 level >= NILFS_BTREE_LEVEL_MAX || in nilfs_btree_node_broken()
356 "bad btree node (ino=%lu, blocknr=%llu): level = %d, flags = 0x%x, nchildren = %d", in nilfs_btree_node_broken()
357 inode->i_ino, (unsigned long long)blocknr, level, in nilfs_btree_node_broken()
374 int level, flags, nchildren; in nilfs_btree_root_broken() local
377 level = nilfs_btree_node_get_level(node); in nilfs_btree_root_broken()
381 if (unlikely(level < NILFS_BTREE_LEVEL_NODE_MIN || in nilfs_btree_root_broken()
382 level >= NILFS_BTREE_LEVEL_MAX || in nilfs_btree_root_broken()
385 (nchildren == 0 && level > NILFS_BTREE_LEVEL_NODE_MIN))) { in nilfs_btree_root_broken()
387 "bad btree root (ino=%lu): level = %d, flags = 0x%x, nchildren = %d", in nilfs_btree_root_broken()
388 inode->i_ino, level, flags, nchildren); in nilfs_btree_root_broken()
417 nilfs_btree_get_nonroot_node(const struct nilfs_btree_path *path, int level) in nilfs_btree_get_nonroot_node() argument
419 return (struct nilfs_btree_node *)path[level].bp_bh->b_data; in nilfs_btree_get_nonroot_node()
423 nilfs_btree_get_sib_node(const struct nilfs_btree_path *path, int level) in nilfs_btree_get_sib_node() argument
425 return (struct nilfs_btree_node *)path[level].bp_sib_bh->b_data; in nilfs_btree_get_sib_node()
436 int level, int *ncmaxp) in nilfs_btree_get_node() argument
440 if (level == nilfs_btree_height(btree) - 1) { in nilfs_btree_get_node()
444 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_get_node()
451 struct nilfs_btree_node *node, int level) in nilfs_btree_bad_node() argument
453 if (unlikely(nilfs_btree_node_get_level(node) != level)) { in nilfs_btree_bad_node()
456 "btree level mismatch (ino=%lu): %d != %d", in nilfs_btree_bad_node()
458 nilfs_btree_node_get_level(node), level); in nilfs_btree_bad_node()
555 int level, index, found, ncmax, ret; in nilfs_btree_do_lookup() local
558 level = nilfs_btree_node_get_level(node); in nilfs_btree_do_lookup()
559 if (level < minlevel || nilfs_btree_node_get_nchildren(node) <= 0) in nilfs_btree_do_lookup()
565 path[level].bp_bh = NULL; in nilfs_btree_do_lookup()
566 path[level].bp_index = index; in nilfs_btree_do_lookup()
570 while (--level >= minlevel) { in nilfs_btree_do_lookup()
572 if (level == NILFS_BTREE_LEVEL_NODE_MIN && readahead) { in nilfs_btree_do_lookup()
573 p.node = nilfs_btree_get_node(btree, path, level + 1, in nilfs_btree_do_lookup()
579 ret = __nilfs_btree_get_block(btree, ptr, &path[level].bp_bh, in nilfs_btree_do_lookup()
584 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_do_lookup()
585 if (nilfs_btree_bad_node(btree, node, level)) in nilfs_btree_do_lookup()
594 WARN_ON(found || level != NILFS_BTREE_LEVEL_NODE_MIN); in nilfs_btree_do_lookup()
598 path[level].bp_index = index; in nilfs_btree_do_lookup()
615 int index, level, ncmax, ret; in nilfs_btree_do_lookup_last() local
621 level = nilfs_btree_node_get_level(node); in nilfs_btree_do_lookup_last()
624 path[level].bp_bh = NULL; in nilfs_btree_do_lookup_last()
625 path[level].bp_index = index; in nilfs_btree_do_lookup_last()
628 for (level--; level > 0; level--) { in nilfs_btree_do_lookup_last()
629 ret = nilfs_btree_get_block(btree, ptr, &path[level].bp_bh); in nilfs_btree_do_lookup_last()
632 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_do_lookup_last()
633 if (nilfs_btree_bad_node(btree, node, level)) in nilfs_btree_do_lookup_last()
637 path[level].bp_index = index; in nilfs_btree_do_lookup_last()
652 * @minlevel: start level
664 int index, next_adj, level; in nilfs_btree_get_next_key() local
668 for (level = minlevel; level <= maxlevel; level++) { in nilfs_btree_get_next_key()
669 if (level == maxlevel) in nilfs_btree_get_next_key()
672 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_get_next_key()
674 index = path[level].bp_index + next_adj; in nilfs_btree_get_next_key()
687 __u64 key, int level, __u64 *ptrp) in nilfs_btree_lookup() argument
696 ret = nilfs_btree_do_lookup(btree, path, key, ptrp, level, 0); in nilfs_btree_lookup()
712 int level = NILFS_BTREE_LEVEL_NODE_MIN; in nilfs_btree_lookup_contig() local
720 ret = nilfs_btree_do_lookup(btree, path, key, &ptr, level, 1); in nilfs_btree_lookup_contig()
736 node = nilfs_btree_get_node(btree, path, level, &ncmax); in nilfs_btree_lookup_contig()
737 index = path[level].bp_index + 1; in nilfs_btree_lookup_contig()
754 if (level == maxlevel) in nilfs_btree_lookup_contig()
758 p.node = nilfs_btree_get_node(btree, path, level + 1, &p.ncmax); in nilfs_btree_lookup_contig()
759 p.index = path[level + 1].bp_index + 1; in nilfs_btree_lookup_contig()
765 path[level + 1].bp_index = p.index; in nilfs_btree_lookup_contig()
767 brelse(path[level].bp_bh); in nilfs_btree_lookup_contig()
768 path[level].bp_bh = NULL; in nilfs_btree_lookup_contig()
770 ret = __nilfs_btree_get_block(btree, ptr2, &path[level].bp_bh, in nilfs_btree_lookup_contig()
774 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_lookup_contig()
777 path[level].bp_index = index; in nilfs_btree_lookup_contig()
794 int level, __u64 key) in nilfs_btree_promote_key() argument
796 if (level < nilfs_btree_height(btree) - 1) { in nilfs_btree_promote_key()
799 nilfs_btree_get_nonroot_node(path, level), in nilfs_btree_promote_key()
800 path[level].bp_index, key); in nilfs_btree_promote_key()
801 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_promote_key()
802 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_promote_key()
803 } while ((path[level].bp_index == 0) && in nilfs_btree_promote_key()
804 (++level < nilfs_btree_height(btree) - 1)); in nilfs_btree_promote_key()
808 if (level == nilfs_btree_height(btree) - 1) { in nilfs_btree_promote_key()
810 path[level].bp_index, key); in nilfs_btree_promote_key()
816 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_do_insert() argument
821 if (level < nilfs_btree_height(btree) - 1) { in nilfs_btree_do_insert()
822 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_do_insert()
824 nilfs_btree_node_insert(node, path[level].bp_index, in nilfs_btree_do_insert()
826 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_do_insert()
827 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_do_insert()
829 if (path[level].bp_index == 0) in nilfs_btree_do_insert()
830 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_do_insert()
835 nilfs_btree_node_insert(node, path[level].bp_index, in nilfs_btree_do_insert()
843 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_carry_left() argument
848 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_carry_left()
849 left = nilfs_btree_get_sib_node(path, level); in nilfs_btree_carry_left()
856 if (n > path[level].bp_index) { in nilfs_btree_carry_left()
864 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_carry_left()
865 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_carry_left()
866 if (!buffer_dirty(path[level].bp_sib_bh)) in nilfs_btree_carry_left()
867 mark_buffer_dirty(path[level].bp_sib_bh); in nilfs_btree_carry_left()
869 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_carry_left()
873 brelse(path[level].bp_bh); in nilfs_btree_carry_left()
874 path[level].bp_bh = path[level].bp_sib_bh; in nilfs_btree_carry_left()
875 path[level].bp_sib_bh = NULL; in nilfs_btree_carry_left()
876 path[level].bp_index += lnchildren; in nilfs_btree_carry_left()
877 path[level + 1].bp_index--; in nilfs_btree_carry_left()
879 brelse(path[level].bp_sib_bh); in nilfs_btree_carry_left()
880 path[level].bp_sib_bh = NULL; in nilfs_btree_carry_left()
881 path[level].bp_index -= n; in nilfs_btree_carry_left()
884 nilfs_btree_do_insert(btree, path, level, keyp, ptrp); in nilfs_btree_carry_left()
889 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_carry_right() argument
894 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_carry_right()
895 right = nilfs_btree_get_sib_node(path, level); in nilfs_btree_carry_right()
902 if (n > nchildren - path[level].bp_index) { in nilfs_btree_carry_right()
910 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_carry_right()
911 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_carry_right()
912 if (!buffer_dirty(path[level].bp_sib_bh)) in nilfs_btree_carry_right()
913 mark_buffer_dirty(path[level].bp_sib_bh); in nilfs_btree_carry_right()
915 path[level + 1].bp_index++; in nilfs_btree_carry_right()
916 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_carry_right()
918 path[level + 1].bp_index--; in nilfs_btree_carry_right()
921 brelse(path[level].bp_bh); in nilfs_btree_carry_right()
922 path[level].bp_bh = path[level].bp_sib_bh; in nilfs_btree_carry_right()
923 path[level].bp_sib_bh = NULL; in nilfs_btree_carry_right()
924 path[level].bp_index -= nilfs_btree_node_get_nchildren(node); in nilfs_btree_carry_right()
925 path[level + 1].bp_index++; in nilfs_btree_carry_right()
927 brelse(path[level].bp_sib_bh); in nilfs_btree_carry_right()
928 path[level].bp_sib_bh = NULL; in nilfs_btree_carry_right()
931 nilfs_btree_do_insert(btree, path, level, keyp, ptrp); in nilfs_btree_carry_right()
936 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_split() argument
941 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_split()
942 right = nilfs_btree_get_sib_node(path, level); in nilfs_btree_split()
948 if (n > nchildren - path[level].bp_index) { in nilfs_btree_split()
955 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_split()
956 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_split()
957 if (!buffer_dirty(path[level].bp_sib_bh)) in nilfs_btree_split()
958 mark_buffer_dirty(path[level].bp_sib_bh); in nilfs_btree_split()
961 path[level].bp_index -= nilfs_btree_node_get_nchildren(node); in nilfs_btree_split()
962 nilfs_btree_node_insert(right, path[level].bp_index, in nilfs_btree_split()
966 *ptrp = path[level].bp_newreq.bpr_ptr; in nilfs_btree_split()
968 brelse(path[level].bp_bh); in nilfs_btree_split()
969 path[level].bp_bh = path[level].bp_sib_bh; in nilfs_btree_split()
970 path[level].bp_sib_bh = NULL; in nilfs_btree_split()
972 nilfs_btree_do_insert(btree, path, level, keyp, ptrp); in nilfs_btree_split()
975 *ptrp = path[level].bp_newreq.bpr_ptr; in nilfs_btree_split()
977 brelse(path[level].bp_sib_bh); in nilfs_btree_split()
978 path[level].bp_sib_bh = NULL; in nilfs_btree_split()
981 path[level + 1].bp_index++; in nilfs_btree_split()
986 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_grow() argument
992 child = nilfs_btree_get_sib_node(path, level); in nilfs_btree_grow()
999 nilfs_btree_node_set_level(root, level + 1); in nilfs_btree_grow()
1001 if (!buffer_dirty(path[level].bp_sib_bh)) in nilfs_btree_grow()
1002 mark_buffer_dirty(path[level].bp_sib_bh); in nilfs_btree_grow()
1004 path[level].bp_bh = path[level].bp_sib_bh; in nilfs_btree_grow()
1005 path[level].bp_sib_bh = NULL; in nilfs_btree_grow()
1007 nilfs_btree_do_insert(btree, path, level, keyp, ptrp); in nilfs_btree_grow()
1010 *ptrp = path[level].bp_newreq.bpr_ptr; in nilfs_btree_grow()
1017 int level, ncmax; in nilfs_btree_find_near() local
1023 level = NILFS_BTREE_LEVEL_NODE_MIN; in nilfs_btree_find_near()
1024 if (path[level].bp_index > 0) { in nilfs_btree_find_near()
1025 node = nilfs_btree_get_node(btree, path, level, &ncmax); in nilfs_btree_find_near()
1027 path[level].bp_index - 1, in nilfs_btree_find_near()
1032 level = NILFS_BTREE_LEVEL_NODE_MIN + 1; in nilfs_btree_find_near()
1033 if (level <= nilfs_btree_height(btree) - 1) { in nilfs_btree_find_near()
1034 node = nilfs_btree_get_node(btree, path, level, &ncmax); in nilfs_btree_find_near()
1035 return nilfs_btree_node_get_ptr(node, path[level].bp_index, in nilfs_btree_find_near()
1070 int pindex, level, ncmax, ncblk, ret; in nilfs_btree_prepare_insert() local
1074 level = NILFS_BTREE_LEVEL_DATA; in nilfs_btree_prepare_insert()
1078 path[level].bp_newreq.bpr_ptr = in nilfs_btree_prepare_insert()
1083 ret = nilfs_bmap_prepare_alloc_ptr(btree, &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1089 for (level = NILFS_BTREE_LEVEL_NODE_MIN; in nilfs_btree_prepare_insert()
1090 level < nilfs_btree_height(btree) - 1; in nilfs_btree_prepare_insert()
1091 level++) { in nilfs_btree_prepare_insert()
1092 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_prepare_insert()
1094 path[level].bp_op = nilfs_btree_do_insert; in nilfs_btree_prepare_insert()
1099 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_prepare_insert()
1100 pindex = path[level + 1].bp_index; in nilfs_btree_prepare_insert()
1111 path[level].bp_sib_bh = bh; in nilfs_btree_prepare_insert()
1112 path[level].bp_op = nilfs_btree_carry_left; in nilfs_btree_prepare_insert()
1129 path[level].bp_sib_bh = bh; in nilfs_btree_prepare_insert()
1130 path[level].bp_op = nilfs_btree_carry_right; in nilfs_btree_prepare_insert()
1139 path[level].bp_newreq.bpr_ptr = in nilfs_btree_prepare_insert()
1140 path[level - 1].bp_newreq.bpr_ptr + 1; in nilfs_btree_prepare_insert()
1142 &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1146 path[level].bp_newreq.bpr_ptr, in nilfs_btree_prepare_insert()
1154 nilfs_btree_node_init(sib, 0, level, 0, ncblk, NULL, NULL); in nilfs_btree_prepare_insert()
1155 path[level].bp_sib_bh = bh; in nilfs_btree_prepare_insert()
1156 path[level].bp_op = nilfs_btree_split; in nilfs_btree_prepare_insert()
1163 path[level].bp_op = nilfs_btree_do_insert; in nilfs_btree_prepare_insert()
1169 path[level].bp_newreq.bpr_ptr = path[level - 1].bp_newreq.bpr_ptr + 1; in nilfs_btree_prepare_insert()
1170 ret = nilfs_bmap_prepare_alloc_ptr(btree, &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1173 ret = nilfs_btree_get_new_block(btree, path[level].bp_newreq.bpr_ptr, in nilfs_btree_prepare_insert()
1179 0, level, 0, ncblk, NULL, NULL); in nilfs_btree_prepare_insert()
1180 path[level].bp_sib_bh = bh; in nilfs_btree_prepare_insert()
1181 path[level].bp_op = nilfs_btree_grow; in nilfs_btree_prepare_insert()
1183 level++; in nilfs_btree_prepare_insert()
1184 path[level].bp_op = nilfs_btree_do_insert; in nilfs_btree_prepare_insert()
1191 *levelp = level; in nilfs_btree_prepare_insert()
1196 nilfs_bmap_abort_alloc_ptr(btree, &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1198 for (level--; level > NILFS_BTREE_LEVEL_DATA; level--) { in nilfs_btree_prepare_insert()
1199 nilfs_btnode_delete(path[level].bp_sib_bh); in nilfs_btree_prepare_insert()
1200 nilfs_bmap_abort_alloc_ptr(btree, &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1204 nilfs_bmap_abort_alloc_ptr(btree, &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1206 *levelp = level; in nilfs_btree_prepare_insert()
1216 int level; in nilfs_btree_commit_insert() local
1225 for (level = NILFS_BTREE_LEVEL_NODE_MIN; level <= maxlevel; level++) { in nilfs_btree_commit_insert()
1227 &path[level - 1].bp_newreq, dat); in nilfs_btree_commit_insert()
1228 path[level].bp_op(btree, path, level, &key, &ptr); in nilfs_btree_commit_insert()
1239 int level, ret; in nilfs_btree_insert() local
1253 ret = nilfs_btree_prepare_insert(btree, path, &level, key, ptr, &stats); in nilfs_btree_insert()
1256 nilfs_btree_commit_insert(btree, path, level, key, ptr); in nilfs_btree_insert()
1266 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_do_delete() argument
1271 if (level < nilfs_btree_height(btree) - 1) { in nilfs_btree_do_delete()
1272 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_do_delete()
1274 nilfs_btree_node_delete(node, path[level].bp_index, in nilfs_btree_do_delete()
1276 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_do_delete()
1277 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_do_delete()
1278 if (path[level].bp_index == 0) in nilfs_btree_do_delete()
1279 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_do_delete()
1283 nilfs_btree_node_delete(node, path[level].bp_index, in nilfs_btree_do_delete()
1291 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_borrow_left() argument
1296 nilfs_btree_do_delete(btree, path, level, keyp, ptrp); in nilfs_btree_borrow_left()
1298 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_borrow_left()
1299 left = nilfs_btree_get_sib_node(path, level); in nilfs_btree_borrow_left()
1308 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_borrow_left()
1309 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_borrow_left()
1310 if (!buffer_dirty(path[level].bp_sib_bh)) in nilfs_btree_borrow_left()
1311 mark_buffer_dirty(path[level].bp_sib_bh); in nilfs_btree_borrow_left()
1313 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_borrow_left()
1316 brelse(path[level].bp_sib_bh); in nilfs_btree_borrow_left()
1317 path[level].bp_sib_bh = NULL; in nilfs_btree_borrow_left()
1318 path[level].bp_index += n; in nilfs_btree_borrow_left()
1323 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_borrow_right() argument
1328 nilfs_btree_do_delete(btree, path, level, keyp, ptrp); in nilfs_btree_borrow_right()
1330 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_borrow_right()
1331 right = nilfs_btree_get_sib_node(path, level); in nilfs_btree_borrow_right()
1340 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_borrow_right()
1341 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_borrow_right()
1342 if (!buffer_dirty(path[level].bp_sib_bh)) in nilfs_btree_borrow_right()
1343 mark_buffer_dirty(path[level].bp_sib_bh); in nilfs_btree_borrow_right()
1345 path[level + 1].bp_index++; in nilfs_btree_borrow_right()
1346 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_borrow_right()
1348 path[level + 1].bp_index--; in nilfs_btree_borrow_right()
1350 brelse(path[level].bp_sib_bh); in nilfs_btree_borrow_right()
1351 path[level].bp_sib_bh = NULL; in nilfs_btree_borrow_right()
1356 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_concat_left() argument
1361 nilfs_btree_do_delete(btree, path, level, keyp, ptrp); in nilfs_btree_concat_left()
1363 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_concat_left()
1364 left = nilfs_btree_get_sib_node(path, level); in nilfs_btree_concat_left()
1371 if (!buffer_dirty(path[level].bp_sib_bh)) in nilfs_btree_concat_left()
1372 mark_buffer_dirty(path[level].bp_sib_bh); in nilfs_btree_concat_left()
1374 nilfs_btnode_delete(path[level].bp_bh); in nilfs_btree_concat_left()
1375 path[level].bp_bh = path[level].bp_sib_bh; in nilfs_btree_concat_left()
1376 path[level].bp_sib_bh = NULL; in nilfs_btree_concat_left()
1377 path[level].bp_index += nilfs_btree_node_get_nchildren(left); in nilfs_btree_concat_left()
1382 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_concat_right() argument
1387 nilfs_btree_do_delete(btree, path, level, keyp, ptrp); in nilfs_btree_concat_right()
1389 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_concat_right()
1390 right = nilfs_btree_get_sib_node(path, level); in nilfs_btree_concat_right()
1397 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_concat_right()
1398 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_concat_right()
1400 nilfs_btnode_delete(path[level].bp_sib_bh); in nilfs_btree_concat_right()
1401 path[level].bp_sib_bh = NULL; in nilfs_btree_concat_right()
1402 path[level + 1].bp_index++; in nilfs_btree_concat_right()
1407 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_shrink() argument
1412 nilfs_btree_do_delete(btree, path, level, keyp, ptrp); in nilfs_btree_shrink()
1415 child = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_shrink()
1420 nilfs_btree_node_set_level(root, level); in nilfs_btree_shrink()
1425 nilfs_btnode_delete(path[level].bp_bh); in nilfs_btree_shrink()
1426 path[level].bp_bh = NULL; in nilfs_btree_shrink()
1431 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_nop() argument
1444 int pindex, dindex, level, ncmin, ncmax, ncblk, ret; in nilfs_btree_prepare_delete() local
1451 for (level = NILFS_BTREE_LEVEL_NODE_MIN, dindex = path[level].bp_index; in nilfs_btree_prepare_delete()
1452 level < nilfs_btree_height(btree) - 1; in nilfs_btree_prepare_delete()
1453 level++) { in nilfs_btree_prepare_delete()
1454 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_prepare_delete()
1455 path[level].bp_oldreq.bpr_ptr = in nilfs_btree_prepare_delete()
1458 &path[level].bp_oldreq, dat); in nilfs_btree_prepare_delete()
1463 path[level].bp_op = nilfs_btree_do_delete; in nilfs_btree_prepare_delete()
1468 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_prepare_delete()
1469 pindex = path[level + 1].bp_index; in nilfs_btree_prepare_delete()
1481 path[level].bp_sib_bh = bh; in nilfs_btree_prepare_delete()
1482 path[level].bp_op = nilfs_btree_borrow_left; in nilfs_btree_prepare_delete()
1486 path[level].bp_sib_bh = bh; in nilfs_btree_prepare_delete()
1487 path[level].bp_op = nilfs_btree_concat_left; in nilfs_btree_prepare_delete()
1501 path[level].bp_sib_bh = bh; in nilfs_btree_prepare_delete()
1502 path[level].bp_op = nilfs_btree_borrow_right; in nilfs_btree_prepare_delete()
1506 path[level].bp_sib_bh = bh; in nilfs_btree_prepare_delete()
1507 path[level].bp_op = nilfs_btree_concat_right; in nilfs_btree_prepare_delete()
1522 WARN_ON(level != nilfs_btree_height(btree) - 2); in nilfs_btree_prepare_delete()
1525 path[level].bp_op = nilfs_btree_shrink; in nilfs_btree_prepare_delete()
1527 level++; in nilfs_btree_prepare_delete()
1528 path[level].bp_op = nilfs_btree_nop; in nilfs_btree_prepare_delete()
1531 path[level].bp_op = nilfs_btree_do_delete; in nilfs_btree_prepare_delete()
1539 path[level].bp_op = nilfs_btree_do_delete; in nilfs_btree_prepare_delete()
1544 path[level].bp_oldreq.bpr_ptr = in nilfs_btree_prepare_delete()
1548 ret = nilfs_bmap_prepare_end_ptr(btree, &path[level].bp_oldreq, dat); in nilfs_btree_prepare_delete()
1554 *levelp = level; in nilfs_btree_prepare_delete()
1559 nilfs_bmap_abort_end_ptr(btree, &path[level].bp_oldreq, dat); in nilfs_btree_prepare_delete()
1561 for (level--; level >= NILFS_BTREE_LEVEL_NODE_MIN; level--) { in nilfs_btree_prepare_delete()
1562 brelse(path[level].bp_sib_bh); in nilfs_btree_prepare_delete()
1563 nilfs_bmap_abort_end_ptr(btree, &path[level].bp_oldreq, dat); in nilfs_btree_prepare_delete()
1565 *levelp = level; in nilfs_btree_prepare_delete()
1574 int level; in nilfs_btree_commit_delete() local
1576 for (level = NILFS_BTREE_LEVEL_NODE_MIN; level <= maxlevel; level++) { in nilfs_btree_commit_delete()
1577 nilfs_bmap_commit_end_ptr(btree, &path[level].bp_oldreq, dat); in nilfs_btree_commit_delete()
1578 path[level].bp_op(btree, path, level, NULL, NULL); in nilfs_btree_commit_delete()
1591 int level, ret; in nilfs_btree_delete() local
1605 ret = nilfs_btree_prepare_delete(btree, path, &level, &stats, dat); in nilfs_btree_delete()
1608 nilfs_btree_commit_delete(btree, path, level, dat); in nilfs_btree_delete()
1827 /* create child node at level 1 */ in nilfs_btree_commit_convert_and_insert()
1839 /* create root node at level 2 */ in nilfs_btree_commit_convert_and_insert()
1848 /* create root node at level 1 */ in nilfs_btree_commit_convert_and_insert()
1915 int level, in nilfs_btree_propagate_p() argument
1918 while ((++level < nilfs_btree_height(btree) - 1) && in nilfs_btree_propagate_p()
1919 !buffer_dirty(path[level].bp_bh)) in nilfs_btree_propagate_p()
1920 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_propagate_p()
1927 int level, struct inode *dat) in nilfs_btree_prepare_update_v() argument
1932 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_prepare_update_v()
1933 path[level].bp_oldreq.bpr_ptr = in nilfs_btree_prepare_update_v()
1934 nilfs_btree_node_get_ptr(parent, path[level + 1].bp_index, in nilfs_btree_prepare_update_v()
1936 path[level].bp_newreq.bpr_ptr = path[level].bp_oldreq.bpr_ptr + 1; in nilfs_btree_prepare_update_v()
1937 ret = nilfs_dat_prepare_update(dat, &path[level].bp_oldreq.bpr_req, in nilfs_btree_prepare_update_v()
1938 &path[level].bp_newreq.bpr_req); in nilfs_btree_prepare_update_v()
1942 if (buffer_nilfs_node(path[level].bp_bh)) { in nilfs_btree_prepare_update_v()
1943 path[level].bp_ctxt.oldkey = path[level].bp_oldreq.bpr_ptr; in nilfs_btree_prepare_update_v()
1944 path[level].bp_ctxt.newkey = path[level].bp_newreq.bpr_ptr; in nilfs_btree_prepare_update_v()
1945 path[level].bp_ctxt.bh = path[level].bp_bh; in nilfs_btree_prepare_update_v()
1948 &path[level].bp_ctxt); in nilfs_btree_prepare_update_v()
1951 &path[level].bp_oldreq.bpr_req, in nilfs_btree_prepare_update_v()
1952 &path[level].bp_newreq.bpr_req); in nilfs_btree_prepare_update_v()
1962 int level, struct inode *dat) in nilfs_btree_commit_update_v() argument
1967 nilfs_dat_commit_update(dat, &path[level].bp_oldreq.bpr_req, in nilfs_btree_commit_update_v()
1968 &path[level].bp_newreq.bpr_req, in nilfs_btree_commit_update_v()
1971 if (buffer_nilfs_node(path[level].bp_bh)) { in nilfs_btree_commit_update_v()
1974 &path[level].bp_ctxt); in nilfs_btree_commit_update_v()
1975 path[level].bp_bh = path[level].bp_ctxt.bh; in nilfs_btree_commit_update_v()
1977 set_buffer_nilfs_volatile(path[level].bp_bh); in nilfs_btree_commit_update_v()
1979 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_commit_update_v()
1980 nilfs_btree_node_set_ptr(parent, path[level + 1].bp_index, in nilfs_btree_commit_update_v()
1981 path[level].bp_newreq.bpr_ptr, ncmax); in nilfs_btree_commit_update_v()
1986 int level, struct inode *dat) in nilfs_btree_abort_update_v() argument
1988 nilfs_dat_abort_update(dat, &path[level].bp_oldreq.bpr_req, in nilfs_btree_abort_update_v()
1989 &path[level].bp_newreq.bpr_req); in nilfs_btree_abort_update_v()
1990 if (buffer_nilfs_node(path[level].bp_bh)) in nilfs_btree_abort_update_v()
1993 &path[level].bp_ctxt); in nilfs_btree_abort_update_v()
2001 int level, ret; in nilfs_btree_prepare_propagate_v() local
2003 level = minlevel; in nilfs_btree_prepare_propagate_v()
2004 if (!buffer_nilfs_volatile(path[level].bp_bh)) { in nilfs_btree_prepare_propagate_v()
2005 ret = nilfs_btree_prepare_update_v(btree, path, level, dat); in nilfs_btree_prepare_propagate_v()
2009 while ((++level < nilfs_btree_height(btree) - 1) && in nilfs_btree_prepare_propagate_v()
2010 !buffer_dirty(path[level].bp_bh)) { in nilfs_btree_prepare_propagate_v()
2012 WARN_ON(buffer_nilfs_volatile(path[level].bp_bh)); in nilfs_btree_prepare_propagate_v()
2013 ret = nilfs_btree_prepare_update_v(btree, path, level, dat); in nilfs_btree_prepare_propagate_v()
2019 *maxlevelp = level - 1; in nilfs_btree_prepare_propagate_v()
2024 while (--level > minlevel) in nilfs_btree_prepare_propagate_v()
2025 nilfs_btree_abort_update_v(btree, path, level, dat); in nilfs_btree_prepare_propagate_v()
2026 if (!buffer_nilfs_volatile(path[level].bp_bh)) in nilfs_btree_prepare_propagate_v()
2027 nilfs_btree_abort_update_v(btree, path, level, dat); in nilfs_btree_prepare_propagate_v()
2037 int level; in nilfs_btree_commit_propagate_v() local
2042 for (level = minlevel + 1; level <= maxlevel; level++) in nilfs_btree_commit_propagate_v()
2043 nilfs_btree_commit_update_v(btree, path, level, dat); in nilfs_btree_commit_propagate_v()
2048 int level, struct buffer_head *bh) in nilfs_btree_propagate_v() argument
2057 path[level].bp_bh = bh; in nilfs_btree_propagate_v()
2058 ret = nilfs_btree_prepare_propagate_v(btree, path, level, &maxlevel, in nilfs_btree_propagate_v()
2063 if (buffer_nilfs_volatile(path[level].bp_bh)) { in nilfs_btree_propagate_v()
2064 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_propagate_v()
2066 path[level + 1].bp_index, in nilfs_btree_propagate_v()
2073 nilfs_btree_commit_propagate_v(btree, path, level, maxlevel, bh, dat); in nilfs_btree_propagate_v()
2076 brelse(path[level].bp_bh); in nilfs_btree_propagate_v()
2077 path[level].bp_bh = NULL; in nilfs_btree_propagate_v()
2087 int level, ret; in nilfs_btree_propagate() local
2098 level = nilfs_btree_node_get_level(node); in nilfs_btree_propagate()
2101 level = NILFS_BTREE_LEVEL_DATA; in nilfs_btree_propagate()
2104 ret = nilfs_btree_do_lookup(btree, path, key, NULL, level + 1, 0); in nilfs_btree_propagate()
2108 "writing node/leaf block does not appear in b-tree (ino=%lu) at key=%llu, level=%d", in nilfs_btree_propagate()
2110 (unsigned long long)key, level); in nilfs_btree_propagate()
2115 nilfs_btree_propagate_v(btree, path, level, bh) : in nilfs_btree_propagate()
2116 nilfs_btree_propagate_p(btree, path, level, bh); in nilfs_btree_propagate()
2138 int level; in nilfs_btree_add_dirty_buffer() local
2143 level = nilfs_btree_node_get_level(node); in nilfs_btree_add_dirty_buffer()
2144 if (level < NILFS_BTREE_LEVEL_NODE_MIN || in nilfs_btree_add_dirty_buffer()
2145 level >= NILFS_BTREE_LEVEL_MAX) { in nilfs_btree_add_dirty_buffer()
2148 "invalid btree level: %d (key=%llu, ino=%lu, blocknr=%llu)", in nilfs_btree_add_dirty_buffer()
2149 level, (unsigned long long)key, in nilfs_btree_add_dirty_buffer()
2155 list_for_each(head, &lists[level]) { in nilfs_btree_add_dirty_buffer()
2174 int level, i; in nilfs_btree_lookup_dirty_buffers() local
2176 for (level = NILFS_BTREE_LEVEL_NODE_MIN; in nilfs_btree_lookup_dirty_buffers()
2177 level < NILFS_BTREE_LEVEL_MAX; in nilfs_btree_lookup_dirty_buffers()
2178 level++) in nilfs_btree_lookup_dirty_buffers()
2179 INIT_LIST_HEAD(&lists[level]); in nilfs_btree_lookup_dirty_buffers()
2197 for (level = NILFS_BTREE_LEVEL_NODE_MIN; in nilfs_btree_lookup_dirty_buffers()
2198 level < NILFS_BTREE_LEVEL_MAX; in nilfs_btree_lookup_dirty_buffers()
2199 level++) in nilfs_btree_lookup_dirty_buffers()
2200 list_splice_tail(&lists[level], listp); in nilfs_btree_lookup_dirty_buffers()
2205 int level, in nilfs_btree_assign_p() argument
2215 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_assign_p()
2216 ptr = nilfs_btree_node_get_ptr(parent, path[level + 1].bp_index, in nilfs_btree_assign_p()
2219 path[level].bp_ctxt.oldkey = ptr; in nilfs_btree_assign_p()
2220 path[level].bp_ctxt.newkey = blocknr; in nilfs_btree_assign_p()
2221 path[level].bp_ctxt.bh = *bh; in nilfs_btree_assign_p()
2224 &path[level].bp_ctxt); in nilfs_btree_assign_p()
2229 &path[level].bp_ctxt); in nilfs_btree_assign_p()
2230 *bh = path[level].bp_ctxt.bh; in nilfs_btree_assign_p()
2233 nilfs_btree_node_set_ptr(parent, path[level + 1].bp_index, blocknr, in nilfs_btree_assign_p()
2236 key = nilfs_btree_node_get_key(parent, path[level + 1].bp_index); in nilfs_btree_assign_p()
2239 binfo->bi_dat.bi_level = level; in nilfs_btree_assign_p()
2247 int level, in nilfs_btree_assign_v() argument
2259 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_assign_v()
2260 ptr = nilfs_btree_node_get_ptr(parent, path[level + 1].bp_index, in nilfs_btree_assign_v()
2268 key = nilfs_btree_node_get_key(parent, path[level + 1].bp_index); in nilfs_btree_assign_v()
2284 int level, ret; in nilfs_btree_assign() local
2293 level = nilfs_btree_node_get_level(node); in nilfs_btree_assign()
2296 level = NILFS_BTREE_LEVEL_DATA; in nilfs_btree_assign()
2299 ret = nilfs_btree_do_lookup(btree, path, key, NULL, level + 1, 0); in nilfs_btree_assign()
2306 nilfs_btree_assign_v(btree, path, level, bh, blocknr, binfo) : in nilfs_btree_assign()
2307 nilfs_btree_assign_p(btree, path, level, bh, blocknr, binfo); in nilfs_btree_assign()
2342 static int nilfs_btree_mark(struct nilfs_bmap *btree, __u64 key, int level) in nilfs_btree_mark() argument
2353 ret = nilfs_btree_do_lookup(btree, path, key, &ptr, level + 1, 0); in nilfs_btree_mark()