aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-06-08 19:52:55 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-06-24 08:15:28 -0400
commit5e78b435683daaaacadad1b2aeefb8904cf6acfb (patch)
treeaf67da5df474d5c2ecfb949acf9246d2ef74be8b /fs
parentf19d4a8fa6f9b6ccf54df0971c97ffcaa390b7b0 (diff)
switch ext2 to inode->i_acl
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext2/acl.c24
-rw-r--r--fs/ext2/acl.h4
-rw-r--r--fs/ext2/ext2.h4
-rw-r--r--fs/ext2/inode.c4
-rw-r--r--fs/ext2/super.c16
5 files changed, 11 insertions, 41 deletions
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index d46e38cb85c5..d2ffddc12117 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -128,10 +128,10 @@ fail:
128static inline struct posix_acl * 128static inline struct posix_acl *
129ext2_iget_acl(struct inode *inode, struct posix_acl **i_acl) 129ext2_iget_acl(struct inode *inode, struct posix_acl **i_acl)
130{ 130{
131 struct posix_acl *acl = EXT2_ACL_NOT_CACHED; 131 struct posix_acl *acl = ACL_NOT_CACHED;
132 132
133 spin_lock(&inode->i_lock); 133 spin_lock(&inode->i_lock);
134 if (*i_acl != EXT2_ACL_NOT_CACHED) 134 if (*i_acl != ACL_NOT_CACHED)
135 acl = posix_acl_dup(*i_acl); 135 acl = posix_acl_dup(*i_acl);
136 spin_unlock(&inode->i_lock); 136 spin_unlock(&inode->i_lock);
137 137
@@ -143,7 +143,7 @@ ext2_iset_acl(struct inode *inode, struct posix_acl **i_acl,
143 struct posix_acl *acl) 143 struct posix_acl *acl)
144{ 144{
145 spin_lock(&inode->i_lock); 145 spin_lock(&inode->i_lock);
146 if (*i_acl != EXT2_ACL_NOT_CACHED) 146 if (*i_acl != ACL_NOT_CACHED)
147 posix_acl_release(*i_acl); 147 posix_acl_release(*i_acl);
148 *i_acl = posix_acl_dup(acl); 148 *i_acl = posix_acl_dup(acl);
149 spin_unlock(&inode->i_lock); 149 spin_unlock(&inode->i_lock);
@@ -155,7 +155,6 @@ ext2_iset_acl(struct inode *inode, struct posix_acl **i_acl,
155static struct posix_acl * 155static struct posix_acl *
156ext2_get_acl(struct inode *inode, int type) 156ext2_get_acl(struct inode *inode, int type)
157{ 157{
158 struct ext2_inode_info *ei = EXT2_I(inode);
159 int name_index; 158 int name_index;
160 char *value = NULL; 159 char *value = NULL;
161 struct posix_acl *acl; 160 struct posix_acl *acl;
@@ -166,15 +165,15 @@ ext2_get_acl(struct inode *inode, int type)
166 165
167 switch(type) { 166 switch(type) {
168 case ACL_TYPE_ACCESS: 167 case ACL_TYPE_ACCESS:
169 acl = ext2_iget_acl(inode, &ei->i_acl); 168 acl = ext2_iget_acl(inode, &inode->i_acl);
170 if (acl != EXT2_ACL_NOT_CACHED) 169 if (acl != ACL_NOT_CACHED)
171 return acl; 170 return acl;
172 name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS; 171 name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS;
173 break; 172 break;
174 173
175 case ACL_TYPE_DEFAULT: 174 case ACL_TYPE_DEFAULT:
176 acl = ext2_iget_acl(inode, &ei->i_default_acl); 175 acl = ext2_iget_acl(inode, &inode->i_default_acl);
177 if (acl != EXT2_ACL_NOT_CACHED) 176 if (acl != ACL_NOT_CACHED)
178 return acl; 177 return acl;
179 name_index = EXT2_XATTR_INDEX_POSIX_ACL_DEFAULT; 178 name_index = EXT2_XATTR_INDEX_POSIX_ACL_DEFAULT;
180 break; 179 break;
@@ -200,11 +199,11 @@ ext2_get_acl(struct inode *inode, int type)
200 if (!IS_ERR(acl)) { 199 if (!IS_ERR(acl)) {
201 switch(type) { 200 switch(type) {
202 case ACL_TYPE_ACCESS: 201 case ACL_TYPE_ACCESS:
203 ext2_iset_acl(inode, &ei->i_acl, acl); 202 ext2_iset_acl(inode, &inode->i_acl, acl);
204 break; 203 break;
205 204
206 case ACL_TYPE_DEFAULT: 205 case ACL_TYPE_DEFAULT:
207 ext2_iset_acl(inode, &ei->i_default_acl, acl); 206 ext2_iset_acl(inode, &inode->i_default_acl, acl);
208 break; 207 break;
209 } 208 }
210 } 209 }
@@ -217,7 +216,6 @@ ext2_get_acl(struct inode *inode, int type)
217static int 216static int
218ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl) 217ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
219{ 218{
220 struct ext2_inode_info *ei = EXT2_I(inode);
221 int name_index; 219 int name_index;
222 void *value = NULL; 220 void *value = NULL;
223 size_t size = 0; 221 size_t size = 0;
@@ -266,11 +264,11 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
266 if (!error) { 264 if (!error) {
267 switch(type) { 265 switch(type) {
268 case ACL_TYPE_ACCESS: 266 case ACL_TYPE_ACCESS:
269 ext2_iset_acl(inode, &ei->i_acl, acl); 267 ext2_iset_acl(inode, &inode->i_acl, acl);
270 break; 268 break;
271 269
272 case ACL_TYPE_DEFAULT: 270 case ACL_TYPE_DEFAULT:
273 ext2_iset_acl(inode, &ei->i_default_acl, acl); 271 ext2_iset_acl(inode, &inode->i_default_acl, acl);
274 break; 272 break;
275 } 273 }
276 } 274 }
diff --git a/fs/ext2/acl.h b/fs/ext2/acl.h
index b42cf578554b..ecefe478898f 100644
--- a/fs/ext2/acl.h
+++ b/fs/ext2/acl.h
@@ -53,10 +53,6 @@ static inline int ext2_acl_count(size_t size)
53 53
54#ifdef CONFIG_EXT2_FS_POSIX_ACL 54#ifdef CONFIG_EXT2_FS_POSIX_ACL
55 55
56/* Value for inode->u.ext2_i.i_acl and inode->u.ext2_i.i_default_acl
57 if the ACL has not been cached */
58#define EXT2_ACL_NOT_CACHED ((void *)-1)
59
60/* acl.c */ 56/* acl.c */
61extern int ext2_permission (struct inode *, int); 57extern int ext2_permission (struct inode *, int);
62extern int ext2_acl_chmod (struct inode *); 58extern int ext2_acl_chmod (struct inode *);
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index d988a718aedb..9a8a8e27a063 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -47,10 +47,6 @@ struct ext2_inode_info {
47 */ 47 */
48 struct rw_semaphore xattr_sem; 48 struct rw_semaphore xattr_sem;
49#endif 49#endif
50#ifdef CONFIG_EXT2_FS_POSIX_ACL
51 struct posix_acl *i_acl;
52 struct posix_acl *i_default_acl;
53#endif
54 rwlock_t i_meta_lock; 50 rwlock_t i_meta_lock;
55 51
56 /* 52 /*
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 29ed682061f6..e27130341d4f 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -1224,10 +1224,6 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
1224 return inode; 1224 return inode;
1225 1225
1226 ei = EXT2_I(inode); 1226 ei = EXT2_I(inode);
1227#ifdef CONFIG_EXT2_FS_POSIX_ACL
1228 ei->i_acl = EXT2_ACL_NOT_CACHED;
1229 ei->i_default_acl = EXT2_ACL_NOT_CACHED;
1230#endif
1231 ei->i_block_alloc_info = NULL; 1227 ei->i_block_alloc_info = NULL;
1232 1228
1233 raw_inode = ext2_get_inode(inode->i_sb, ino, &bh); 1229 raw_inode = ext2_get_inode(inode->i_sb, ino, &bh);
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 458999638c3d..1a9ffee47d56 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -152,10 +152,6 @@ static struct inode *ext2_alloc_inode(struct super_block *sb)
152 ei = (struct ext2_inode_info *)kmem_cache_alloc(ext2_inode_cachep, GFP_KERNEL); 152 ei = (struct ext2_inode_info *)kmem_cache_alloc(ext2_inode_cachep, GFP_KERNEL);
153 if (!ei) 153 if (!ei)
154 return NULL; 154 return NULL;
155#ifdef CONFIG_EXT2_FS_POSIX_ACL
156 ei->i_acl = EXT2_ACL_NOT_CACHED;
157 ei->i_default_acl = EXT2_ACL_NOT_CACHED;
158#endif
159 ei->i_block_alloc_info = NULL; 155 ei->i_block_alloc_info = NULL;
160 ei->vfs_inode.i_version = 1; 156 ei->vfs_inode.i_version = 1;
161 return &ei->vfs_inode; 157 return &ei->vfs_inode;
@@ -198,18 +194,6 @@ static void destroy_inodecache(void)
198static void ext2_clear_inode(struct inode *inode) 194static void ext2_clear_inode(struct inode *inode)
199{ 195{
200 struct ext2_block_alloc_info *rsv = EXT2_I(inode)->i_block_alloc_info; 196 struct ext2_block_alloc_info *rsv = EXT2_I(inode)->i_block_alloc_info;
201#ifdef CONFIG_EXT2_FS_POSIX_ACL
202 struct ext2_inode_info *ei = EXT2_I(inode);
203
204 if (ei->i_acl && ei->i_acl != EXT2_ACL_NOT_CACHED) {
205 posix_acl_release(ei->i_acl);
206 ei->i_acl = EXT2_ACL_NOT_CACHED;
207 }
208 if (ei->i_default_acl && ei->i_default_acl != EXT2_ACL_NOT_CACHED) {
209 posix_acl_release(ei->i_default_acl);
210 ei->i_default_acl = EXT2_ACL_NOT_CACHED;
211 }
212#endif
213 ext2_discard_reservation(inode); 197 ext2_discard_reservation(inode);
214 EXT2_I(inode)->i_block_alloc_info = NULL; 198 EXT2_I(inode)->i_block_alloc_info = NULL;
215 if (unlikely(rsv)) 199 if (unlikely(rsv))