]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.suse/ocfs2-xattr-Remove-additional-bucket-allocation-in.patch
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.suse / ocfs2-xattr-Remove-additional-bucket-allocation-in.patch
CommitLineData
2cb7cef9
BS
1From: Tao Ma <tao.ma@oracle.com>
2Date: Thu, 6 Nov 2008 08:10:47 +0800
3Subject: ocfs2/xattr: Remove additional bucket allocation in bucket defragment.
4Patch-mainline: 2.6.29
5
6Joel has refactored xattr bucket and make xattr bucket a general
7wrapper. So in ocfs2_defrag_xattr_bucket, we have already passed the
8bucket in, so there is no need to allocate a new one and read it.
9
10Signed-off-by: Tao Ma <tao.ma@oracle.com>
11Signed-off-by: Joel Becker <joel.becker@oracle.com>
12Signed-off-by: Mark Fasheh <mfasheh@suse.com>
13---
14 fs/ocfs2/xattr.c | 26 +++++++-------------------
15 1 files changed, 7 insertions(+), 19 deletions(-)
16
17diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
18index 029a9f4..87cf39d 100644
19--- a/fs/ocfs2/xattr.c
20+++ b/fs/ocfs2/xattr.c
21@@ -2898,7 +2898,6 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
22 size_t blocksize = inode->i_sb->s_blocksize;
23 handle_t *handle;
24 struct ocfs2_xattr_entry *xe;
25- struct ocfs2_xattr_bucket *wb = NULL;
26
27 /*
28 * In order to make the operation more efficient and generic,
29@@ -2912,21 +2911,11 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
30 goto out;
31 }
32
33- wb = ocfs2_xattr_bucket_new(inode);
34- if (!wb) {
35- ret = -ENOMEM;
36- goto out;
37- }
38-
39- ret = ocfs2_read_xattr_bucket(wb, blkno);
40- if (ret)
41- goto out;
42-
43 buf = bucket_buf;
44- for (i = 0; i < wb->bu_blocks; i++, buf += blocksize)
45- memcpy(buf, bucket_block(wb, i), blocksize);
46+ for (i = 0; i < bucket->bu_blocks; i++, buf += blocksize)
47+ memcpy(buf, bucket_block(bucket, i), blocksize);
48
49- handle = ocfs2_start_trans((OCFS2_SB(inode->i_sb)), wb->bu_blocks);
50+ handle = ocfs2_start_trans((OCFS2_SB(inode->i_sb)), bucket->bu_blocks);
51 if (IS_ERR(handle)) {
52 ret = PTR_ERR(handle);
53 handle = NULL;
54@@ -2934,7 +2923,7 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
55 goto out;
56 }
57
58- ret = ocfs2_xattr_bucket_journal_access(handle, wb,
59+ ret = ocfs2_xattr_bucket_journal_access(handle, bucket,
60 OCFS2_JOURNAL_ACCESS_WRITE);
61 if (ret < 0) {
62 mlog_errno(ret);
63@@ -3007,14 +2996,13 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
64 cmp_xe, swap_xe);
65
66 buf = bucket_buf;
67- for (i = 0; i < wb->bu_blocks; i++, buf += blocksize)
68- memcpy(bucket_block(wb, i), buf, blocksize);
69- ocfs2_xattr_bucket_journal_dirty(handle, wb);
70+ for (i = 0; i < bucket->bu_blocks; i++, buf += blocksize)
71+ memcpy(bucket_block(bucket, i), buf, blocksize);
72+ ocfs2_xattr_bucket_journal_dirty(handle, bucket);
73
74 commit:
75 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
76 out:
77- ocfs2_xattr_bucket_free(wb);
78 kfree(bucket_buf);
79 return ret;
80 }
81--
821.5.6
83