diff options
Diffstat (limited to 'fs/ocfs2/refcounttree.c')
-rw-r--r-- | fs/ocfs2/refcounttree.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 6fab28921f3d..52e4f6ee1e23 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -571,7 +571,7 @@ static int ocfs2_create_refcount_tree(struct inode *inode, | |||
571 | struct ocfs2_refcount_tree *new_tree = NULL, *tree = NULL; | 571 | struct ocfs2_refcount_tree *new_tree = NULL, *tree = NULL; |
572 | u16 suballoc_bit_start; | 572 | u16 suballoc_bit_start; |
573 | u32 num_got; | 573 | u32 num_got; |
574 | u64 first_blkno; | 574 | u64 suballoc_loc, first_blkno; |
575 | 575 | ||
576 | BUG_ON(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL); | 576 | BUG_ON(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL); |
577 | 577 | ||
@@ -597,7 +597,7 @@ static int ocfs2_create_refcount_tree(struct inode *inode, | |||
597 | goto out_commit; | 597 | goto out_commit; |
598 | } | 598 | } |
599 | 599 | ||
600 | ret = ocfs2_claim_metadata(osb, handle, meta_ac, 1, | 600 | ret = ocfs2_claim_metadata(handle, meta_ac, 1, &suballoc_loc, |
601 | &suballoc_bit_start, &num_got, | 601 | &suballoc_bit_start, &num_got, |
602 | &first_blkno); | 602 | &first_blkno); |
603 | if (ret) { | 603 | if (ret) { |
@@ -627,6 +627,7 @@ static int ocfs2_create_refcount_tree(struct inode *inode, | |||
627 | memset(rb, 0, inode->i_sb->s_blocksize); | 627 | memset(rb, 0, inode->i_sb->s_blocksize); |
628 | strcpy((void *)rb, OCFS2_REFCOUNT_BLOCK_SIGNATURE); | 628 | strcpy((void *)rb, OCFS2_REFCOUNT_BLOCK_SIGNATURE); |
629 | rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); | 629 | rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); |
630 | rb->rf_suballoc_loc = cpu_to_le64(suballoc_loc); | ||
630 | rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); | 631 | rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); |
631 | rb->rf_fs_generation = cpu_to_le32(osb->fs_generation); | 632 | rb->rf_fs_generation = cpu_to_le32(osb->fs_generation); |
632 | rb->rf_blkno = cpu_to_le64(first_blkno); | 633 | rb->rf_blkno = cpu_to_le64(first_blkno); |
@@ -791,7 +792,10 @@ int ocfs2_remove_refcount_tree(struct inode *inode, struct buffer_head *di_bh) | |||
791 | if (le32_to_cpu(rb->rf_count) == 1) { | 792 | if (le32_to_cpu(rb->rf_count) == 1) { |
792 | blk = le64_to_cpu(rb->rf_blkno); | 793 | blk = le64_to_cpu(rb->rf_blkno); |
793 | bit = le16_to_cpu(rb->rf_suballoc_bit); | 794 | bit = le16_to_cpu(rb->rf_suballoc_bit); |
794 | bg_blkno = ocfs2_which_suballoc_group(blk, bit); | 795 | if (rb->rf_suballoc_loc) |
796 | bg_blkno = le64_to_cpu(rb->rf_suballoc_loc); | ||
797 | else | ||
798 | bg_blkno = ocfs2_which_suballoc_group(blk, bit); | ||
795 | 799 | ||
796 | alloc_inode = ocfs2_get_system_file_inode(osb, | 800 | alloc_inode = ocfs2_get_system_file_inode(osb, |
797 | EXTENT_ALLOC_SYSTEM_INODE, | 801 | EXTENT_ALLOC_SYSTEM_INODE, |
@@ -1283,7 +1287,7 @@ static int ocfs2_expand_inline_ref_root(handle_t *handle, | |||
1283 | int ret; | 1287 | int ret; |
1284 | u16 suballoc_bit_start; | 1288 | u16 suballoc_bit_start; |
1285 | u32 num_got; | 1289 | u32 num_got; |
1286 | u64 blkno; | 1290 | u64 suballoc_loc, blkno; |
1287 | struct super_block *sb = ocfs2_metadata_cache_get_super(ci); | 1291 | struct super_block *sb = ocfs2_metadata_cache_get_super(ci); |
1288 | struct buffer_head *new_bh = NULL; | 1292 | struct buffer_head *new_bh = NULL; |
1289 | struct ocfs2_refcount_block *new_rb; | 1293 | struct ocfs2_refcount_block *new_rb; |
@@ -1297,7 +1301,7 @@ static int ocfs2_expand_inline_ref_root(handle_t *handle, | |||
1297 | goto out; | 1301 | goto out; |
1298 | } | 1302 | } |
1299 | 1303 | ||
1300 | ret = ocfs2_claim_metadata(OCFS2_SB(sb), handle, meta_ac, 1, | 1304 | ret = ocfs2_claim_metadata(handle, meta_ac, 1, &suballoc_loc, |
1301 | &suballoc_bit_start, &num_got, | 1305 | &suballoc_bit_start, &num_got, |
1302 | &blkno); | 1306 | &blkno); |
1303 | if (ret) { | 1307 | if (ret) { |
@@ -1329,6 +1333,7 @@ static int ocfs2_expand_inline_ref_root(handle_t *handle, | |||
1329 | 1333 | ||
1330 | new_rb = (struct ocfs2_refcount_block *)new_bh->b_data; | 1334 | new_rb = (struct ocfs2_refcount_block *)new_bh->b_data; |
1331 | new_rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); | 1335 | new_rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); |
1336 | new_rb->rf_suballoc_loc = cpu_to_le64(suballoc_loc); | ||
1332 | new_rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); | 1337 | new_rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); |
1333 | new_rb->rf_blkno = cpu_to_le64(blkno); | 1338 | new_rb->rf_blkno = cpu_to_le64(blkno); |
1334 | new_rb->rf_cpos = cpu_to_le32(0); | 1339 | new_rb->rf_cpos = cpu_to_le32(0); |
@@ -1523,7 +1528,7 @@ static int ocfs2_new_leaf_refcount_block(handle_t *handle, | |||
1523 | int ret; | 1528 | int ret; |
1524 | u16 suballoc_bit_start; | 1529 | u16 suballoc_bit_start; |
1525 | u32 num_got, new_cpos; | 1530 | u32 num_got, new_cpos; |
1526 | u64 blkno; | 1531 | u64 suballoc_loc, blkno; |
1527 | struct super_block *sb = ocfs2_metadata_cache_get_super(ci); | 1532 | struct super_block *sb = ocfs2_metadata_cache_get_super(ci); |
1528 | struct ocfs2_refcount_block *root_rb = | 1533 | struct ocfs2_refcount_block *root_rb = |
1529 | (struct ocfs2_refcount_block *)ref_root_bh->b_data; | 1534 | (struct ocfs2_refcount_block *)ref_root_bh->b_data; |
@@ -1547,7 +1552,7 @@ static int ocfs2_new_leaf_refcount_block(handle_t *handle, | |||
1547 | goto out; | 1552 | goto out; |
1548 | } | 1553 | } |
1549 | 1554 | ||
1550 | ret = ocfs2_claim_metadata(OCFS2_SB(sb), handle, meta_ac, 1, | 1555 | ret = ocfs2_claim_metadata(handle, meta_ac, 1, &suballoc_loc, |
1551 | &suballoc_bit_start, &num_got, | 1556 | &suballoc_bit_start, &num_got, |
1552 | &blkno); | 1557 | &blkno); |
1553 | if (ret) { | 1558 | if (ret) { |
@@ -1575,6 +1580,7 @@ static int ocfs2_new_leaf_refcount_block(handle_t *handle, | |||
1575 | memset(new_rb, 0, sb->s_blocksize); | 1580 | memset(new_rb, 0, sb->s_blocksize); |
1576 | strcpy((void *)new_rb, OCFS2_REFCOUNT_BLOCK_SIGNATURE); | 1581 | strcpy((void *)new_rb, OCFS2_REFCOUNT_BLOCK_SIGNATURE); |
1577 | new_rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); | 1582 | new_rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); |
1583 | new_rb->rf_suballoc_loc = cpu_to_le64(suballoc_loc); | ||
1578 | new_rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); | 1584 | new_rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); |
1579 | new_rb->rf_fs_generation = cpu_to_le32(OCFS2_SB(sb)->fs_generation); | 1585 | new_rb->rf_fs_generation = cpu_to_le32(OCFS2_SB(sb)->fs_generation); |
1580 | new_rb->rf_blkno = cpu_to_le64(blkno); | 1586 | new_rb->rf_blkno = cpu_to_le64(blkno); |
@@ -2105,6 +2111,7 @@ static int ocfs2_remove_refcount_extent(handle_t *handle, | |||
2105 | */ | 2111 | */ |
2106 | ret = ocfs2_cache_block_dealloc(dealloc, EXTENT_ALLOC_SYSTEM_INODE, | 2112 | ret = ocfs2_cache_block_dealloc(dealloc, EXTENT_ALLOC_SYSTEM_INODE, |
2107 | le16_to_cpu(rb->rf_suballoc_slot), | 2113 | le16_to_cpu(rb->rf_suballoc_slot), |
2114 | le64_to_cpu(rb->rf_suballoc_loc), | ||
2108 | le64_to_cpu(rb->rf_blkno), | 2115 | le64_to_cpu(rb->rf_blkno), |
2109 | le16_to_cpu(rb->rf_suballoc_bit)); | 2116 | le16_to_cpu(rb->rf_suballoc_bit)); |
2110 | if (ret) { | 2117 | if (ret) { |
@@ -3262,7 +3269,7 @@ static int ocfs2_make_clusters_writable(struct super_block *sb, | |||
3262 | } else { | 3269 | } else { |
3263 | delete = 1; | 3270 | delete = 1; |
3264 | 3271 | ||
3265 | ret = __ocfs2_claim_clusters(osb, handle, | 3272 | ret = __ocfs2_claim_clusters(handle, |
3266 | context->data_ac, | 3273 | context->data_ac, |
3267 | 1, set_len, | 3274 | 1, set_len, |
3268 | &new_bit, &new_len); | 3275 | &new_bit, &new_len); |