aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/refcounttree.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2010-03-25 22:09:15 -0400
committerTao Ma <tao.ma@oracle.com>2010-03-25 22:09:15 -0400
commit2b6cb576aa80611f1f6a3c88708d1e68a8d97985 (patch)
treea984f09104970133379e4d370b9f01e7f85c6f9b /fs/ocfs2/refcounttree.c
parentba2066351b630f0205ebf725f5c81a2a07a77cd7 (diff)
ocfs2: Set suballoc_loc on allocated metadata.
Get the suballoc_loc from ocfs2_claim_new_inode() or ocfs2_claim_metadata(). Store it on the appropriate field of the block we just allocated. Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/refcounttree.c')
-rw-r--r--fs/ocfs2/refcounttree.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 2bd74766c4e0..275920e8a40d 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(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);
@@ -1283,7 +1284,7 @@ static int ocfs2_expand_inline_ref_root(handle_t *handle,
1283 int ret; 1284 int ret;
1284 u16 suballoc_bit_start; 1285 u16 suballoc_bit_start;
1285 u32 num_got; 1286 u32 num_got;
1286 u64 blkno; 1287 u64 suballoc_loc, blkno;
1287 struct super_block *sb = ocfs2_metadata_cache_get_super(ci); 1288 struct super_block *sb = ocfs2_metadata_cache_get_super(ci);
1288 struct buffer_head *new_bh = NULL; 1289 struct buffer_head *new_bh = NULL;
1289 struct ocfs2_refcount_block *new_rb; 1290 struct ocfs2_refcount_block *new_rb;
@@ -1297,7 +1298,7 @@ static int ocfs2_expand_inline_ref_root(handle_t *handle,
1297 goto out; 1298 goto out;
1298 } 1299 }
1299 1300
1300 ret = ocfs2_claim_metadata(handle, meta_ac, 1, 1301 ret = ocfs2_claim_metadata(handle, meta_ac, 1, &suballoc_loc,
1301 &suballoc_bit_start, &num_got, 1302 &suballoc_bit_start, &num_got,
1302 &blkno); 1303 &blkno);
1303 if (ret) { 1304 if (ret) {
@@ -1329,6 +1330,7 @@ static int ocfs2_expand_inline_ref_root(handle_t *handle,
1329 1330
1330 new_rb = (struct ocfs2_refcount_block *)new_bh->b_data; 1331 new_rb = (struct ocfs2_refcount_block *)new_bh->b_data;
1331 new_rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); 1332 new_rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot);
1333 new_rb->rf_suballoc_loc = cpu_to_le64(suballoc_loc);
1332 new_rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); 1334 new_rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start);
1333 new_rb->rf_blkno = cpu_to_le64(blkno); 1335 new_rb->rf_blkno = cpu_to_le64(blkno);
1334 new_rb->rf_cpos = cpu_to_le32(0); 1336 new_rb->rf_cpos = cpu_to_le32(0);
@@ -1523,7 +1525,7 @@ static int ocfs2_new_leaf_refcount_block(handle_t *handle,
1523 int ret; 1525 int ret;
1524 u16 suballoc_bit_start; 1526 u16 suballoc_bit_start;
1525 u32 num_got, new_cpos; 1527 u32 num_got, new_cpos;
1526 u64 blkno; 1528 u64 suballoc_loc, blkno;
1527 struct super_block *sb = ocfs2_metadata_cache_get_super(ci); 1529 struct super_block *sb = ocfs2_metadata_cache_get_super(ci);
1528 struct ocfs2_refcount_block *root_rb = 1530 struct ocfs2_refcount_block *root_rb =
1529 (struct ocfs2_refcount_block *)ref_root_bh->b_data; 1531 (struct ocfs2_refcount_block *)ref_root_bh->b_data;
@@ -1547,7 +1549,7 @@ static int ocfs2_new_leaf_refcount_block(handle_t *handle,
1547 goto out; 1549 goto out;
1548 } 1550 }
1549 1551
1550 ret = ocfs2_claim_metadata(handle, meta_ac, 1, 1552 ret = ocfs2_claim_metadata(handle, meta_ac, 1, &suballoc_loc,
1551 &suballoc_bit_start, &num_got, 1553 &suballoc_bit_start, &num_got,
1552 &blkno); 1554 &blkno);
1553 if (ret) { 1555 if (ret) {
@@ -1575,6 +1577,7 @@ static int ocfs2_new_leaf_refcount_block(handle_t *handle,
1575 memset(new_rb, 0, sb->s_blocksize); 1577 memset(new_rb, 0, sb->s_blocksize);
1576 strcpy((void *)new_rb, OCFS2_REFCOUNT_BLOCK_SIGNATURE); 1578 strcpy((void *)new_rb, OCFS2_REFCOUNT_BLOCK_SIGNATURE);
1577 new_rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); 1579 new_rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot);
1580 new_rb->rf_suballoc_loc = cpu_to_le64(suballoc_loc);
1578 new_rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); 1581 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); 1582 new_rb->rf_fs_generation = cpu_to_le32(OCFS2_SB(sb)->fs_generation);
1580 new_rb->rf_blkno = cpu_to_le64(blkno); 1583 new_rb->rf_blkno = cpu_to_le64(blkno);