]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.suse/ocfs2-Convenient-access-to-an-xattr-bucket-s-block.patch
Updated xen patches taken from suse.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.suse / ocfs2-Convenient-access-to-an-xattr-bucket-s-block.patch
1 From: Joel Becker <joel.becker@oracle.com>
2 Date: Fri, 24 Oct 2008 16:21:03 -0700
3 Subject: ocfs2: Convenient access to an xattr bucket's block number.
4 Patch-mainline: 2.6.29
5
6 The xattr code often wants to know the block number of an xattr bucket.
7 This is usually found by dereferencing the first bh hanging off of the
8 ocfs2_xattr_bucket structure. Rather than do this all the time, let's
9 provide a nice little macro. The idea is ripped from the ocfs2_path
10 code.
11
12 Signed-off-by: Joel Becker <joel.becker@oracle.com>
13 Signed-off-by: Mark Fasheh <mfasheh@suse.com>
14 ---
15 fs/ocfs2/xattr.c | 20 +++++++++++---------
16 1 files changed, 11 insertions(+), 9 deletions(-)
17
18 diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
19 index 9c0ee42..3cf8e80 100644
20 --- a/fs/ocfs2/xattr.c
21 +++ b/fs/ocfs2/xattr.c
22 @@ -154,6 +154,8 @@ static inline u16 ocfs2_xattr_max_xe_in_bucket(struct super_block *sb)
23 return len / sizeof(struct ocfs2_xattr_entry);
24 }
25
26 +#define bucket_blkno(_b) ((_b)->bu_bhs[0]->b_blocknr)
27 +
28 static inline const char *ocfs2_xattr_prefix(int name_index)
29 {
30 struct xattr_handler *handler = NULL;
31 @@ -2290,7 +2292,7 @@ static int ocfs2_xattr_bucket_find(struct inode *inode,
32 * If we have found the xattr enty, read all the blocks in
33 * this bucket.
34 */
35 - ret = ocfs2_read_blocks(inode, xs->bucket.bu_bhs[0]->b_blocknr + 1,
36 + ret = ocfs2_read_blocks(inode, bucket_blkno(&xs->bucket) + 1,
37 blk_per_bucket - 1, &xs->bucket.bu_bhs[1],
38 0);
39 if (ret) {
40 @@ -2300,7 +2302,7 @@ static int ocfs2_xattr_bucket_find(struct inode *inode,
41
42 xs->here = &xs->header->xh_entries[index];
43 mlog(0, "find xattr %s in bucket %llu, entry = %u\n", name,
44 - (unsigned long long)xs->bucket.bu_bhs[0]->b_blocknr, index);
45 + (unsigned long long)bucket_blkno(&xs->bucket), index);
46 } else
47 ret = -ENODATA;
48
49 @@ -2637,7 +2639,7 @@ static int ocfs2_xattr_update_xattr_search(struct inode *inode,
50 if (!xs->not_found) {
51 if (OCFS2_XATTR_BUCKET_SIZE != blocksize) {
52 ret = ocfs2_read_blocks(inode,
53 - xs->bucket.bu_bhs[0]->b_blocknr + 1,
54 + bucket_blkno(&xs->bucket) + 1,
55 blk_per_bucket - 1, &xs->bucket.bu_bhs[1],
56 0);
57 if (ret) {
58 @@ -2835,7 +2837,7 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
59 size_t end, offset, len, value_len;
60 struct ocfs2_xattr_header *xh;
61 char *entries, *buf, *bucket_buf = NULL;
62 - u64 blkno = bucket->bu_bhs[0]->b_blocknr;
63 + u64 blkno = bucket_blkno(bucket);
64 u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
65 u16 xh_free_start;
66 size_t blocksize = inode->i_sb->s_blocksize;
67 @@ -4124,11 +4126,11 @@ static int ocfs2_xattr_set_entry_in_bucket(struct inode *inode,
68
69 mlog(0, "Set xattr entry len = %lu index = %d in bucket %llu\n",
70 (unsigned long)xi->value_len, xi->name_index,
71 - (unsigned long long)xs->bucket.bu_bhs[0]->b_blocknr);
72 + (unsigned long long)bucket_blkno(&xs->bucket));
73
74 if (!xs->bucket.bu_bhs[1]) {
75 ret = ocfs2_read_blocks(inode,
76 - xs->bucket.bu_bhs[0]->b_blocknr + 1,
77 + bucket_blkno(&xs->bucket) + 1,
78 blk_per_bucket - 1, &xs->bucket.bu_bhs[1],
79 0);
80 if (ret) {
81 @@ -4540,7 +4542,7 @@ static int ocfs2_check_xattr_bucket_collision(struct inode *inode,
82 xh->xh_entries[0].xe_name_hash) {
83 mlog(ML_ERROR, "Too much hash collision in xattr bucket %llu, "
84 "hash = %u\n",
85 - (unsigned long long)bucket->bu_bhs[0]->b_blocknr,
86 + (unsigned long long)bucket_blkno(bucket),
87 le32_to_cpu(xh->xh_entries[0].xe_name_hash));
88 return -ENOSPC;
89 }
90 @@ -4574,7 +4576,7 @@ try_again:
91
92 mlog_bug_on_msg(header_size > blocksize, "bucket %llu has header size "
93 "of %u which exceed block size\n",
94 - (unsigned long long)xs->bucket.bu_bhs[0]->b_blocknr,
95 + (unsigned long long)bucket_blkno(&xs->bucket),
96 header_size);
97
98 if (xi->value && xi->value_len > OCFS2_XATTR_INLINE_SIZE)
99 @@ -4614,7 +4616,7 @@ try_again:
100 mlog(0, "xs->not_found = %d, in xattr bucket %llu: free = %d, "
101 "need = %d, max_free = %d, xh_free_start = %u, xh_name_value_len ="
102 " %u\n", xs->not_found,
103 - (unsigned long long)xs->bucket.bu_bhs[0]->b_blocknr,
104 + (unsigned long long)bucket_blkno(&xs->bucket),
105 free, need, max_free, le16_to_cpu(xh->xh_free_start),
106 le16_to_cpu(xh->xh_name_value_len));
107
108 --
109 1.5.6
110