aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/xattr.c
diff options
context:
space:
mode:
authorTao Ma <tao.ma@oracle.com>2008-11-05 19:10:47 -0500
committerMark Fasheh <mfasheh@suse.com>2009-01-05 11:34:18 -0500
commit1c32a2fd46ddc01bd86bff56a8f5d98c815750f4 (patch)
tree6451cd228d95d3c07dd5c557b286a7eec9a71614 /fs/ocfs2/xattr.c
parent02dbf38d19c19016f558fe0dc0c44f8041d3eb8e (diff)
ocfs2/xattr: Remove additional bucket allocation in bucket defragment.
Joel has refactored xattr bucket and make xattr bucket a general wrapper. So in ocfs2_defrag_xattr_bucket, we have already passed the bucket in, so there is no need to allocate a new one and read it. Signed-off-by: Tao Ma <tao.ma@oracle.com> Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/xattr.c')
-rw-r--r--fs/ocfs2/xattr.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 029a9f4559f1..87cf39ddfe5b 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -2898,7 +2898,6 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
2898 size_t blocksize = inode->i_sb->s_blocksize; 2898 size_t blocksize = inode->i_sb->s_blocksize;
2899 handle_t *handle; 2899 handle_t *handle;
2900 struct ocfs2_xattr_entry *xe; 2900 struct ocfs2_xattr_entry *xe;
2901 struct ocfs2_xattr_bucket *wb = NULL;
2902 2901
2903 /* 2902 /*
2904 * In order to make the operation more efficient and generic, 2903 * In order to make the operation more efficient and generic,
@@ -2912,21 +2911,11 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
2912 goto out; 2911 goto out;
2913 } 2912 }
2914 2913
2915 wb = ocfs2_xattr_bucket_new(inode);
2916 if (!wb) {
2917 ret = -ENOMEM;
2918 goto out;
2919 }
2920
2921 ret = ocfs2_read_xattr_bucket(wb, blkno);
2922 if (ret)
2923 goto out;
2924
2925 buf = bucket_buf; 2914 buf = bucket_buf;
2926 for (i = 0; i < wb->bu_blocks; i++, buf += blocksize) 2915 for (i = 0; i < bucket->bu_blocks; i++, buf += blocksize)
2927 memcpy(buf, bucket_block(wb, i), blocksize); 2916 memcpy(buf, bucket_block(bucket, i), blocksize);
2928 2917
2929 handle = ocfs2_start_trans((OCFS2_SB(inode->i_sb)), wb->bu_blocks); 2918 handle = ocfs2_start_trans((OCFS2_SB(inode->i_sb)), bucket->bu_blocks);
2930 if (IS_ERR(handle)) { 2919 if (IS_ERR(handle)) {
2931 ret = PTR_ERR(handle); 2920 ret = PTR_ERR(handle);
2932 handle = NULL; 2921 handle = NULL;
@@ -2934,7 +2923,7 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
2934 goto out; 2923 goto out;
2935 } 2924 }
2936 2925
2937 ret = ocfs2_xattr_bucket_journal_access(handle, wb, 2926 ret = ocfs2_xattr_bucket_journal_access(handle, bucket,
2938 OCFS2_JOURNAL_ACCESS_WRITE); 2927 OCFS2_JOURNAL_ACCESS_WRITE);
2939 if (ret < 0) { 2928 if (ret < 0) {
2940 mlog_errno(ret); 2929 mlog_errno(ret);
@@ -3007,14 +2996,13 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
3007 cmp_xe, swap_xe); 2996 cmp_xe, swap_xe);
3008 2997
3009 buf = bucket_buf; 2998 buf = bucket_buf;
3010 for (i = 0; i < wb->bu_blocks; i++, buf += blocksize) 2999 for (i = 0; i < bucket->bu_blocks; i++, buf += blocksize)
3011 memcpy(bucket_block(wb, i), buf, blocksize); 3000 memcpy(bucket_block(bucket, i), buf, blocksize);
3012 ocfs2_xattr_bucket_journal_dirty(handle, wb); 3001 ocfs2_xattr_bucket_journal_dirty(handle, bucket);
3013 3002
3014commit: 3003commit:
3015 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); 3004 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
3016out: 3005out:
3017 ocfs2_xattr_bucket_free(wb);
3018 kfree(bucket_buf); 3006 kfree(bucket_buf);
3019 return ret; 3007 return ret;
3020} 3008}