diff options
author | Tao Ma <tao.ma@oracle.com> | 2009-08-17 23:43:52 -0400 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2009-09-22 23:09:44 -0400 |
commit | a7fe7a3a1ab5dac8d81e531c060f51e12010133b (patch) | |
tree | 9eb5a21cc29e6913d3f591cdab37f59fbfa562d2 | |
parent | 8b2c0dba5159570af5721d40490f6c529d721500 (diff) |
ocfs2: Create an xattr indexed block if needed.
With reflink, there is a need that we create a new xattr indexed
block from the very beginning. So add a new parameter for
ocfs2_create_xattr_block.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
-rw-r--r-- | fs/ocfs2/xattr.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 6660f1c6149e..bb92a6d274c0 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -2142,7 +2142,8 @@ static int ocfs2_create_xattr_block(handle_t *handle, | |||
2142 | struct inode *inode, | 2142 | struct inode *inode, |
2143 | struct buffer_head *inode_bh, | 2143 | struct buffer_head *inode_bh, |
2144 | struct ocfs2_alloc_context *meta_ac, | 2144 | struct ocfs2_alloc_context *meta_ac, |
2145 | struct buffer_head **ret_bh) | 2145 | struct buffer_head **ret_bh, |
2146 | int indexed) | ||
2146 | { | 2147 | { |
2147 | int ret; | 2148 | int ret; |
2148 | u16 suballoc_bit_start; | 2149 | u16 suballoc_bit_start; |
@@ -2188,6 +2189,17 @@ static int ocfs2_create_xattr_block(handle_t *handle, | |||
2188 | xblk->xb_fs_generation = cpu_to_le32(osb->fs_generation); | 2189 | xblk->xb_fs_generation = cpu_to_le32(osb->fs_generation); |
2189 | xblk->xb_blkno = cpu_to_le64(first_blkno); | 2190 | xblk->xb_blkno = cpu_to_le64(first_blkno); |
2190 | 2191 | ||
2192 | if (indexed) { | ||
2193 | struct ocfs2_xattr_tree_root *xr = &xblk->xb_attrs.xb_root; | ||
2194 | xr->xt_clusters = cpu_to_le32(1); | ||
2195 | xr->xt_last_eb_blk = 0; | ||
2196 | xr->xt_list.l_tree_depth = 0; | ||
2197 | xr->xt_list.l_count = cpu_to_le16( | ||
2198 | ocfs2_xattr_recs_per_xb(inode->i_sb)); | ||
2199 | xr->xt_list.l_next_free_rec = cpu_to_le16(1); | ||
2200 | xblk->xb_flags = cpu_to_le16(OCFS2_XATTR_INDEXED); | ||
2201 | } | ||
2202 | |||
2191 | ret = ocfs2_journal_dirty(handle, new_bh); | 2203 | ret = ocfs2_journal_dirty(handle, new_bh); |
2192 | if (ret < 0) { | 2204 | if (ret < 0) { |
2193 | mlog_errno(ret); | 2205 | mlog_errno(ret); |
@@ -2222,7 +2234,7 @@ static int ocfs2_xattr_block_set(struct inode *inode, | |||
2222 | 2234 | ||
2223 | if (!xs->xattr_bh) { | 2235 | if (!xs->xattr_bh) { |
2224 | ret = ocfs2_create_xattr_block(handle, inode, xs->inode_bh, | 2236 | ret = ocfs2_create_xattr_block(handle, inode, xs->inode_bh, |
2225 | ctxt->meta_ac, &new_bh); | 2237 | ctxt->meta_ac, &new_bh, 0); |
2226 | if (ret) { | 2238 | if (ret) { |
2227 | mlog_errno(ret); | 2239 | mlog_errno(ret); |
2228 | goto end; | 2240 | goto end; |