]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.suse/ocfs2-Provide-a-wrapper-to-brelse-xattr-bucket-bu.patch
Updated xen patches taken from suse.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.suse / ocfs2-Provide-a-wrapper-to-brelse-xattr-bucket-bu.patch
1 From: Joel Becker <joel.becker@oracle.com>
2 Date: Fri, 24 Oct 2008 17:16:48 -0700
3 Subject: ocfs2: Provide a wrapper to brelse() xattr bucket buffers.
4 Patch-mainline: 2.6.29
5
6 A common theme is walking all the buffer heads on an ocfs2_xattr_bucket
7 and releasing them. Let's wrap that.
8
9 Signed-off-by: Joel Becker <joel.becker@oracle.com>
10 Signed-off-by: Mark Fasheh <mfasheh@suse.com>
11 ---
12 fs/ocfs2/xattr.c | 33 ++++++++++++++++++---------------
13 1 files changed, 18 insertions(+), 15 deletions(-)
14
15 diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
16 index 1b77302..3478ad1 100644
17 --- a/fs/ocfs2/xattr.c
18 +++ b/fs/ocfs2/xattr.c
19 @@ -157,6 +157,17 @@ static inline u16 ocfs2_xattr_max_xe_in_bucket(struct super_block *sb)
20 #define bucket_block(_b, _n) ((_b)->bu_bhs[(_n)]->b_data)
21 #define bucket_xh(_b) ((struct ocfs2_xattr_header *)bucket_block((_b), 0))
22
23 +static void ocfs2_xattr_bucket_relse(struct inode *inode,
24 + struct ocfs2_xattr_bucket *bucket)
25 +{
26 + int i, blks = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
27 +
28 + for (i = 0; i < blks; i++) {
29 + brelse(bucket->bu_bhs[i]);
30 + bucket->bu_bhs[i] = NULL;
31 + }
32 +}
33 +
34 static inline const char *ocfs2_xattr_prefix(int name_index)
35 {
36 struct xattr_handler *handler = NULL;
37 @@ -820,8 +831,7 @@ static int ocfs2_xattr_block_get(struct inode *inode,
38 }
39 ret = size;
40 cleanup:
41 - for (i = 0; i < OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET; i++)
42 - brelse(xs->bucket.bu_bhs[i]);
43 + ocfs2_xattr_bucket_relse(inode, &xs->bucket);
44 memset(&xs->bucket, 0, sizeof(xs->bucket));
45
46 brelse(xs->xattr_bh);
47 @@ -1932,7 +1942,6 @@ int ocfs2_xattr_set(struct inode *inode,
48 struct buffer_head *di_bh = NULL;
49 struct ocfs2_dinode *di;
50 int ret;
51 - u16 i, blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
52
53 struct ocfs2_xattr_info xi = {
54 .name_index = name_index,
55 @@ -2034,8 +2043,7 @@ cleanup:
56 ocfs2_inode_unlock(inode, 1);
57 brelse(di_bh);
58 brelse(xbs.xattr_bh);
59 - for (i = 0; i < blk_per_bucket; i++)
60 - brelse(xbs.bucket.bu_bhs[i]);
61 + ocfs2_xattr_bucket_relse(inode, &xbs.bucket);
62
63 return ret;
64 }
65 @@ -2358,7 +2366,7 @@ static int ocfs2_iterate_xattr_buckets(struct inode *inode,
66 xattr_bucket_func *func,
67 void *para)
68 {
69 - int i, j, ret = 0;
70 + int i, ret = 0;
71 int blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
72 u32 bpc = ocfs2_xattr_buckets_per_cluster(OCFS2_SB(inode->i_sb));
73 u32 num_buckets = clusters * bpc;
74 @@ -2395,14 +2403,12 @@ static int ocfs2_iterate_xattr_buckets(struct inode *inode,
75 }
76 }
77
78 - for (j = 0; j < blk_per_bucket; j++)
79 - brelse(bucket.bu_bhs[j]);
80 + ocfs2_xattr_bucket_relse(inode, &bucket);
81 memset(&bucket, 0, sizeof(bucket));
82 }
83
84 out:
85 - for (j = 0; j < blk_per_bucket; j++)
86 - brelse(bucket.bu_bhs[j]);
87 + ocfs2_xattr_bucket_relse(inode, &bucket);
88
89 return ret;
90 }
91 @@ -4554,11 +4560,10 @@ static int ocfs2_xattr_set_entry_index_block(struct inode *inode,
92 struct ocfs2_xattr_header *xh;
93 struct ocfs2_xattr_entry *xe;
94 u16 count, header_size, xh_free_start;
95 - int i, free, max_free, need, old;
96 + int free, max_free, need, old;
97 size_t value_size = 0, name_len = strlen(xi->name);
98 size_t blocksize = inode->i_sb->s_blocksize;
99 int ret, allocation = 0;
100 - u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
101
102 mlog_entry("Set xattr %s in xattr index block\n", xi->name);
103
104 @@ -4672,9 +4677,7 @@ try_again:
105 goto out;
106 }
107
108 - for (i = 0; i < blk_per_bucket; i++)
109 - brelse(xs->bucket.bu_bhs[i]);
110 -
111 + ocfs2_xattr_bucket_relse(inode, &xs->bucket);
112 memset(&xs->bucket, 0, sizeof(xs->bucket));
113
114 ret = ocfs2_xattr_index_block_find(inode, xs->xattr_bh,
115 --
116 1.5.6
117