Lines Matching refs:btree
58 static int nilfs_btree_get_new_block(const struct nilfs_bmap *btree, in nilfs_btree_get_new_block() argument
61 struct inode *btnc_inode = NILFS_BMAP_I(btree)->i_assoc_inode; in nilfs_btree_get_new_block()
112 static int nilfs_btree_node_size(const struct nilfs_bmap *btree) in nilfs_btree_node_size() argument
114 return i_blocksize(btree->b_inode); in nilfs_btree_node_size()
117 static int nilfs_btree_nchildren_per_block(const struct nilfs_bmap *btree) in nilfs_btree_nchildren_per_block() argument
119 return btree->b_nchildren_per_block; in nilfs_btree_nchildren_per_block()
410 nilfs_btree_get_root(const struct nilfs_bmap *btree) in nilfs_btree_get_root() argument
412 return (struct nilfs_btree_node *)btree->b_u.u_data; in nilfs_btree_get_root()
427 static int nilfs_btree_height(const struct nilfs_bmap *btree) in nilfs_btree_height() argument
429 return nilfs_btree_node_get_level(nilfs_btree_get_root(btree)) + 1; in nilfs_btree_height()
433 nilfs_btree_get_node(const struct nilfs_bmap *btree, in nilfs_btree_get_node() argument
439 if (level == nilfs_btree_height(btree) - 1) { in nilfs_btree_get_node()
440 node = nilfs_btree_get_root(btree); in nilfs_btree_get_node()
444 *ncmaxp = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_get_node()
449 static int nilfs_btree_bad_node(const struct nilfs_bmap *btree, in nilfs_btree_bad_node() argument
454 nilfs_crit(btree->b_inode->i_sb, in nilfs_btree_bad_node()
456 btree->b_inode->i_ino, in nilfs_btree_bad_node()
470 static int __nilfs_btree_get_block(const struct nilfs_bmap *btree, __u64 ptr, in __nilfs_btree_get_block() argument
474 struct inode *btnc_inode = NILFS_BMAP_I(btree)->i_assoc_inode; in __nilfs_btree_get_block()
522 nilfs_err(btree->b_inode->i_sb, in __nilfs_btree_get_block()
524 btree->b_inode->i_ino, (unsigned long long)ptr); in __nilfs_btree_get_block()
540 static int nilfs_btree_get_block(const struct nilfs_bmap *btree, __u64 ptr, in nilfs_btree_get_block() argument
543 return __nilfs_btree_get_block(btree, ptr, bhp, NULL); in nilfs_btree_get_block()
546 static int nilfs_btree_do_lookup(const struct nilfs_bmap *btree, in nilfs_btree_do_lookup() argument
556 node = nilfs_btree_get_root(btree); in nilfs_btree_do_lookup()
567 ncmax = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_do_lookup()
572 p.node = nilfs_btree_get_node(btree, path, level + 1, in nilfs_btree_do_lookup()
578 ret = __nilfs_btree_get_block(btree, ptr, &path[level].bp_bh, in nilfs_btree_do_lookup()
584 if (nilfs_btree_bad_node(btree, node, level)) in nilfs_btree_do_lookup()
608 static int nilfs_btree_do_lookup_last(const struct nilfs_bmap *btree, in nilfs_btree_do_lookup_last() argument
616 node = nilfs_btree_get_root(btree); in nilfs_btree_do_lookup_last()
625 ncmax = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_do_lookup_last()
628 ret = nilfs_btree_get_block(btree, ptr, &path[level].bp_bh); in nilfs_btree_do_lookup_last()
632 if (nilfs_btree_bad_node(btree, node, level)) in nilfs_btree_do_lookup_last()
657 static int nilfs_btree_get_next_key(const struct nilfs_bmap *btree, in nilfs_btree_get_next_key() argument
662 int maxlevel = nilfs_btree_height(btree) - 1; in nilfs_btree_get_next_key()
669 node = nilfs_btree_get_root(btree); in nilfs_btree_get_next_key()
685 static int nilfs_btree_lookup(const struct nilfs_bmap *btree, in nilfs_btree_lookup() argument
695 ret = nilfs_btree_do_lookup(btree, path, key, ptrp, level, 0); in nilfs_btree_lookup()
702 static int nilfs_btree_lookup_contig(const struct nilfs_bmap *btree, in nilfs_btree_lookup_contig() argument
719 ret = nilfs_btree_do_lookup(btree, path, key, &ptr, level, 1); in nilfs_btree_lookup_contig()
723 if (NILFS_BMAP_USE_VBN(btree)) { in nilfs_btree_lookup_contig()
724 dat = nilfs_bmap_get_dat(btree); in nilfs_btree_lookup_contig()
734 maxlevel = nilfs_btree_height(btree) - 1; in nilfs_btree_lookup_contig()
735 node = nilfs_btree_get_node(btree, path, level, &ncmax); in nilfs_btree_lookup_contig()
757 p.node = nilfs_btree_get_node(btree, path, level + 1, &p.ncmax); in nilfs_btree_lookup_contig()
769 ret = __nilfs_btree_get_block(btree, ptr2, &path[level].bp_bh, in nilfs_btree_lookup_contig()
774 ncmax = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_lookup_contig()
786 static void nilfs_btree_promote_key(struct nilfs_bmap *btree, in nilfs_btree_promote_key() argument
790 if (level < nilfs_btree_height(btree) - 1) { in nilfs_btree_promote_key()
798 (++level < nilfs_btree_height(btree) - 1)); in nilfs_btree_promote_key()
802 if (level == nilfs_btree_height(btree) - 1) { in nilfs_btree_promote_key()
803 nilfs_btree_node_set_key(nilfs_btree_get_root(btree), in nilfs_btree_promote_key()
808 static void nilfs_btree_do_insert(struct nilfs_bmap *btree, in nilfs_btree_do_insert() argument
815 if (level < nilfs_btree_height(btree) - 1) { in nilfs_btree_do_insert()
817 ncblk = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_do_insert()
824 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_do_insert()
828 node = nilfs_btree_get_root(btree); in nilfs_btree_do_insert()
835 static void nilfs_btree_carry_left(struct nilfs_bmap *btree, in nilfs_btree_carry_left() argument
846 ncblk = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_carry_left()
863 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_carry_left()
878 nilfs_btree_do_insert(btree, path, level, keyp, ptrp); in nilfs_btree_carry_left()
881 static void nilfs_btree_carry_right(struct nilfs_bmap *btree, in nilfs_btree_carry_right() argument
892 ncblk = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_carry_right()
910 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_carry_right()
925 nilfs_btree_do_insert(btree, path, level, keyp, ptrp); in nilfs_btree_carry_right()
928 static void nilfs_btree_split(struct nilfs_bmap *btree, in nilfs_btree_split() argument
938 ncblk = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_split()
966 nilfs_btree_do_insert(btree, path, level, keyp, ptrp); in nilfs_btree_split()
978 static void nilfs_btree_grow(struct nilfs_bmap *btree, in nilfs_btree_grow() argument
985 root = nilfs_btree_get_root(btree); in nilfs_btree_grow()
987 ncblk = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_grow()
1001 nilfs_btree_do_insert(btree, path, level, keyp, ptrp); in nilfs_btree_grow()
1007 static __u64 nilfs_btree_find_near(const struct nilfs_bmap *btree, in nilfs_btree_find_near() argument
1019 node = nilfs_btree_get_node(btree, path, level, &ncmax); in nilfs_btree_find_near()
1027 if (level <= nilfs_btree_height(btree) - 1) { in nilfs_btree_find_near()
1028 node = nilfs_btree_get_node(btree, path, level, &ncmax); in nilfs_btree_find_near()
1036 static __u64 nilfs_btree_find_target_v(const struct nilfs_bmap *btree, in nilfs_btree_find_target_v() argument
1042 ptr = nilfs_bmap_find_target_seq(btree, key); in nilfs_btree_find_target_v()
1047 ptr = nilfs_btree_find_near(btree, path); in nilfs_btree_find_target_v()
1053 return nilfs_bmap_find_target_in_group(btree); in nilfs_btree_find_target_v()
1056 static int nilfs_btree_prepare_insert(struct nilfs_bmap *btree, in nilfs_btree_prepare_insert() argument
1071 if (NILFS_BMAP_USE_VBN(btree)) { in nilfs_btree_prepare_insert()
1073 nilfs_btree_find_target_v(btree, path, key); in nilfs_btree_prepare_insert()
1074 dat = nilfs_bmap_get_dat(btree); in nilfs_btree_prepare_insert()
1077 ret = nilfs_bmap_prepare_alloc_ptr(btree, &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1081 ncblk = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_prepare_insert()
1084 level < nilfs_btree_height(btree) - 1; in nilfs_btree_prepare_insert()
1093 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_prepare_insert()
1100 ret = nilfs_btree_get_block(btree, sibptr, &bh); in nilfs_btree_prepare_insert()
1118 ret = nilfs_btree_get_block(btree, sibptr, &bh); in nilfs_btree_prepare_insert()
1135 ret = nilfs_bmap_prepare_alloc_ptr(btree, in nilfs_btree_prepare_insert()
1139 ret = nilfs_btree_get_new_block(btree, in nilfs_btree_prepare_insert()
1154 node = nilfs_btree_get_root(btree); in nilfs_btree_prepare_insert()
1164 ret = nilfs_bmap_prepare_alloc_ptr(btree, &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1167 ret = nilfs_btree_get_new_block(btree, path[level].bp_newreq.bpr_ptr, in nilfs_btree_prepare_insert()
1190 nilfs_bmap_abort_alloc_ptr(btree, &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1194 nilfs_bmap_abort_alloc_ptr(btree, &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1198 nilfs_bmap_abort_alloc_ptr(btree, &path[level].bp_newreq, dat); in nilfs_btree_prepare_insert()
1205 static void nilfs_btree_commit_insert(struct nilfs_bmap *btree, in nilfs_btree_commit_insert() argument
1214 if (NILFS_BMAP_USE_VBN(btree)) { in nilfs_btree_commit_insert()
1215 nilfs_bmap_set_target_v(btree, key, ptr); in nilfs_btree_commit_insert()
1216 dat = nilfs_bmap_get_dat(btree); in nilfs_btree_commit_insert()
1220 nilfs_bmap_commit_alloc_ptr(btree, in nilfs_btree_commit_insert()
1222 path[level].bp_op(btree, path, level, &key, &ptr); in nilfs_btree_commit_insert()
1225 if (!nilfs_bmap_dirty(btree)) in nilfs_btree_commit_insert()
1226 nilfs_bmap_set_dirty(btree); in nilfs_btree_commit_insert()
1229 static int nilfs_btree_insert(struct nilfs_bmap *btree, __u64 key, __u64 ptr) in nilfs_btree_insert() argument
1239 ret = nilfs_btree_do_lookup(btree, path, key, NULL, in nilfs_btree_insert()
1247 ret = nilfs_btree_prepare_insert(btree, path, &level, key, ptr, &stats); in nilfs_btree_insert()
1250 nilfs_btree_commit_insert(btree, path, level, key, ptr); in nilfs_btree_insert()
1251 nilfs_inode_add_blocks(btree->b_inode, stats.bs_nblocks); in nilfs_btree_insert()
1258 static void nilfs_btree_do_delete(struct nilfs_bmap *btree, in nilfs_btree_do_delete() argument
1265 if (level < nilfs_btree_height(btree) - 1) { in nilfs_btree_do_delete()
1267 ncblk = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_do_delete()
1273 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_do_delete()
1276 node = nilfs_btree_get_root(btree); in nilfs_btree_do_delete()
1283 static void nilfs_btree_borrow_left(struct nilfs_bmap *btree, in nilfs_btree_borrow_left() argument
1290 nilfs_btree_do_delete(btree, path, level, keyp, ptrp); in nilfs_btree_borrow_left()
1296 ncblk = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_borrow_left()
1307 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_borrow_left()
1315 static void nilfs_btree_borrow_right(struct nilfs_bmap *btree, in nilfs_btree_borrow_right() argument
1322 nilfs_btree_do_delete(btree, path, level, keyp, ptrp); in nilfs_btree_borrow_right()
1328 ncblk = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_borrow_right()
1340 nilfs_btree_promote_key(btree, path, level + 1, in nilfs_btree_borrow_right()
1348 static void nilfs_btree_concat_left(struct nilfs_bmap *btree, in nilfs_btree_concat_left() argument
1355 nilfs_btree_do_delete(btree, path, level, keyp, ptrp); in nilfs_btree_concat_left()
1359 ncblk = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_concat_left()
1374 static void nilfs_btree_concat_right(struct nilfs_bmap *btree, in nilfs_btree_concat_right() argument
1381 nilfs_btree_do_delete(btree, path, level, keyp, ptrp); in nilfs_btree_concat_right()
1385 ncblk = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_concat_right()
1399 static void nilfs_btree_shrink(struct nilfs_bmap *btree, in nilfs_btree_shrink() argument
1406 nilfs_btree_do_delete(btree, path, level, keyp, ptrp); in nilfs_btree_shrink()
1408 root = nilfs_btree_get_root(btree); in nilfs_btree_shrink()
1410 ncblk = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_shrink()
1423 static void nilfs_btree_nop(struct nilfs_bmap *btree, in nilfs_btree_nop() argument
1429 static int nilfs_btree_prepare_delete(struct nilfs_bmap *btree, in nilfs_btree_prepare_delete() argument
1442 ncmin = NILFS_BTREE_NODE_NCHILDREN_MIN(nilfs_btree_node_size(btree)); in nilfs_btree_prepare_delete()
1443 ncblk = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_prepare_delete()
1446 level < nilfs_btree_height(btree) - 1; in nilfs_btree_prepare_delete()
1451 ret = nilfs_bmap_prepare_end_ptr(btree, in nilfs_btree_prepare_delete()
1462 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_prepare_delete()
1470 ret = nilfs_btree_get_block(btree, sibptr, &bh); in nilfs_btree_prepare_delete()
1490 ret = nilfs_btree_get_block(btree, sibptr, &bh); in nilfs_btree_prepare_delete()
1516 WARN_ON(level != nilfs_btree_height(btree) - 2); in nilfs_btree_prepare_delete()
1537 node = nilfs_btree_get_root(btree); in nilfs_btree_prepare_delete()
1542 ret = nilfs_bmap_prepare_end_ptr(btree, &path[level].bp_oldreq, dat); in nilfs_btree_prepare_delete()
1553 nilfs_bmap_abort_end_ptr(btree, &path[level].bp_oldreq, dat); in nilfs_btree_prepare_delete()
1557 nilfs_bmap_abort_end_ptr(btree, &path[level].bp_oldreq, dat); in nilfs_btree_prepare_delete()
1564 static void nilfs_btree_commit_delete(struct nilfs_bmap *btree, in nilfs_btree_commit_delete() argument
1571 nilfs_bmap_commit_end_ptr(btree, &path[level].bp_oldreq, dat); in nilfs_btree_commit_delete()
1572 path[level].bp_op(btree, path, level, NULL, NULL); in nilfs_btree_commit_delete()
1575 if (!nilfs_bmap_dirty(btree)) in nilfs_btree_commit_delete()
1576 nilfs_bmap_set_dirty(btree); in nilfs_btree_commit_delete()
1579 static int nilfs_btree_delete(struct nilfs_bmap *btree, __u64 key) in nilfs_btree_delete() argument
1591 ret = nilfs_btree_do_lookup(btree, path, key, NULL, in nilfs_btree_delete()
1597 dat = NILFS_BMAP_USE_VBN(btree) ? nilfs_bmap_get_dat(btree) : NULL; in nilfs_btree_delete()
1599 ret = nilfs_btree_prepare_delete(btree, path, &level, &stats, dat); in nilfs_btree_delete()
1602 nilfs_btree_commit_delete(btree, path, level, dat); in nilfs_btree_delete()
1603 nilfs_inode_sub_blocks(btree->b_inode, stats.bs_nblocks); in nilfs_btree_delete()
1610 static int nilfs_btree_seek_key(const struct nilfs_bmap *btree, __u64 start, in nilfs_btree_seek_key() argument
1621 ret = nilfs_btree_do_lookup(btree, path, start, NULL, minlevel, 0); in nilfs_btree_seek_key()
1625 ret = nilfs_btree_get_next_key(btree, path, minlevel, keyp); in nilfs_btree_seek_key()
1631 static int nilfs_btree_last_key(const struct nilfs_bmap *btree, __u64 *keyp) in nilfs_btree_last_key() argument
1640 ret = nilfs_btree_do_lookup_last(btree, path, keyp, NULL); in nilfs_btree_last_key()
1647 static int nilfs_btree_check_delete(struct nilfs_bmap *btree, __u64 key) in nilfs_btree_check_delete() argument
1655 root = nilfs_btree_get_root(btree); in nilfs_btree_check_delete()
1656 switch (nilfs_btree_height(btree)) { in nilfs_btree_check_delete()
1667 ret = nilfs_btree_get_block(btree, ptr, &bh); in nilfs_btree_check_delete()
1685 static int nilfs_btree_gather_data(struct nilfs_bmap *btree, in nilfs_btree_gather_data() argument
1695 root = nilfs_btree_get_root(btree); in nilfs_btree_gather_data()
1696 switch (nilfs_btree_height(btree)) { in nilfs_btree_gather_data()
1707 ret = nilfs_btree_get_block(btree, ptr, &bh); in nilfs_btree_gather_data()
1711 ncmax = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_gather_data()
1734 nilfs_btree_prepare_convert_and_insert(struct nilfs_bmap *btree, __u64 key, in nilfs_btree_prepare_convert_and_insert() argument
1748 if (NILFS_BMAP_USE_VBN(btree)) { in nilfs_btree_prepare_convert_and_insert()
1749 dreq->bpr_ptr = nilfs_btree_find_target_v(btree, NULL, key); in nilfs_btree_prepare_convert_and_insert()
1750 dat = nilfs_bmap_get_dat(btree); in nilfs_btree_prepare_convert_and_insert()
1753 ret = nilfs_attach_btree_node_cache(&NILFS_BMAP_I(btree)->vfs_inode); in nilfs_btree_prepare_convert_and_insert()
1757 ret = nilfs_bmap_prepare_alloc_ptr(btree, dreq, dat); in nilfs_btree_prepare_convert_and_insert()
1765 ret = nilfs_bmap_prepare_alloc_ptr(btree, nreq, dat); in nilfs_btree_prepare_convert_and_insert()
1769 ret = nilfs_btree_get_new_block(btree, nreq->bpr_ptr, &bh); in nilfs_btree_prepare_convert_and_insert()
1782 nilfs_bmap_abort_alloc_ptr(btree, nreq, dat); in nilfs_btree_prepare_convert_and_insert()
1784 nilfs_bmap_abort_alloc_ptr(btree, dreq, dat); in nilfs_btree_prepare_convert_and_insert()
1791 nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *btree, in nilfs_btree_commit_convert_and_insert() argument
1805 if (btree->b_ops->bop_clear != NULL) in nilfs_btree_commit_convert_and_insert()
1806 btree->b_ops->bop_clear(btree); in nilfs_btree_commit_convert_and_insert()
1812 dat = NILFS_BMAP_USE_VBN(btree) ? nilfs_bmap_get_dat(btree) : NULL; in nilfs_btree_commit_convert_and_insert()
1813 __nilfs_btree_init(btree); in nilfs_btree_commit_convert_and_insert()
1815 nilfs_bmap_commit_alloc_ptr(btree, dreq, dat); in nilfs_btree_commit_convert_and_insert()
1816 nilfs_bmap_commit_alloc_ptr(btree, nreq, dat); in nilfs_btree_commit_convert_and_insert()
1820 ncblk = nilfs_btree_nchildren_per_block(btree); in nilfs_btree_commit_convert_and_insert()
1825 if (!nilfs_bmap_dirty(btree)) in nilfs_btree_commit_convert_and_insert()
1826 nilfs_bmap_set_dirty(btree); in nilfs_btree_commit_convert_and_insert()
1831 node = nilfs_btree_get_root(btree); in nilfs_btree_commit_convert_and_insert()
1837 nilfs_bmap_commit_alloc_ptr(btree, dreq, dat); in nilfs_btree_commit_convert_and_insert()
1840 node = nilfs_btree_get_root(btree); in nilfs_btree_commit_convert_and_insert()
1846 if (!nilfs_bmap_dirty(btree)) in nilfs_btree_commit_convert_and_insert()
1847 nilfs_bmap_set_dirty(btree); in nilfs_btree_commit_convert_and_insert()
1850 if (NILFS_BMAP_USE_VBN(btree)) in nilfs_btree_commit_convert_and_insert()
1851 nilfs_bmap_set_target_v(btree, key, dreq->bpr_ptr); in nilfs_btree_commit_convert_and_insert()
1863 int nilfs_btree_convert_and_insert(struct nilfs_bmap *btree, in nilfs_btree_convert_and_insert() argument
1876 nilfs_btree_node_size(btree))) { in nilfs_btree_convert_and_insert()
1885 ret = nilfs_btree_prepare_convert_and_insert(btree, key, di, ni, &bh, in nilfs_btree_convert_and_insert()
1889 nilfs_btree_commit_convert_and_insert(btree, key, ptr, keys, ptrs, n, in nilfs_btree_convert_and_insert()
1891 nilfs_inode_add_blocks(btree->b_inode, stats.bs_nblocks); in nilfs_btree_convert_and_insert()
1895 static int nilfs_btree_propagate_p(struct nilfs_bmap *btree, in nilfs_btree_propagate_p() argument
1900 while ((++level < nilfs_btree_height(btree) - 1) && in nilfs_btree_propagate_p()
1907 static int nilfs_btree_prepare_update_v(struct nilfs_bmap *btree, in nilfs_btree_prepare_update_v() argument
1914 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_prepare_update_v()
1929 NILFS_BMAP_I(btree)->i_assoc_inode->i_mapping, in nilfs_btree_prepare_update_v()
1942 static void nilfs_btree_commit_update_v(struct nilfs_bmap *btree, in nilfs_btree_commit_update_v() argument
1951 btree->b_ptr_type == NILFS_BMAP_PTR_VS); in nilfs_btree_commit_update_v()
1955 NILFS_BMAP_I(btree)->i_assoc_inode->i_mapping, in nilfs_btree_commit_update_v()
1961 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_commit_update_v()
1966 static void nilfs_btree_abort_update_v(struct nilfs_bmap *btree, in nilfs_btree_abort_update_v() argument
1974 NILFS_BMAP_I(btree)->i_assoc_inode->i_mapping, in nilfs_btree_abort_update_v()
1978 static int nilfs_btree_prepare_propagate_v(struct nilfs_bmap *btree, in nilfs_btree_prepare_propagate_v() argument
1987 ret = nilfs_btree_prepare_update_v(btree, path, level, dat); in nilfs_btree_prepare_propagate_v()
1991 while ((++level < nilfs_btree_height(btree) - 1) && in nilfs_btree_prepare_propagate_v()
1995 ret = nilfs_btree_prepare_update_v(btree, path, level, dat); in nilfs_btree_prepare_propagate_v()
2007 nilfs_btree_abort_update_v(btree, path, level, dat); in nilfs_btree_prepare_propagate_v()
2009 nilfs_btree_abort_update_v(btree, path, level, dat); in nilfs_btree_prepare_propagate_v()
2013 static void nilfs_btree_commit_propagate_v(struct nilfs_bmap *btree, in nilfs_btree_commit_propagate_v() argument
2022 nilfs_btree_commit_update_v(btree, path, minlevel, dat); in nilfs_btree_commit_propagate_v()
2025 nilfs_btree_commit_update_v(btree, path, level, dat); in nilfs_btree_commit_propagate_v()
2028 static int nilfs_btree_propagate_v(struct nilfs_bmap *btree, in nilfs_btree_propagate_v() argument
2034 struct inode *dat = nilfs_bmap_get_dat(btree); in nilfs_btree_propagate_v()
2040 ret = nilfs_btree_prepare_propagate_v(btree, path, level, &maxlevel, in nilfs_btree_propagate_v()
2046 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_propagate_v()
2055 nilfs_btree_commit_propagate_v(btree, path, level, maxlevel, bh, dat); in nilfs_btree_propagate_v()
2063 static int nilfs_btree_propagate(struct nilfs_bmap *btree, in nilfs_btree_propagate() argument
2082 key = nilfs_bmap_data_get_key(btree, bh); in nilfs_btree_propagate()
2086 ret = nilfs_btree_do_lookup(btree, path, key, NULL, level + 1, 0); in nilfs_btree_propagate()
2089 nilfs_crit(btree->b_inode->i_sb, in nilfs_btree_propagate()
2091 btree->b_inode->i_ino, in nilfs_btree_propagate()
2096 ret = NILFS_BMAP_USE_VBN(btree) ? in nilfs_btree_propagate()
2097 nilfs_btree_propagate_v(btree, path, level, bh) : in nilfs_btree_propagate()
2098 nilfs_btree_propagate_p(btree, path, level, bh); in nilfs_btree_propagate()
2106 static int nilfs_btree_propagate_gc(struct nilfs_bmap *btree, in nilfs_btree_propagate_gc() argument
2109 return nilfs_dat_mark_dirty(nilfs_bmap_get_dat(btree), bh->b_blocknr); in nilfs_btree_propagate_gc()
2112 static void nilfs_btree_add_dirty_buffer(struct nilfs_bmap *btree, in nilfs_btree_add_dirty_buffer() argument
2129 nilfs_warn(btree->b_inode->i_sb, in nilfs_btree_add_dirty_buffer()
2132 btree->b_inode->i_ino, in nilfs_btree_add_dirty_buffer()
2147 static void nilfs_btree_lookup_dirty_buffers(struct nilfs_bmap *btree, in nilfs_btree_lookup_dirty_buffers() argument
2150 struct inode *btnc_inode = NILFS_BMAP_I(btree)->i_assoc_inode; in nilfs_btree_lookup_dirty_buffers()
2171 nilfs_btree_add_dirty_buffer(btree, in nilfs_btree_lookup_dirty_buffers()
2185 static int nilfs_btree_assign_p(struct nilfs_bmap *btree, in nilfs_btree_assign_p() argument
2197 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_assign_p()
2205 NILFS_BMAP_I(btree)->i_assoc_inode->i_mapping, in nilfs_btree_assign_p()
2210 NILFS_BMAP_I(btree)->i_assoc_inode->i_mapping, in nilfs_btree_assign_p()
2226 static int nilfs_btree_assign_v(struct nilfs_bmap *btree, in nilfs_btree_assign_v() argument
2234 struct inode *dat = nilfs_bmap_get_dat(btree); in nilfs_btree_assign_v()
2240 parent = nilfs_btree_get_node(btree, path, level + 1, &ncmax); in nilfs_btree_assign_v()
2257 static int nilfs_btree_assign(struct nilfs_bmap *btree, in nilfs_btree_assign() argument
2276 key = nilfs_bmap_data_get_key(btree, *bh); in nilfs_btree_assign()
2280 ret = nilfs_btree_do_lookup(btree, path, key, NULL, level + 1, 0); in nilfs_btree_assign()
2286 ret = NILFS_BMAP_USE_VBN(btree) ? in nilfs_btree_assign()
2287 nilfs_btree_assign_v(btree, path, level, bh, blocknr, binfo) : in nilfs_btree_assign()
2288 nilfs_btree_assign_p(btree, path, level, bh, blocknr, binfo); in nilfs_btree_assign()
2296 static int nilfs_btree_assign_gc(struct nilfs_bmap *btree, in nilfs_btree_assign_gc() argument
2305 ret = nilfs_dat_move(nilfs_bmap_get_dat(btree), (*bh)->b_blocknr, in nilfs_btree_assign_gc()
2314 key = nilfs_bmap_data_get_key(btree, *bh); in nilfs_btree_assign_gc()
2323 static int nilfs_btree_mark(struct nilfs_bmap *btree, __u64 key, int level) in nilfs_btree_mark() argument
2334 ret = nilfs_btree_do_lookup(btree, path, key, &ptr, level + 1, 0); in nilfs_btree_mark()
2339 ret = nilfs_btree_get_block(btree, ptr, &bh); in nilfs_btree_mark()
2348 if (!nilfs_bmap_dirty(btree)) in nilfs_btree_mark()
2349 nilfs_bmap_set_dirty(btree); in nilfs_btree_mark()