]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.suse/ocfs2-add-ocfs2_xattr_set_handle.patch
Updated xen patches taken from suse.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.suse / ocfs2-add-ocfs2_xattr_set_handle.patch
1 From: Tiger Yang <tiger.yang@oracle.com>
2 Date: Fri, 14 Nov 2008 11:16:03 +0800
3 Subject: ocfs2: add ocfs2_xattr_set_handle
4 Patch-mainline: 2.6.29
5
6 This function is used to set xattr's in a started transaction. It is only
7 called during inode creation inode for initial security/acl xattrs of the
8 new inode. These xattrs could be put into ibody or extent block, so xattr
9 bucket would not be use in this case.
10
11 Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
12 Signed-off-by: Mark Fasheh <mfasheh@suse.com>
13 ---
14 fs/ocfs2/xattr.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
15 fs/ocfs2/xattr.h | 4 +++
16 2 files changed, 72 insertions(+), 0 deletions(-)
17
18 diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
19 index 7a90892..6480254 100644
20 --- a/fs/ocfs2/xattr.c
21 +++ b/fs/ocfs2/xattr.c
22 @@ -2326,6 +2326,74 @@ out:
23 }
24
25 /*
26 + * This function only called duing creating inode
27 + * for init security/acl xattrs of the new inode.
28 + * The xattrs could be put into ibody or extent block,
29 + * xattr bucket would not be use in this case.
30 + * transanction credits also be reserved in here.
31 + */
32 +int ocfs2_xattr_set_handle(handle_t *handle,
33 + struct inode *inode,
34 + struct buffer_head *di_bh,
35 + int name_index,
36 + const char *name,
37 + const void *value,
38 + size_t value_len,
39 + int flags,
40 + struct ocfs2_alloc_context *meta_ac,
41 + struct ocfs2_alloc_context *data_ac)
42 +{
43 + struct ocfs2_dinode *di;
44 + int ret;
45 +
46 + struct ocfs2_xattr_info xi = {
47 + .name_index = name_index,
48 + .name = name,
49 + .value = value,
50 + .value_len = value_len,
51 + };
52 +
53 + struct ocfs2_xattr_search xis = {
54 + .not_found = -ENODATA,
55 + };
56 +
57 + struct ocfs2_xattr_search xbs = {
58 + .not_found = -ENODATA,
59 + };
60 +
61 + struct ocfs2_xattr_set_ctxt ctxt = {
62 + .handle = handle,
63 + .meta_ac = meta_ac,
64 + .data_ac = data_ac,
65 + };
66 +
67 + if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb)))
68 + return -EOPNOTSUPP;
69 +
70 + xis.inode_bh = xbs.inode_bh = di_bh;
71 + di = (struct ocfs2_dinode *)di_bh->b_data;
72 +
73 + down_write(&OCFS2_I(inode)->ip_xattr_sem);
74 +
75 + ret = ocfs2_xattr_ibody_find(inode, name_index, name, &xis);
76 + if (ret)
77 + goto cleanup;
78 + if (xis.not_found) {
79 + ret = ocfs2_xattr_block_find(inode, name_index, name, &xbs);
80 + if (ret)
81 + goto cleanup;
82 + }
83 +
84 + ret = __ocfs2_xattr_set_handle(inode, di, &xi, &xis, &xbs, &ctxt);
85 +
86 +cleanup:
87 + up_write(&OCFS2_I(inode)->ip_xattr_sem);
88 + brelse(xbs.xattr_bh);
89 +
90 + return ret;
91 +}
92 +
93 +/*
94 * ocfs2_xattr_set()
95 *
96 * Set, replace or remove an extended attribute for this inode.
97 diff --git a/fs/ocfs2/xattr.h b/fs/ocfs2/xattr.h
98 index 1d8314c..8fbdc16 100644
99 --- a/fs/ocfs2/xattr.h
100 +++ b/fs/ocfs2/xattr.h
101 @@ -37,6 +37,10 @@ extern struct xattr_handler *ocfs2_xattr_handlers[];
102 ssize_t ocfs2_listxattr(struct dentry *, char *, size_t);
103 int ocfs2_xattr_set(struct inode *, int, const char *, const void *,
104 size_t, int);
105 +int ocfs2_xattr_set_handle(handle_t *, struct inode *, struct buffer_head *,
106 + int, const char *, const void *, size_t, int,
107 + struct ocfs2_alloc_context *,
108 + struct ocfs2_alloc_context *);
109 int ocfs2_xattr_remove(struct inode *, struct buffer_head *);
110
111 #endif /* OCFS2_XATTR_H */
112 --
113 1.5.6
114