aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--fs/ocfs2/alloc.c4
-rw-r--r--fs/ocfs2/dir.c7
-rw-r--r--fs/ocfs2/namei.c6
-rw-r--r--fs/ocfs2/refcounttree.c15
-rw-r--r--fs/ocfs2/suballoc.c16
-rw-r--r--fs/ocfs2/suballoc.h2
-rw-r--r--fs/ocfs2/xattr.c7
7 files changed, 39 insertions, 18 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index b6e2ba1f6a7b..479d2ecae340 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -1006,7 +1006,7 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle,
1006 int count, status, i; 1006 int count, status, i;
1007 u16 suballoc_bit_start; 1007 u16 suballoc_bit_start;
1008 u32 num_got; 1008 u32 num_got;
1009 u64 first_blkno; 1009 u64 suballoc_loc, first_blkno;
1010 struct ocfs2_super *osb = 1010 struct ocfs2_super *osb =
1011 OCFS2_SB(ocfs2_metadata_cache_get_super(et->et_ci)); 1011 OCFS2_SB(ocfs2_metadata_cache_get_super(et->et_ci));
1012 struct ocfs2_extent_block *eb; 1012 struct ocfs2_extent_block *eb;
@@ -1018,6 +1018,7 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle,
1018 status = ocfs2_claim_metadata(handle, 1018 status = ocfs2_claim_metadata(handle,
1019 meta_ac, 1019 meta_ac,
1020 wanted - count, 1020 wanted - count,
1021 &suballoc_loc,
1021 &suballoc_bit_start, 1022 &suballoc_bit_start,
1022 &num_got, 1023 &num_got,
1023 &first_blkno); 1024 &first_blkno);
@@ -1051,6 +1052,7 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle,
1051 eb->h_fs_generation = cpu_to_le32(osb->fs_generation); 1052 eb->h_fs_generation = cpu_to_le32(osb->fs_generation);
1052 eb->h_suballoc_slot = 1053 eb->h_suballoc_slot =
1053 cpu_to_le16(meta_ac->ac_alloc_slot); 1054 cpu_to_le16(meta_ac->ac_alloc_slot);
1055 eb->h_suballoc_loc = cpu_to_le64(suballoc_loc);
1054 eb->h_suballoc_bit = cpu_to_le16(suballoc_bit_start); 1056 eb->h_suballoc_bit = cpu_to_le16(suballoc_bit_start);
1055 eb->h_list.l_count = 1057 eb->h_list.l_count =
1056 cpu_to_le16(ocfs2_extent_recs_per_eb(osb->sb)); 1058 cpu_to_le16(ocfs2_extent_recs_per_eb(osb->sb));
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index 02c3f2261550..341bb8f811e9 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -2395,15 +2395,15 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
2395 int ret; 2395 int ret;
2396 struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; 2396 struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data;
2397 u16 dr_suballoc_bit; 2397 u16 dr_suballoc_bit;
2398 u64 dr_blkno; 2398 u64 suballoc_loc, dr_blkno;
2399 unsigned int num_bits; 2399 unsigned int num_bits;
2400 struct buffer_head *dx_root_bh = NULL; 2400 struct buffer_head *dx_root_bh = NULL;
2401 struct ocfs2_dx_root_block *dx_root; 2401 struct ocfs2_dx_root_block *dx_root;
2402 struct ocfs2_dir_block_trailer *trailer = 2402 struct ocfs2_dir_block_trailer *trailer =
2403 ocfs2_trailer_from_bh(dirdata_bh, dir->i_sb); 2403 ocfs2_trailer_from_bh(dirdata_bh, dir->i_sb);
2404 2404
2405 ret = ocfs2_claim_metadata(handle, meta_ac, 1, &dr_suballoc_bit, 2405 ret = ocfs2_claim_metadata(handle, meta_ac, 1, &suballoc_loc,
2406 &num_bits, &dr_blkno); 2406 &dr_suballoc_bit, &num_bits, &dr_blkno);
2407 if (ret) { 2407 if (ret) {
2408 mlog_errno(ret); 2408 mlog_errno(ret);
2409 goto out; 2409 goto out;
@@ -2431,6 +2431,7 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
2431 memset(dx_root, 0, osb->sb->s_blocksize); 2431 memset(dx_root, 0, osb->sb->s_blocksize);
2432 strcpy(dx_root->dr_signature, OCFS2_DX_ROOT_SIGNATURE); 2432 strcpy(dx_root->dr_signature, OCFS2_DX_ROOT_SIGNATURE);
2433 dx_root->dr_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); 2433 dx_root->dr_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot);
2434 dx_root->dr_suballoc_loc = cpu_to_le64(suballoc_loc);
2434 dx_root->dr_suballoc_bit = cpu_to_le16(dr_suballoc_bit); 2435 dx_root->dr_suballoc_bit = cpu_to_le16(dr_suballoc_bit);
2435 dx_root->dr_fs_generation = cpu_to_le32(osb->fs_generation); 2436 dx_root->dr_fs_generation = cpu_to_le32(osb->fs_generation);
2436 dx_root->dr_blkno = cpu_to_le64(dr_blkno); 2437 dx_root->dr_blkno = cpu_to_le64(dr_blkno);
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index e5434a04b88a..bfe4571a4fa1 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -472,14 +472,15 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
472 int status = 0; 472 int status = 0;
473 struct ocfs2_dinode *fe = NULL; 473 struct ocfs2_dinode *fe = NULL;
474 struct ocfs2_extent_list *fel; 474 struct ocfs2_extent_list *fel;
475 u64 fe_blkno = 0; 475 u64 suballoc_loc, fe_blkno = 0;
476 u16 suballoc_bit; 476 u16 suballoc_bit;
477 u16 feat; 477 u16 feat;
478 478
479 *new_fe_bh = NULL; 479 *new_fe_bh = NULL;
480 480
481 status = ocfs2_claim_new_inode(handle, dir, parent_fe_bh, 481 status = ocfs2_claim_new_inode(handle, dir, parent_fe_bh,
482 inode_ac, &suballoc_bit, &fe_blkno); 482 inode_ac, &suballoc_loc,
483 &suballoc_bit, &fe_blkno);
483 if (status < 0) { 484 if (status < 0) {
484 mlog_errno(status); 485 mlog_errno(status);
485 goto leave; 486 goto leave;
@@ -516,6 +517,7 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
516 fe->i_generation = cpu_to_le32(inode->i_generation); 517 fe->i_generation = cpu_to_le32(inode->i_generation);
517 fe->i_fs_generation = cpu_to_le32(osb->fs_generation); 518 fe->i_fs_generation = cpu_to_le32(osb->fs_generation);
518 fe->i_blkno = cpu_to_le64(fe_blkno); 519 fe->i_blkno = cpu_to_le64(fe_blkno);
520 fe->i_suballoc_loc = cpu_to_le64(suballoc_loc);
519 fe->i_suballoc_bit = cpu_to_le16(suballoc_bit); 521 fe->i_suballoc_bit = cpu_to_le16(suballoc_bit);
520 fe->i_suballoc_slot = cpu_to_le16(inode_ac->ac_alloc_slot); 522 fe->i_suballoc_slot = cpu_to_le16(inode_ac->ac_alloc_slot);
521 fe->i_uid = cpu_to_le32(inode->i_uid); 523 fe->i_uid = cpu_to_le32(inode->i_uid);
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);
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index 9c2e669a74fa..7809f41bcbfc 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -54,7 +54,9 @@
54#define OCFS2_MAX_TO_STEAL 1024 54#define OCFS2_MAX_TO_STEAL 1024
55 55
56struct ocfs2_suballoc_result { 56struct ocfs2_suballoc_result {
57 u64 sr_bg_blkno; /* The bg we allocated from */ 57 u64 sr_bg_blkno; /* The bg we allocated from. Set
58 to 0 when a block group is
59 contiguous. */
58 u64 sr_blkno; /* The first allocated block */ 60 u64 sr_blkno; /* The first allocated block */
59 unsigned int sr_bit_offset; /* The bit in the bg */ 61 unsigned int sr_bit_offset; /* The bit in the bg */
60 unsigned int sr_bits; /* How many bits we claimed */ 62 unsigned int sr_bits; /* How many bits we claimed */
@@ -1604,6 +1606,7 @@ static void ocfs2_bg_discontig_fix_result(struct ocfs2_alloc_context *ac,
1604 struct ocfs2_suballoc_result *res) 1606 struct ocfs2_suballoc_result *res)
1605{ 1607{
1606 int i; 1608 int i;
1609 u64 bg_blkno = res->sr_bg_blkno; /* Save off */
1607 struct ocfs2_extent_rec *rec; 1610 struct ocfs2_extent_rec *rec;
1608 struct ocfs2_dinode *di = (struct ocfs2_dinode *)ac->ac_bh->b_data; 1611 struct ocfs2_dinode *di = (struct ocfs2_dinode *)ac->ac_bh->b_data;
1609 struct ocfs2_chain_list *cl = &di->id2.i_chain; 1612 struct ocfs2_chain_list *cl = &di->id2.i_chain;
@@ -1614,14 +1617,17 @@ static void ocfs2_bg_discontig_fix_result(struct ocfs2_alloc_context *ac,
1614 } 1617 }
1615 1618
1616 res->sr_blkno = res->sr_bg_blkno + res->sr_bit_offset; 1619 res->sr_blkno = res->sr_bg_blkno + res->sr_bit_offset;
1620 res->sr_bg_blkno = 0; /* Clear it for contig block groups */
1617 if (!ocfs2_supports_discontig_bh(OCFS2_SB(ac->ac_inode->i_sb)) || 1621 if (!ocfs2_supports_discontig_bh(OCFS2_SB(ac->ac_inode->i_sb)) ||
1618 !bg->bg_list.l_next_free_rec) 1622 !bg->bg_list.l_next_free_rec)
1619 return; 1623 return;
1620 1624
1621 for (i = 0; i < le16_to_cpu(bg->bg_list.l_next_free_rec); i++) { 1625 for (i = 0; i < le16_to_cpu(bg->bg_list.l_next_free_rec); i++) {
1622 rec = &bg->bg_list.l_recs[i]; 1626 rec = &bg->bg_list.l_recs[i];
1623 if (ocfs2_bg_discontig_fix_by_rec(res, rec, cl)) 1627 if (ocfs2_bg_discontig_fix_by_rec(res, rec, cl)) {
1628 res->sr_bg_blkno = bg_blkno; /* Restore */
1624 break; 1629 break;
1630 }
1625 } 1631 }
1626} 1632}
1627 1633
@@ -1926,6 +1932,7 @@ bail:
1926int ocfs2_claim_metadata(handle_t *handle, 1932int ocfs2_claim_metadata(handle_t *handle,
1927 struct ocfs2_alloc_context *ac, 1933 struct ocfs2_alloc_context *ac,
1928 u32 bits_wanted, 1934 u32 bits_wanted,
1935 u64 *suballoc_loc,
1929 u16 *suballoc_bit_start, 1936 u16 *suballoc_bit_start,
1930 unsigned int *num_bits, 1937 unsigned int *num_bits,
1931 u64 *blkno_start) 1938 u64 *blkno_start)
@@ -1948,6 +1955,7 @@ int ocfs2_claim_metadata(handle_t *handle,
1948 } 1955 }
1949 atomic_inc(&OCFS2_SB(ac->ac_inode->i_sb)->alloc_stats.bg_allocs); 1956 atomic_inc(&OCFS2_SB(ac->ac_inode->i_sb)->alloc_stats.bg_allocs);
1950 1957
1958 *suballoc_loc = res.sr_bg_blkno;
1951 *suballoc_bit_start = res.sr_bit_offset; 1959 *suballoc_bit_start = res.sr_bit_offset;
1952 *blkno_start = res.sr_blkno; 1960 *blkno_start = res.sr_blkno;
1953 ac->ac_bits_given += res.sr_bits; 1961 ac->ac_bits_given += res.sr_bits;
@@ -1993,11 +2001,12 @@ int ocfs2_claim_new_inode(handle_t *handle,
1993 struct inode *dir, 2001 struct inode *dir,
1994 struct buffer_head *parent_fe_bh, 2002 struct buffer_head *parent_fe_bh,
1995 struct ocfs2_alloc_context *ac, 2003 struct ocfs2_alloc_context *ac,
2004 u64 *suballoc_loc,
1996 u16 *suballoc_bit, 2005 u16 *suballoc_bit,
1997 u64 *fe_blkno) 2006 u64 *fe_blkno)
1998{ 2007{
1999 int status; 2008 int status;
2000 struct ocfs2_suballoc_result res = { .sr_blkno = 0, }; 2009 struct ocfs2_suballoc_result res;
2001 2010
2002 mlog_entry_void(); 2011 mlog_entry_void();
2003 2012
@@ -2021,6 +2030,7 @@ int ocfs2_claim_new_inode(handle_t *handle,
2021 2030
2022 BUG_ON(res.sr_bits != 1); 2031 BUG_ON(res.sr_bits != 1);
2023 2032
2033 *suballoc_loc = res.sr_bg_blkno;
2024 *suballoc_bit = res.sr_bit_offset; 2034 *suballoc_bit = res.sr_bit_offset;
2025 *fe_blkno = res.sr_blkno; 2035 *fe_blkno = res.sr_blkno;
2026 ac->ac_bits_given++; 2036 ac->ac_bits_given++;
diff --git a/fs/ocfs2/suballoc.h b/fs/ocfs2/suballoc.h
index 49b0b22d30cf..a017dd3ee7d9 100644
--- a/fs/ocfs2/suballoc.h
+++ b/fs/ocfs2/suballoc.h
@@ -86,6 +86,7 @@ int ocfs2_reserve_clusters(struct ocfs2_super *osb,
86int ocfs2_claim_metadata(handle_t *handle, 86int ocfs2_claim_metadata(handle_t *handle,
87 struct ocfs2_alloc_context *ac, 87 struct ocfs2_alloc_context *ac,
88 u32 bits_wanted, 88 u32 bits_wanted,
89 u64 *suballoc_loc,
89 u16 *suballoc_bit_start, 90 u16 *suballoc_bit_start,
90 u32 *num_bits, 91 u32 *num_bits,
91 u64 *blkno_start); 92 u64 *blkno_start);
@@ -93,6 +94,7 @@ int ocfs2_claim_new_inode(handle_t *handle,
93 struct inode *dir, 94 struct inode *dir,
94 struct buffer_head *parent_fe_bh, 95 struct buffer_head *parent_fe_bh,
95 struct ocfs2_alloc_context *ac, 96 struct ocfs2_alloc_context *ac,
97 u64 *suballoc_loc,
96 u16 *suballoc_bit, 98 u16 *suballoc_bit,
97 u64 *fe_blkno); 99 u64 *fe_blkno);
98int ocfs2_claim_clusters(handle_t *handle, 100int ocfs2_claim_clusters(handle_t *handle,
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 2f6fd48c0ba4..805167e226c1 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -2829,7 +2829,7 @@ static int ocfs2_create_xattr_block(struct inode *inode,
2829 int ret; 2829 int ret;
2830 u16 suballoc_bit_start; 2830 u16 suballoc_bit_start;
2831 u32 num_got; 2831 u32 num_got;
2832 u64 first_blkno; 2832 u64 suballoc_loc, first_blkno;
2833 struct ocfs2_dinode *di = (struct ocfs2_dinode *)inode_bh->b_data; 2833 struct ocfs2_dinode *di = (struct ocfs2_dinode *)inode_bh->b_data;
2834 struct buffer_head *new_bh = NULL; 2834 struct buffer_head *new_bh = NULL;
2835 struct ocfs2_xattr_block *xblk; 2835 struct ocfs2_xattr_block *xblk;
@@ -2842,8 +2842,8 @@ static int ocfs2_create_xattr_block(struct inode *inode,
2842 } 2842 }
2843 2843
2844 ret = ocfs2_claim_metadata(ctxt->handle, ctxt->meta_ac, 1, 2844 ret = ocfs2_claim_metadata(ctxt->handle, ctxt->meta_ac, 1,
2845 &suballoc_bit_start, &num_got, 2845 &suballoc_loc, &suballoc_bit_start,
2846 &first_blkno); 2846 &num_got, &first_blkno);
2847 if (ret < 0) { 2847 if (ret < 0) {
2848 mlog_errno(ret); 2848 mlog_errno(ret);
2849 goto end; 2849 goto end;
@@ -2865,6 +2865,7 @@ static int ocfs2_create_xattr_block(struct inode *inode,
2865 memset(xblk, 0, inode->i_sb->s_blocksize); 2865 memset(xblk, 0, inode->i_sb->s_blocksize);
2866 strcpy((void *)xblk, OCFS2_XATTR_BLOCK_SIGNATURE); 2866 strcpy((void *)xblk, OCFS2_XATTR_BLOCK_SIGNATURE);
2867 xblk->xb_suballoc_slot = cpu_to_le16(ctxt->meta_ac->ac_alloc_slot); 2867 xblk->xb_suballoc_slot = cpu_to_le16(ctxt->meta_ac->ac_alloc_slot);
2868 xblk->xb_suballoc_loc = cpu_to_le64(suballoc_loc);
2868 xblk->xb_suballoc_bit = cpu_to_le16(suballoc_bit_start); 2869 xblk->xb_suballoc_bit = cpu_to_le16(suballoc_bit_start);
2869 xblk->xb_fs_generation = 2870 xblk->xb_fs_generation =
2870 cpu_to_le32(OCFS2_SB(inode->i_sb)->fs_generation); 2871 cpu_to_le32(OCFS2_SB(inode->i_sb)->fs_generation);