]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.25/patches.fixes/ocfs2-Don-t-repeat-ocfs2_xattr_block_find.patch
Updated xen patches taken from suse.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.fixes / ocfs2-Don-t-repeat-ocfs2_xattr_block_find.patch
CommitLineData
00e5a55c
BS
1From: Joel Becker <joel.becker@oracle.com>
2Date: Mon, 20 Oct 2008 18:43:07 -0700
3Subject: ocfs2: Don't repeat ocfs2_xattr_block_find()
4
5ocfs2_xattr_block_get() looks up the xattr in a startlingly familiar
6way; it's identical to the function ocfs2_xattr_block_find(). Let's just
7use the later in the former.
8
9Signed-off-by: Joel Becker <joel.becker@oracle.com>
10Signed-off-by: Mark Fasheh <mfasheh@suse.com>
11---
12 fs/ocfs2/xattr.c | 39 +++++++++------------------------------
13 1 files changed, 9 insertions(+), 30 deletions(-)
14
15Index: linux-2.6.27-ocfs2/fs/ocfs2/xattr.c
16===================================================================
17--- linux-2.6.27-ocfs2.orig/fs/ocfs2/xattr.c
18+++ linux-2.6.27-ocfs2/fs/ocfs2/xattr.c
19@@ -111,6 +111,10 @@ static int ocfs2_xattr_bucket_get_name_v
20 int *block_off,
21 int *new_offset);
22
23+static int ocfs2_xattr_block_find(struct inode *inode,
24+ int name_index,
25+ const char *name,
26+ struct ocfs2_xattr_search *xs);
27 static int ocfs2_xattr_index_block_find(struct inode *inode,
28 struct buffer_head *root_bh,
29 int name_index,
30@@ -760,46 +764,20 @@ static int ocfs2_xattr_block_get(struct
31 size_t buffer_size,
32 struct ocfs2_xattr_search *xs)
33 {
34- struct ocfs2_dinode *di = (struct ocfs2_dinode *)xs->inode_bh->b_data;
35- struct buffer_head *blk_bh = NULL;
36 struct ocfs2_xattr_block *xb;
37 struct ocfs2_xattr_value_root *xv;
38 size_t size;
39 int ret = -ENODATA, name_offset, name_len, block_off, i;
40
41- if (!di->i_xattr_loc)
42- return ret;
43-
44 memset(&xs->bucket, 0, sizeof(xs->bucket));
45
46- ret = ocfs2_read_block(inode, le64_to_cpu(di->i_xattr_loc), &blk_bh);
47- if (ret < 0) {
48+ ret = ocfs2_xattr_block_find(inode, name_index, name, xs);
49+ if (ret) {
50 mlog_errno(ret);
51- return ret;
52- }
53-
54- xb = (struct ocfs2_xattr_block *)blk_bh->b_data;
55- if (!OCFS2_IS_VALID_XATTR_BLOCK(xb)) {
56- ret = -EIO;
57 goto cleanup;
58 }
59
60- xs->xattr_bh = blk_bh;
61-
62- if (!(le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED)) {
63- xs->header = &xb->xb_attrs.xb_header;
64- xs->base = (void *)xs->header;
65- xs->end = (void *)(blk_bh->b_data) + blk_bh->b_size;
66- xs->here = xs->header->xh_entries;
67-
68- ret = ocfs2_xattr_find_entry(name_index, name, xs);
69- } else
70- ret = ocfs2_xattr_index_block_find(inode, blk_bh,
71- name_index,
72- name, xs);
73-
74- if (ret)
75- goto cleanup;
76+ xb = (struct ocfs2_xattr_block *)xs->xattr_bh->b_data;
77 size = le64_to_cpu(xs->here->xe_value_size);
78 if (buffer) {
79 ret = -ERANGE;
80@@ -838,7 +816,8 @@ cleanup:
81 brelse(xs->bucket.bhs[i]);
82 memset(&xs->bucket, 0, sizeof(xs->bucket));
83
84- brelse(blk_bh);
85+ brelse(xs->xattr_bh);
86+ xs->xattr_bh = NULL;
87 return ret;
88 }
89