1 From: Joel Becker <joel.becker@oracle.com>
2 Date: Mon, 20 Oct 2008 18:43:07 -0700
3 Subject: ocfs2: Don't repeat ocfs2_xattr_block_find()
5 ocfs2_xattr_block_get() looks up the xattr in a startlingly familiar
6 way; it's identical to the function ocfs2_xattr_block_find(). Let's just
7 use the later in the former.
9 Signed-off-by: Joel Becker <joel.becker@oracle.com>
10 Signed-off-by: Mark Fasheh <mfasheh@suse.com>
12 fs/ocfs2/xattr.c | 39 +++++++++------------------------------
13 1 files changed, 9 insertions(+), 30 deletions(-)
15 Index: 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
23 +static int ocfs2_xattr_block_find(struct inode *inode,
26 + struct ocfs2_xattr_search *xs);
27 static int ocfs2_xattr_index_block_find(struct inode *inode,
28 struct buffer_head *root_bh,
30 @@ -760,46 +764,20 @@ static int ocfs2_xattr_block_get(struct
32 struct ocfs2_xattr_search *xs)
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;
39 int ret = -ENODATA, name_offset, name_len, block_off, i;
41 - if (!di->i_xattr_loc)
44 memset(&xs->bucket, 0, sizeof(xs->bucket));
46 - ret = ocfs2_read_block(inode, le64_to_cpu(di->i_xattr_loc), &blk_bh);
48 + ret = ocfs2_xattr_block_find(inode, name_index, name, xs);
54 - xb = (struct ocfs2_xattr_block *)blk_bh->b_data;
55 - if (!OCFS2_IS_VALID_XATTR_BLOCK(xb)) {
60 - xs->xattr_bh = blk_bh;
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;
68 - ret = ocfs2_xattr_find_entry(name_index, name, xs);
70 - ret = ocfs2_xattr_index_block_find(inode, blk_bh,
76 + xb = (struct ocfs2_xattr_block *)xs->xattr_bh->b_data;
77 size = le64_to_cpu(xs->here->xe_value_size);
80 @@ -838,7 +816,8 @@ cleanup:
81 brelse(xs->bucket.bhs[i]);
82 memset(&xs->bucket, 0, sizeof(xs->bucket));
85 + brelse(xs->xattr_bh);
86 + xs->xattr_bh = NULL;