• Home
  • Raw
  • Download

Lines Matching refs:level

37 	int level = NILFS_BTREE_LEVEL_DATA;  in nilfs_btree_alloc_path()  local
43 for (; level < NILFS_BTREE_LEVEL_MAX; level++) { in nilfs_btree_alloc_path()
44 path[level].bp_bh = NULL; in nilfs_btree_alloc_path()
45 path[level].bp_sib_bh = NULL; in nilfs_btree_alloc_path()
46 path[level].bp_index = 0; in nilfs_btree_alloc_path()
47 path[level].bp_oldreq.bpr_ptr = NILFS_BMAP_INVALID_PTR; in nilfs_btree_alloc_path()
48 path[level].bp_newreq.bpr_ptr = NILFS_BMAP_INVALID_PTR; in nilfs_btree_alloc_path()
49 path[level].bp_op = NULL; in nilfs_btree_alloc_path()
58 int level = NILFS_BTREE_LEVEL_DATA; in nilfs_btree_free_path() local
60 for (; level < NILFS_BTREE_LEVEL_MAX; level++) in nilfs_btree_free_path()
61 brelse(path[level].bp_bh); in nilfs_btree_free_path()
106 nilfs_btree_node_set_level(struct nilfs_btree_node *node, int level) in nilfs_btree_node_set_level() argument
108 node->bn_level = level; in nilfs_btree_node_set_level()
173 int level, int nchildren, int ncmax, in nilfs_btree_node_init() argument
181 nilfs_btree_node_set_level(node, level); in nilfs_btree_node_init()
351 int level, flags, nchildren; in nilfs_btree_node_broken() local
354 level = nilfs_btree_node_get_level(node); in nilfs_btree_node_broken()
358 if (unlikely(level < NILFS_BTREE_LEVEL_NODE_MIN || in nilfs_btree_node_broken()
359 level >= NILFS_BTREE_LEVEL_MAX || in nilfs_btree_node_broken()
365 (unsigned long long)blocknr, level, flags, nchildren); in nilfs_btree_node_broken()
392 nilfs_btree_get_nonroot_node(const struct nilfs_btree_path *path, int level) in nilfs_btree_get_nonroot_node() argument
394 return (struct nilfs_btree_node *)path[level].bp_bh->b_data; in nilfs_btree_get_nonroot_node()
398 nilfs_btree_get_sib_node(const struct nilfs_btree_path *path, int level) in nilfs_btree_get_sib_node() argument
400 return (struct nilfs_btree_node *)path[level].bp_sib_bh->b_data; in nilfs_btree_get_sib_node()
411 int level, int *ncmaxp) in nilfs_btree_get_node() argument
415 if (level == nilfs_btree_height(btree) - 1) { in nilfs_btree_get_node()
419 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_get_node()
426 nilfs_btree_bad_node(struct nilfs_btree_node *node, int level) in nilfs_btree_bad_node() argument
428 if (unlikely(nilfs_btree_node_get_level(node) != level)) { in nilfs_btree_bad_node()
431 nilfs_btree_node_get_level(node), level); in nilfs_btree_bad_node()
513 int level, index, found, ncmax, ret; in nilfs_btree_do_lookup() local
516 level = nilfs_btree_node_get_level(node); in nilfs_btree_do_lookup()
517 if (level < minlevel || nilfs_btree_node_get_nchildren(node) <= 0) in nilfs_btree_do_lookup()
523 path[level].bp_bh = NULL; in nilfs_btree_do_lookup()
524 path[level].bp_index = index; in nilfs_btree_do_lookup()
528 while (--level >= minlevel) { in nilfs_btree_do_lookup()
530 if (level == NILFS_BTREE_LEVEL_NODE_MIN && readahead) { in nilfs_btree_do_lookup()
531 p.node = nilfs_btree_get_node(btree, path, level + 1, in nilfs_btree_do_lookup()
537 ret = __nilfs_btree_get_block(btree, ptr, &path[level].bp_bh, in nilfs_btree_do_lookup()
542 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_do_lookup()
543 if (nilfs_btree_bad_node(node, level)) in nilfs_btree_do_lookup()
552 WARN_ON(found || level != NILFS_BTREE_LEVEL_NODE_MIN); in nilfs_btree_do_lookup()
556 path[level].bp_index = index; in nilfs_btree_do_lookup()
573 int index, level, ncmax, ret; in nilfs_btree_do_lookup_last() local
579 level = nilfs_btree_node_get_level(node); in nilfs_btree_do_lookup_last()
582 path[level].bp_bh = NULL; in nilfs_btree_do_lookup_last()
583 path[level].bp_index = index; in nilfs_btree_do_lookup_last()
586 for (level--; level > 0; level--) { in nilfs_btree_do_lookup_last()
587 ret = nilfs_btree_get_block(btree, ptr, &path[level].bp_bh); in nilfs_btree_do_lookup_last()
590 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_do_lookup_last()
591 if (nilfs_btree_bad_node(node, level)) in nilfs_btree_do_lookup_last()
595 path[level].bp_index = index; in nilfs_btree_do_lookup_last()
607 __u64 key, int level, __u64 *ptrp) in nilfs_btree_lookup() argument
616 ret = nilfs_btree_do_lookup(btree, path, key, ptrp, level, 0); in nilfs_btree_lookup()
631 int level = NILFS_BTREE_LEVEL_NODE_MIN; in nilfs_btree_lookup_contig() local
639 ret = nilfs_btree_do_lookup(btree, path, key, &ptr, level, 1); in nilfs_btree_lookup_contig()
655 node = nilfs_btree_get_node(btree, path, level, &ncmax); in nilfs_btree_lookup_contig()
656 index = path[level].bp_index + 1; in nilfs_btree_lookup_contig()
674 if (level == maxlevel) in nilfs_btree_lookup_contig()
678 p.node = nilfs_btree_get_node(btree, path, level + 1, &p.ncmax); in nilfs_btree_lookup_contig()
679 p.index = path[level + 1].bp_index + 1; in nilfs_btree_lookup_contig()
685 path[level + 1].bp_index = p.index; in nilfs_btree_lookup_contig()
687 brelse(path[level].bp_bh); in nilfs_btree_lookup_contig()
688 path[level].bp_bh = NULL; in nilfs_btree_lookup_contig()
690 ret = __nilfs_btree_get_block(btree, ptr2, &path[level].bp_bh, in nilfs_btree_lookup_contig()
694 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_lookup_contig()
697 path[level].bp_index = index; in nilfs_btree_lookup_contig()
709 int level, __u64 key) in nilfs_btree_promote_key() argument
711 if (level < nilfs_btree_height(btree) - 1) { in nilfs_btree_promote_key()
714 nilfs_btree_get_nonroot_node(path, level), in nilfs_btree_promote_key()
715 path[level].bp_index, key); in nilfs_btree_promote_key()
716 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_promote_key()
717 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_promote_key()
718 } while ((path[level].bp_index == 0) && in nilfs_btree_promote_key()
719 (++level < nilfs_btree_height(btree) - 1)); in nilfs_btree_promote_key()
723 if (level == nilfs_btree_height(btree) - 1) { in nilfs_btree_promote_key()
725 path[level].bp_index, key); in nilfs_btree_promote_key()
731 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_do_insert() argument
736 if (level < nilfs_btree_height(btree) - 1) { in nilfs_btree_do_insert()
737 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_do_insert()
739 nilfs_btree_node_insert(node, path[level].bp_index, in nilfs_btree_do_insert()
741 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_do_insert()
742 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_do_insert()
744 if (path[level].bp_index == 0) in nilfs_btree_do_insert()
745 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_do_insert()
750 nilfs_btree_node_insert(node, path[level].bp_index, in nilfs_btree_do_insert()
758 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_carry_left() argument
763 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_carry_left()
764 left = nilfs_btree_get_sib_node(path, level); in nilfs_btree_carry_left()
771 if (n > path[level].bp_index) { in nilfs_btree_carry_left()
779 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_carry_left()
780 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_carry_left()
781 if (!buffer_dirty(path[level].bp_sib_bh)) in nilfs_btree_carry_left()
782 mark_buffer_dirty(path[level].bp_sib_bh); in nilfs_btree_carry_left()
784 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_carry_left()
788 brelse(path[level].bp_bh); in nilfs_btree_carry_left()
789 path[level].bp_bh = path[level].bp_sib_bh; in nilfs_btree_carry_left()
790 path[level].bp_sib_bh = NULL; in nilfs_btree_carry_left()
791 path[level].bp_index += lnchildren; in nilfs_btree_carry_left()
792 path[level + 1].bp_index--; in nilfs_btree_carry_left()
794 brelse(path[level].bp_sib_bh); in nilfs_btree_carry_left()
795 path[level].bp_sib_bh = NULL; in nilfs_btree_carry_left()
796 path[level].bp_index -= n; in nilfs_btree_carry_left()
799 nilfs_btree_do_insert(btree, path, level, keyp, ptrp); in nilfs_btree_carry_left()
804 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_carry_right() argument
809 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_carry_right()
810 right = nilfs_btree_get_sib_node(path, level); in nilfs_btree_carry_right()
817 if (n > nchildren - path[level].bp_index) { in nilfs_btree_carry_right()
825 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_carry_right()
826 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_carry_right()
827 if (!buffer_dirty(path[level].bp_sib_bh)) in nilfs_btree_carry_right()
828 mark_buffer_dirty(path[level].bp_sib_bh); in nilfs_btree_carry_right()
830 path[level + 1].bp_index++; in nilfs_btree_carry_right()
831 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_carry_right()
833 path[level + 1].bp_index--; in nilfs_btree_carry_right()
836 brelse(path[level].bp_bh); in nilfs_btree_carry_right()
837 path[level].bp_bh = path[level].bp_sib_bh; in nilfs_btree_carry_right()
838 path[level].bp_sib_bh = NULL; in nilfs_btree_carry_right()
839 path[level].bp_index -= nilfs_btree_node_get_nchildren(node); in nilfs_btree_carry_right()
840 path[level + 1].bp_index++; in nilfs_btree_carry_right()
842 brelse(path[level].bp_sib_bh); in nilfs_btree_carry_right()
843 path[level].bp_sib_bh = NULL; in nilfs_btree_carry_right()
846 nilfs_btree_do_insert(btree, path, level, keyp, ptrp); in nilfs_btree_carry_right()
851 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_split() argument
858 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_split()
859 right = nilfs_btree_get_sib_node(path, level); in nilfs_btree_split()
865 if (n > nchildren - path[level].bp_index) { in nilfs_btree_split()
872 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_split()
873 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_split()
874 if (!buffer_dirty(path[level].bp_sib_bh)) in nilfs_btree_split()
875 mark_buffer_dirty(path[level].bp_sib_bh); in nilfs_btree_split()
878 newptr = path[level].bp_newreq.bpr_ptr; in nilfs_btree_split()
881 path[level].bp_index -= nilfs_btree_node_get_nchildren(node); in nilfs_btree_split()
882 nilfs_btree_node_insert(right, path[level].bp_index, in nilfs_btree_split()
886 *ptrp = path[level].bp_newreq.bpr_ptr; in nilfs_btree_split()
888 brelse(path[level].bp_bh); in nilfs_btree_split()
889 path[level].bp_bh = path[level].bp_sib_bh; in nilfs_btree_split()
890 path[level].bp_sib_bh = NULL; in nilfs_btree_split()
892 nilfs_btree_do_insert(btree, path, level, keyp, ptrp); in nilfs_btree_split()
895 *ptrp = path[level].bp_newreq.bpr_ptr; in nilfs_btree_split()
897 brelse(path[level].bp_sib_bh); in nilfs_btree_split()
898 path[level].bp_sib_bh = NULL; in nilfs_btree_split()
901 path[level + 1].bp_index++; in nilfs_btree_split()
906 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_grow() argument
912 child = nilfs_btree_get_sib_node(path, level); in nilfs_btree_grow()
919 nilfs_btree_node_set_level(root, level + 1); in nilfs_btree_grow()
921 if (!buffer_dirty(path[level].bp_sib_bh)) in nilfs_btree_grow()
922 mark_buffer_dirty(path[level].bp_sib_bh); in nilfs_btree_grow()
924 path[level].bp_bh = path[level].bp_sib_bh; in nilfs_btree_grow()
925 path[level].bp_sib_bh = NULL; in nilfs_btree_grow()
927 nilfs_btree_do_insert(btree, path, level, keyp, ptrp); in nilfs_btree_grow()
930 *ptrp = path[level].bp_newreq.bpr_ptr; in nilfs_btree_grow()
937 int level, ncmax; in nilfs_btree_find_near() local
943 level = NILFS_BTREE_LEVEL_NODE_MIN; in nilfs_btree_find_near()
944 if (path[level].bp_index > 0) { in nilfs_btree_find_near()
945 node = nilfs_btree_get_node(btree, path, level, &ncmax); in nilfs_btree_find_near()
947 path[level].bp_index - 1, in nilfs_btree_find_near()
952 level = NILFS_BTREE_LEVEL_NODE_MIN + 1; in nilfs_btree_find_near()
953 if (level <= nilfs_btree_height(btree) - 1) { in nilfs_btree_find_near()
954 node = nilfs_btree_get_node(btree, path, level, &ncmax); in nilfs_btree_find_near()
955 return nilfs_btree_node_get_ptr(node, path[level].bp_index, in nilfs_btree_find_near()
990 int pindex, level, ncmax, ncblk, ret; in nilfs_btree_prepare_insert() local
994 level = NILFS_BTREE_LEVEL_DATA; in nilfs_btree_prepare_insert()
998 path[level].bp_newreq.bpr_ptr = in nilfs_btree_prepare_insert()
1003 ret = nilfs_bmap_prepare_alloc_ptr(btree, &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1009 for (level = NILFS_BTREE_LEVEL_NODE_MIN; in nilfs_btree_prepare_insert()
1010 level < nilfs_btree_height(btree) - 1; in nilfs_btree_prepare_insert()
1011 level++) { in nilfs_btree_prepare_insert()
1012 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_prepare_insert()
1014 path[level].bp_op = nilfs_btree_do_insert; in nilfs_btree_prepare_insert()
1019 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_prepare_insert()
1020 pindex = path[level + 1].bp_index; in nilfs_btree_prepare_insert()
1031 path[level].bp_sib_bh = bh; in nilfs_btree_prepare_insert()
1032 path[level].bp_op = nilfs_btree_carry_left; in nilfs_btree_prepare_insert()
1049 path[level].bp_sib_bh = bh; in nilfs_btree_prepare_insert()
1050 path[level].bp_op = nilfs_btree_carry_right; in nilfs_btree_prepare_insert()
1059 path[level].bp_newreq.bpr_ptr = in nilfs_btree_prepare_insert()
1060 path[level - 1].bp_newreq.bpr_ptr + 1; in nilfs_btree_prepare_insert()
1062 &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1066 path[level].bp_newreq.bpr_ptr, in nilfs_btree_prepare_insert()
1074 nilfs_btree_node_init(sib, 0, level, 0, ncblk, NULL, NULL); in nilfs_btree_prepare_insert()
1075 path[level].bp_sib_bh = bh; in nilfs_btree_prepare_insert()
1076 path[level].bp_op = nilfs_btree_split; in nilfs_btree_prepare_insert()
1083 path[level].bp_op = nilfs_btree_do_insert; in nilfs_btree_prepare_insert()
1089 path[level].bp_newreq.bpr_ptr = path[level - 1].bp_newreq.bpr_ptr + 1; in nilfs_btree_prepare_insert()
1090 ret = nilfs_bmap_prepare_alloc_ptr(btree, &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1093 ret = nilfs_btree_get_new_block(btree, path[level].bp_newreq.bpr_ptr, in nilfs_btree_prepare_insert()
1099 0, level, 0, ncblk, NULL, NULL); in nilfs_btree_prepare_insert()
1100 path[level].bp_sib_bh = bh; in nilfs_btree_prepare_insert()
1101 path[level].bp_op = nilfs_btree_grow; in nilfs_btree_prepare_insert()
1103 level++; in nilfs_btree_prepare_insert()
1104 path[level].bp_op = nilfs_btree_do_insert; in nilfs_btree_prepare_insert()
1111 *levelp = level; in nilfs_btree_prepare_insert()
1116 nilfs_bmap_abort_alloc_ptr(btree, &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1118 for (level--; level > NILFS_BTREE_LEVEL_DATA; level--) { in nilfs_btree_prepare_insert()
1119 nilfs_btnode_delete(path[level].bp_sib_bh); in nilfs_btree_prepare_insert()
1120 nilfs_bmap_abort_alloc_ptr(btree, &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1124 nilfs_bmap_abort_alloc_ptr(btree, &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1126 *levelp = level; in nilfs_btree_prepare_insert()
1136 int level; in nilfs_btree_commit_insert() local
1145 for (level = NILFS_BTREE_LEVEL_NODE_MIN; level <= maxlevel; level++) { in nilfs_btree_commit_insert()
1147 &path[level - 1].bp_newreq, dat); in nilfs_btree_commit_insert()
1148 path[level].bp_op(btree, path, level, &key, &ptr); in nilfs_btree_commit_insert()
1159 int level, ret; in nilfs_btree_insert() local
1173 ret = nilfs_btree_prepare_insert(btree, path, &level, key, ptr, &stats); in nilfs_btree_insert()
1176 nilfs_btree_commit_insert(btree, path, level, key, ptr); in nilfs_btree_insert()
1186 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_do_delete() argument
1191 if (level < nilfs_btree_height(btree) - 1) { in nilfs_btree_do_delete()
1192 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_do_delete()
1194 nilfs_btree_node_delete(node, path[level].bp_index, in nilfs_btree_do_delete()
1196 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_do_delete()
1197 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_do_delete()
1198 if (path[level].bp_index == 0) in nilfs_btree_do_delete()
1199 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_do_delete()
1203 nilfs_btree_node_delete(node, path[level].bp_index, in nilfs_btree_do_delete()
1211 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_borrow_left() argument
1216 nilfs_btree_do_delete(btree, path, level, keyp, ptrp); in nilfs_btree_borrow_left()
1218 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_borrow_left()
1219 left = nilfs_btree_get_sib_node(path, level); in nilfs_btree_borrow_left()
1228 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_borrow_left()
1229 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_borrow_left()
1230 if (!buffer_dirty(path[level].bp_sib_bh)) in nilfs_btree_borrow_left()
1231 mark_buffer_dirty(path[level].bp_sib_bh); in nilfs_btree_borrow_left()
1233 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_borrow_left()
1236 brelse(path[level].bp_sib_bh); in nilfs_btree_borrow_left()
1237 path[level].bp_sib_bh = NULL; in nilfs_btree_borrow_left()
1238 path[level].bp_index += n; in nilfs_btree_borrow_left()
1243 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_borrow_right() argument
1248 nilfs_btree_do_delete(btree, path, level, keyp, ptrp); in nilfs_btree_borrow_right()
1250 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_borrow_right()
1251 right = nilfs_btree_get_sib_node(path, level); in nilfs_btree_borrow_right()
1260 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_borrow_right()
1261 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_borrow_right()
1262 if (!buffer_dirty(path[level].bp_sib_bh)) in nilfs_btree_borrow_right()
1263 mark_buffer_dirty(path[level].bp_sib_bh); in nilfs_btree_borrow_right()
1265 path[level + 1].bp_index++; in nilfs_btree_borrow_right()
1266 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_borrow_right()
1268 path[level + 1].bp_index--; in nilfs_btree_borrow_right()
1270 brelse(path[level].bp_sib_bh); in nilfs_btree_borrow_right()
1271 path[level].bp_sib_bh = NULL; in nilfs_btree_borrow_right()
1276 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_concat_left() argument
1281 nilfs_btree_do_delete(btree, path, level, keyp, ptrp); in nilfs_btree_concat_left()
1283 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_concat_left()
1284 left = nilfs_btree_get_sib_node(path, level); in nilfs_btree_concat_left()
1291 if (!buffer_dirty(path[level].bp_sib_bh)) in nilfs_btree_concat_left()
1292 mark_buffer_dirty(path[level].bp_sib_bh); in nilfs_btree_concat_left()
1294 nilfs_btnode_delete(path[level].bp_bh); in nilfs_btree_concat_left()
1295 path[level].bp_bh = path[level].bp_sib_bh; in nilfs_btree_concat_left()
1296 path[level].bp_sib_bh = NULL; in nilfs_btree_concat_left()
1297 path[level].bp_index += nilfs_btree_node_get_nchildren(left); in nilfs_btree_concat_left()
1302 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_concat_right() argument
1307 nilfs_btree_do_delete(btree, path, level, keyp, ptrp); in nilfs_btree_concat_right()
1309 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_concat_right()
1310 right = nilfs_btree_get_sib_node(path, level); in nilfs_btree_concat_right()
1317 if (!buffer_dirty(path[level].bp_bh)) in nilfs_btree_concat_right()
1318 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_concat_right()
1320 nilfs_btnode_delete(path[level].bp_sib_bh); in nilfs_btree_concat_right()
1321 path[level].bp_sib_bh = NULL; in nilfs_btree_concat_right()
1322 path[level + 1].bp_index++; in nilfs_btree_concat_right()
1327 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_shrink() argument
1332 nilfs_btree_do_delete(btree, path, level, keyp, ptrp); in nilfs_btree_shrink()
1335 child = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_shrink()
1340 nilfs_btree_node_set_level(root, level); in nilfs_btree_shrink()
1345 nilfs_btnode_delete(path[level].bp_bh); in nilfs_btree_shrink()
1346 path[level].bp_bh = NULL; in nilfs_btree_shrink()
1351 int level, __u64 *keyp, __u64 *ptrp) in nilfs_btree_nop() argument
1364 int pindex, dindex, level, ncmin, ncmax, ncblk, ret; in nilfs_btree_prepare_delete() local
1371 for (level = NILFS_BTREE_LEVEL_NODE_MIN, dindex = path[level].bp_index; in nilfs_btree_prepare_delete()
1372 level < nilfs_btree_height(btree) - 1; in nilfs_btree_prepare_delete()
1373 level++) { in nilfs_btree_prepare_delete()
1374 node = nilfs_btree_get_nonroot_node(path, level); in nilfs_btree_prepare_delete()
1375 path[level].bp_oldreq.bpr_ptr = in nilfs_btree_prepare_delete()
1378 &path[level].bp_oldreq, dat); in nilfs_btree_prepare_delete()
1383 path[level].bp_op = nilfs_btree_do_delete; in nilfs_btree_prepare_delete()
1388 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_prepare_delete()
1389 pindex = path[level + 1].bp_index; in nilfs_btree_prepare_delete()
1401 path[level].bp_sib_bh = bh; in nilfs_btree_prepare_delete()
1402 path[level].bp_op = nilfs_btree_borrow_left; in nilfs_btree_prepare_delete()
1406 path[level].bp_sib_bh = bh; in nilfs_btree_prepare_delete()
1407 path[level].bp_op = nilfs_btree_concat_left; in nilfs_btree_prepare_delete()
1421 path[level].bp_sib_bh = bh; in nilfs_btree_prepare_delete()
1422 path[level].bp_op = nilfs_btree_borrow_right; in nilfs_btree_prepare_delete()
1426 path[level].bp_sib_bh = bh; in nilfs_btree_prepare_delete()
1427 path[level].bp_op = nilfs_btree_concat_right; in nilfs_btree_prepare_delete()
1442 WARN_ON(level != nilfs_btree_height(btree) - 2); in nilfs_btree_prepare_delete()
1445 path[level].bp_op = nilfs_btree_shrink; in nilfs_btree_prepare_delete()
1447 level++; in nilfs_btree_prepare_delete()
1448 path[level].bp_op = nilfs_btree_nop; in nilfs_btree_prepare_delete()
1451 path[level].bp_op = nilfs_btree_do_delete; in nilfs_btree_prepare_delete()
1459 path[level].bp_op = nilfs_btree_do_delete; in nilfs_btree_prepare_delete()
1464 path[level].bp_oldreq.bpr_ptr = in nilfs_btree_prepare_delete()
1468 ret = nilfs_bmap_prepare_end_ptr(btree, &path[level].bp_oldreq, dat); in nilfs_btree_prepare_delete()
1474 *levelp = level; in nilfs_btree_prepare_delete()
1479 nilfs_bmap_abort_end_ptr(btree, &path[level].bp_oldreq, dat); in nilfs_btree_prepare_delete()
1481 for (level--; level >= NILFS_BTREE_LEVEL_NODE_MIN; level--) { in nilfs_btree_prepare_delete()
1482 brelse(path[level].bp_sib_bh); in nilfs_btree_prepare_delete()
1483 nilfs_bmap_abort_end_ptr(btree, &path[level].bp_oldreq, dat); in nilfs_btree_prepare_delete()
1485 *levelp = level; in nilfs_btree_prepare_delete()
1494 int level; in nilfs_btree_commit_delete() local
1496 for (level = NILFS_BTREE_LEVEL_NODE_MIN; level <= maxlevel; level++) { in nilfs_btree_commit_delete()
1497 nilfs_bmap_commit_end_ptr(btree, &path[level].bp_oldreq, dat); in nilfs_btree_commit_delete()
1498 path[level].bp_op(btree, path, level, NULL, NULL); in nilfs_btree_commit_delete()
1511 int level, ret; in nilfs_btree_delete() local
1525 ret = nilfs_btree_prepare_delete(btree, path, &level, &stats, dat); in nilfs_btree_delete()
1528 nilfs_btree_commit_delete(btree, path, level, dat); in nilfs_btree_delete()
1800 int level, in nilfs_btree_propagate_p() argument
1803 while ((++level < nilfs_btree_height(btree) - 1) && in nilfs_btree_propagate_p()
1804 !buffer_dirty(path[level].bp_bh)) in nilfs_btree_propagate_p()
1805 mark_buffer_dirty(path[level].bp_bh); in nilfs_btree_propagate_p()
1812 int level, struct inode *dat) in nilfs_btree_prepare_update_v() argument
1817 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_prepare_update_v()
1818 path[level].bp_oldreq.bpr_ptr = in nilfs_btree_prepare_update_v()
1819 nilfs_btree_node_get_ptr(parent, path[level + 1].bp_index, in nilfs_btree_prepare_update_v()
1821 path[level].bp_newreq.bpr_ptr = path[level].bp_oldreq.bpr_ptr + 1; in nilfs_btree_prepare_update_v()
1822 ret = nilfs_dat_prepare_update(dat, &path[level].bp_oldreq.bpr_req, in nilfs_btree_prepare_update_v()
1823 &path[level].bp_newreq.bpr_req); in nilfs_btree_prepare_update_v()
1827 if (buffer_nilfs_node(path[level].bp_bh)) { in nilfs_btree_prepare_update_v()
1828 path[level].bp_ctxt.oldkey = path[level].bp_oldreq.bpr_ptr; in nilfs_btree_prepare_update_v()
1829 path[level].bp_ctxt.newkey = path[level].bp_newreq.bpr_ptr; in nilfs_btree_prepare_update_v()
1830 path[level].bp_ctxt.bh = path[level].bp_bh; in nilfs_btree_prepare_update_v()
1833 &path[level].bp_ctxt); in nilfs_btree_prepare_update_v()
1836 &path[level].bp_oldreq.bpr_req, in nilfs_btree_prepare_update_v()
1837 &path[level].bp_newreq.bpr_req); in nilfs_btree_prepare_update_v()
1847 int level, struct inode *dat) in nilfs_btree_commit_update_v() argument
1852 nilfs_dat_commit_update(dat, &path[level].bp_oldreq.bpr_req, in nilfs_btree_commit_update_v()
1853 &path[level].bp_newreq.bpr_req, in nilfs_btree_commit_update_v()
1856 if (buffer_nilfs_node(path[level].bp_bh)) { in nilfs_btree_commit_update_v()
1859 &path[level].bp_ctxt); in nilfs_btree_commit_update_v()
1860 path[level].bp_bh = path[level].bp_ctxt.bh; in nilfs_btree_commit_update_v()
1862 set_buffer_nilfs_volatile(path[level].bp_bh); in nilfs_btree_commit_update_v()
1864 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_commit_update_v()
1865 nilfs_btree_node_set_ptr(parent, path[level + 1].bp_index, in nilfs_btree_commit_update_v()
1866 path[level].bp_newreq.bpr_ptr, ncmax); in nilfs_btree_commit_update_v()
1871 int level, struct inode *dat) in nilfs_btree_abort_update_v() argument
1873 nilfs_dat_abort_update(dat, &path[level].bp_oldreq.bpr_req, in nilfs_btree_abort_update_v()
1874 &path[level].bp_newreq.bpr_req); in nilfs_btree_abort_update_v()
1875 if (buffer_nilfs_node(path[level].bp_bh)) in nilfs_btree_abort_update_v()
1878 &path[level].bp_ctxt); in nilfs_btree_abort_update_v()
1886 int level, ret; in nilfs_btree_prepare_propagate_v() local
1888 level = minlevel; in nilfs_btree_prepare_propagate_v()
1889 if (!buffer_nilfs_volatile(path[level].bp_bh)) { in nilfs_btree_prepare_propagate_v()
1890 ret = nilfs_btree_prepare_update_v(btree, path, level, dat); in nilfs_btree_prepare_propagate_v()
1894 while ((++level < nilfs_btree_height(btree) - 1) && in nilfs_btree_prepare_propagate_v()
1895 !buffer_dirty(path[level].bp_bh)) { in nilfs_btree_prepare_propagate_v()
1897 WARN_ON(buffer_nilfs_volatile(path[level].bp_bh)); in nilfs_btree_prepare_propagate_v()
1898 ret = nilfs_btree_prepare_update_v(btree, path, level, dat); in nilfs_btree_prepare_propagate_v()
1904 *maxlevelp = level - 1; in nilfs_btree_prepare_propagate_v()
1909 while (--level > minlevel) in nilfs_btree_prepare_propagate_v()
1910 nilfs_btree_abort_update_v(btree, path, level, dat); in nilfs_btree_prepare_propagate_v()
1911 if (!buffer_nilfs_volatile(path[level].bp_bh)) in nilfs_btree_prepare_propagate_v()
1912 nilfs_btree_abort_update_v(btree, path, level, dat); in nilfs_btree_prepare_propagate_v()
1922 int level; in nilfs_btree_commit_propagate_v() local
1927 for (level = minlevel + 1; level <= maxlevel; level++) in nilfs_btree_commit_propagate_v()
1928 nilfs_btree_commit_update_v(btree, path, level, dat); in nilfs_btree_commit_propagate_v()
1933 int level, struct buffer_head *bh) in nilfs_btree_propagate_v() argument
1942 path[level].bp_bh = bh; in nilfs_btree_propagate_v()
1943 ret = nilfs_btree_prepare_propagate_v(btree, path, level, &maxlevel, in nilfs_btree_propagate_v()
1948 if (buffer_nilfs_volatile(path[level].bp_bh)) { in nilfs_btree_propagate_v()
1949 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_propagate_v()
1951 path[level + 1].bp_index, in nilfs_btree_propagate_v()
1958 nilfs_btree_commit_propagate_v(btree, path, level, maxlevel, bh, dat); in nilfs_btree_propagate_v()
1961 brelse(path[level].bp_bh); in nilfs_btree_propagate_v()
1962 path[level].bp_bh = NULL; in nilfs_btree_propagate_v()
1972 int level, ret; in nilfs_btree_propagate() local
1983 level = nilfs_btree_node_get_level(node); in nilfs_btree_propagate()
1986 level = NILFS_BTREE_LEVEL_DATA; in nilfs_btree_propagate()
1989 ret = nilfs_btree_do_lookup(btree, path, key, NULL, level + 1, 0); in nilfs_btree_propagate()
1993 __func__, (unsigned long long)key, level); in nilfs_btree_propagate()
1998 nilfs_btree_propagate_v(btree, path, level, bh) : in nilfs_btree_propagate()
1999 nilfs_btree_propagate_p(btree, path, level, bh); in nilfs_btree_propagate()
2021 int level; in nilfs_btree_add_dirty_buffer() local
2026 level = nilfs_btree_node_get_level(node); in nilfs_btree_add_dirty_buffer()
2027 if (level < NILFS_BTREE_LEVEL_NODE_MIN || in nilfs_btree_add_dirty_buffer()
2028 level >= NILFS_BTREE_LEVEL_MAX) { in nilfs_btree_add_dirty_buffer()
2033 __func__, level, (unsigned long long)key, in nilfs_btree_add_dirty_buffer()
2039 list_for_each(head, &lists[level]) { in nilfs_btree_add_dirty_buffer()
2057 int level, i; in nilfs_btree_lookup_dirty_buffers() local
2059 for (level = NILFS_BTREE_LEVEL_NODE_MIN; in nilfs_btree_lookup_dirty_buffers()
2060 level < NILFS_BTREE_LEVEL_MAX; in nilfs_btree_lookup_dirty_buffers()
2061 level++) in nilfs_btree_lookup_dirty_buffers()
2062 INIT_LIST_HEAD(&lists[level]); in nilfs_btree_lookup_dirty_buffers()
2080 for (level = NILFS_BTREE_LEVEL_NODE_MIN; in nilfs_btree_lookup_dirty_buffers()
2081 level < NILFS_BTREE_LEVEL_MAX; in nilfs_btree_lookup_dirty_buffers()
2082 level++) in nilfs_btree_lookup_dirty_buffers()
2083 list_splice_tail(&lists[level], listp); in nilfs_btree_lookup_dirty_buffers()
2088 int level, in nilfs_btree_assign_p() argument
2098 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_assign_p()
2099 ptr = nilfs_btree_node_get_ptr(parent, path[level + 1].bp_index, in nilfs_btree_assign_p()
2102 path[level].bp_ctxt.oldkey = ptr; in nilfs_btree_assign_p()
2103 path[level].bp_ctxt.newkey = blocknr; in nilfs_btree_assign_p()
2104 path[level].bp_ctxt.bh = *bh; in nilfs_btree_assign_p()
2107 &path[level].bp_ctxt); in nilfs_btree_assign_p()
2112 &path[level].bp_ctxt); in nilfs_btree_assign_p()
2113 *bh = path[level].bp_ctxt.bh; in nilfs_btree_assign_p()
2116 nilfs_btree_node_set_ptr(parent, path[level + 1].bp_index, blocknr, in nilfs_btree_assign_p()
2119 key = nilfs_btree_node_get_key(parent, path[level + 1].bp_index); in nilfs_btree_assign_p()
2122 binfo->bi_dat.bi_level = level; in nilfs_btree_assign_p()
2129 int level, in nilfs_btree_assign_v() argument
2141 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_assign_v()
2142 ptr = nilfs_btree_node_get_ptr(parent, path[level + 1].bp_index, in nilfs_btree_assign_v()
2150 key = nilfs_btree_node_get_key(parent, path[level + 1].bp_index); in nilfs_btree_assign_v()
2166 int level, ret; in nilfs_btree_assign() local
2175 level = nilfs_btree_node_get_level(node); in nilfs_btree_assign()
2178 level = NILFS_BTREE_LEVEL_DATA; in nilfs_btree_assign()
2181 ret = nilfs_btree_do_lookup(btree, path, key, NULL, level + 1, 0); in nilfs_btree_assign()
2188 nilfs_btree_assign_v(btree, path, level, bh, blocknr, binfo) : in nilfs_btree_assign()
2189 nilfs_btree_assign_p(btree, path, level, bh, blocknr, binfo); in nilfs_btree_assign()
2224 static int nilfs_btree_mark(struct nilfs_bmap *btree, __u64 key, int level) in nilfs_btree_mark() argument
2235 ret = nilfs_btree_do_lookup(btree, path, key, &ptr, level + 1, 0); in nilfs_btree_mark()