aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/btree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nilfs2/btree.c')
-rw-r--r--fs/nilfs2/btree.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
index 5b2606a0ac48..f5a0ec64e1aa 100644
--- a/fs/nilfs2/btree.c
+++ b/fs/nilfs2/btree.c
@@ -1527,7 +1527,7 @@ static int nilfs_btree_check_delete(struct nilfs_bmap *bmap, __u64 key)
1527 if (bh != NULL) 1527 if (bh != NULL)
1528 brelse(bh); 1528 brelse(bh);
1529 1529
1530 return (maxkey == key) && (nextmaxkey < bmap->b_low); 1530 return (maxkey == key) && (nextmaxkey < NILFS_BMAP_LARGE_LOW);
1531} 1531}
1532 1532
1533static int nilfs_btree_gather_data(struct nilfs_bmap *bmap, 1533static int nilfs_btree_gather_data(struct nilfs_bmap *bmap,
@@ -1634,7 +1634,7 @@ static void
1634nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap, 1634nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap,
1635 __u64 key, __u64 ptr, 1635 __u64 key, __u64 ptr,
1636 const __u64 *keys, const __u64 *ptrs, 1636 const __u64 *keys, const __u64 *ptrs,
1637 int n, __u64 low, __u64 high, 1637 int n,
1638 union nilfs_bmap_ptr_req *dreq, 1638 union nilfs_bmap_ptr_req *dreq,
1639 union nilfs_bmap_ptr_req *nreq, 1639 union nilfs_bmap_ptr_req *nreq,
1640 struct buffer_head *bh) 1640 struct buffer_head *bh)
@@ -1652,7 +1652,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap,
1652 1652
1653 /* convert and insert */ 1653 /* convert and insert */
1654 btree = (struct nilfs_btree *)bmap; 1654 btree = (struct nilfs_btree *)bmap;
1655 nilfs_btree_init(bmap, low, high); 1655 nilfs_btree_init(bmap);
1656 if (nreq != NULL) { 1656 if (nreq != NULL) {
1657 bmap->b_pops->bpop_commit_alloc_ptr(bmap, dreq); 1657 bmap->b_pops->bpop_commit_alloc_ptr(bmap, dreq);
1658 bmap->b_pops->bpop_commit_alloc_ptr(bmap, nreq); 1658 bmap->b_pops->bpop_commit_alloc_ptr(bmap, nreq);
@@ -1701,13 +1701,10 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap,
1701 * @keys: 1701 * @keys:
1702 * @ptrs: 1702 * @ptrs:
1703 * @n: 1703 * @n:
1704 * @low:
1705 * @high:
1706 */ 1704 */
1707int nilfs_btree_convert_and_insert(struct nilfs_bmap *bmap, 1705int nilfs_btree_convert_and_insert(struct nilfs_bmap *bmap,
1708 __u64 key, __u64 ptr, 1706 __u64 key, __u64 ptr,
1709 const __u64 *keys, const __u64 *ptrs, 1707 const __u64 *keys, const __u64 *ptrs, int n)
1710 int n, __u64 low, __u64 high)
1711{ 1708{
1712 struct buffer_head *bh; 1709 struct buffer_head *bh;
1713 union nilfs_bmap_ptr_req dreq, nreq, *di, *ni; 1710 union nilfs_bmap_ptr_req dreq, nreq, *di, *ni;
@@ -1732,7 +1729,7 @@ int nilfs_btree_convert_and_insert(struct nilfs_bmap *bmap,
1732 if (ret < 0) 1729 if (ret < 0)
1733 return ret; 1730 return ret;
1734 nilfs_btree_commit_convert_and_insert(bmap, key, ptr, keys, ptrs, n, 1731 nilfs_btree_commit_convert_and_insert(bmap, key, ptr, keys, ptrs, n,
1735 low, high, di, ni, bh); 1732 di, ni, bh);
1736 nilfs_bmap_add_blocks(bmap, stats.bs_nblocks); 1733 nilfs_bmap_add_blocks(bmap, stats.bs_nblocks);
1737 return 0; 1734 return 0;
1738} 1735}
@@ -2245,14 +2242,11 @@ static const struct nilfs_btree_operations nilfs_btree_ops_p = {
2245 .btop_assign = nilfs_btree_assign_p, 2242 .btop_assign = nilfs_btree_assign_p,
2246}; 2243};
2247 2244
2248int nilfs_btree_init(struct nilfs_bmap *bmap, __u64 low, __u64 high) 2245int nilfs_btree_init(struct nilfs_bmap *bmap)
2249{ 2246{
2250 struct nilfs_btree *btree; 2247 struct nilfs_btree *btree = (struct nilfs_btree *)bmap;
2251 2248
2252 btree = (struct nilfs_btree *)bmap;
2253 bmap->b_ops = &nilfs_btree_ops; 2249 bmap->b_ops = &nilfs_btree_ops;
2254 bmap->b_low = low;
2255 bmap->b_high = high;
2256 switch (bmap->b_inode->i_ino) { 2250 switch (bmap->b_inode->i_ino) {
2257 case NILFS_DAT_INO: 2251 case NILFS_DAT_INO:
2258 btree->bt_ops = &nilfs_btree_ops_p; 2252 btree->bt_ops = &nilfs_btree_ops_p;
@@ -2267,7 +2261,5 @@ int nilfs_btree_init(struct nilfs_bmap *bmap, __u64 low, __u64 high)
2267 2261
2268void nilfs_btree_init_gc(struct nilfs_bmap *bmap) 2262void nilfs_btree_init_gc(struct nilfs_bmap *bmap)
2269{ 2263{
2270 bmap->b_low = NILFS_BMAP_LARGE_LOW;
2271 bmap->b_high = NILFS_BMAP_LARGE_HIGH;
2272 bmap->b_ops = &nilfs_btree_ops_gc; 2264 bmap->b_ops = &nilfs_btree_ops_gc;
2273} 2265}