aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-06-08 19:54:52 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-06-24 08:17:04 -0400
commit05fc0790b6c9c611129f2f712d00b6a8a364e8d2 (patch)
treeaeecb1d6cab36ed133d1432127b6f8095f267b0a /fs/jfs
parentd4bfe2f76d785cc77611a4bda8cedaff358d8c7d (diff)
switch jfs to inode->i_acl
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/jfs')
-rw-r--r--fs/jfs/acl.c22
-rw-r--r--fs/jfs/jfs_incore.h6
-rw-r--r--fs/jfs/super.c16
-rw-r--r--fs/jfs/xattr.c12
4 files changed, 15 insertions, 41 deletions
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c
index 06ca1b8d2054..5fcfc9857c11 100644
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -31,7 +31,6 @@ static struct posix_acl *jfs_get_acl(struct inode *inode, int type)
31{ 31{
32 struct posix_acl *acl; 32 struct posix_acl *acl;
33 char *ea_name; 33 char *ea_name;
34 struct jfs_inode_info *ji = JFS_IP(inode);
35 struct posix_acl **p_acl; 34 struct posix_acl **p_acl;
36 int size; 35 int size;
37 char *value = NULL; 36 char *value = NULL;
@@ -39,17 +38,17 @@ static struct posix_acl *jfs_get_acl(struct inode *inode, int type)
39 switch(type) { 38 switch(type) {
40 case ACL_TYPE_ACCESS: 39 case ACL_TYPE_ACCESS:
41 ea_name = POSIX_ACL_XATTR_ACCESS; 40 ea_name = POSIX_ACL_XATTR_ACCESS;
42 p_acl = &ji->i_acl; 41 p_acl = &inode->i_acl;
43 break; 42 break;
44 case ACL_TYPE_DEFAULT: 43 case ACL_TYPE_DEFAULT:
45 ea_name = POSIX_ACL_XATTR_DEFAULT; 44 ea_name = POSIX_ACL_XATTR_DEFAULT;
46 p_acl = &ji->i_default_acl; 45 p_acl = &inode->i_default_acl;
47 break; 46 break;
48 default: 47 default:
49 return ERR_PTR(-EINVAL); 48 return ERR_PTR(-EINVAL);
50 } 49 }
51 50
52 if (*p_acl != JFS_ACL_NOT_CACHED) 51 if (*p_acl != ACL_NOT_CACHED)
53 return posix_acl_dup(*p_acl); 52 return posix_acl_dup(*p_acl);
54 53
55 size = __jfs_getxattr(inode, ea_name, NULL, 0); 54 size = __jfs_getxattr(inode, ea_name, NULL, 0);
@@ -80,7 +79,6 @@ static int jfs_set_acl(tid_t tid, struct inode *inode, int type,
80 struct posix_acl *acl) 79 struct posix_acl *acl)
81{ 80{
82 char *ea_name; 81 char *ea_name;
83 struct jfs_inode_info *ji = JFS_IP(inode);
84 struct posix_acl **p_acl; 82 struct posix_acl **p_acl;
85 int rc; 83 int rc;
86 int size = 0; 84 int size = 0;
@@ -92,11 +90,11 @@ static int jfs_set_acl(tid_t tid, struct inode *inode, int type,
92 switch(type) { 90 switch(type) {
93 case ACL_TYPE_ACCESS: 91 case ACL_TYPE_ACCESS:
94 ea_name = POSIX_ACL_XATTR_ACCESS; 92 ea_name = POSIX_ACL_XATTR_ACCESS;
95 p_acl = &ji->i_acl; 93 p_acl = &inode->i_acl;
96 break; 94 break;
97 case ACL_TYPE_DEFAULT: 95 case ACL_TYPE_DEFAULT:
98 ea_name = POSIX_ACL_XATTR_DEFAULT; 96 ea_name = POSIX_ACL_XATTR_DEFAULT;
99 p_acl = &ji->i_default_acl; 97 p_acl = &inode->i_default_acl;
100 if (!S_ISDIR(inode->i_mode)) 98 if (!S_ISDIR(inode->i_mode))
101 return acl ? -EACCES : 0; 99 return acl ? -EACCES : 0;
102 break; 100 break;
@@ -117,7 +115,7 @@ out:
117 kfree(value); 115 kfree(value);
118 116
119 if (!rc) { 117 if (!rc) {
120 if (*p_acl && (*p_acl != JFS_ACL_NOT_CACHED)) 118 if (*p_acl && (*p_acl != ACL_NOT_CACHED))
121 posix_acl_release(*p_acl); 119 posix_acl_release(*p_acl);
122 *p_acl = posix_acl_dup(acl); 120 *p_acl = posix_acl_dup(acl);
123 } 121 }
@@ -126,17 +124,15 @@ out:
126 124
127static int jfs_check_acl(struct inode *inode, int mask) 125static int jfs_check_acl(struct inode *inode, int mask)
128{ 126{
129 struct jfs_inode_info *ji = JFS_IP(inode); 127 if (inode->i_acl == ACL_NOT_CACHED) {
130
131 if (ji->i_acl == JFS_ACL_NOT_CACHED) {
132 struct posix_acl *acl = jfs_get_acl(inode, ACL_TYPE_ACCESS); 128 struct posix_acl *acl = jfs_get_acl(inode, ACL_TYPE_ACCESS);
133 if (IS_ERR(acl)) 129 if (IS_ERR(acl))
134 return PTR_ERR(acl); 130 return PTR_ERR(acl);
135 posix_acl_release(acl); 131 posix_acl_release(acl);
136 } 132 }
137 133
138 if (ji->i_acl) 134 if (inode->i_acl)
139 return posix_acl_permission(inode, ji->i_acl, mask); 135 return posix_acl_permission(inode, inode->i_acl, mask);
140 return -EAGAIN; 136 return -EAGAIN;
141} 137}
142 138
diff --git a/fs/jfs/jfs_incore.h b/fs/jfs/jfs_incore.h
index 439901d205fe..1439f119ec83 100644
--- a/fs/jfs/jfs_incore.h
+++ b/fs/jfs/jfs_incore.h
@@ -74,10 +74,6 @@ struct jfs_inode_info {
74 /* xattr_sem allows us to access the xattrs without taking i_mutex */ 74 /* xattr_sem allows us to access the xattrs without taking i_mutex */
75 struct rw_semaphore xattr_sem; 75 struct rw_semaphore xattr_sem;
76 lid_t xtlid; /* lid of xtree lock on directory */ 76 lid_t xtlid; /* lid of xtree lock on directory */
77#ifdef CONFIG_JFS_POSIX_ACL
78 struct posix_acl *i_acl;
79 struct posix_acl *i_default_acl;
80#endif
81 union { 77 union {
82 struct { 78 struct {
83 xtpage_t _xtroot; /* 288: xtree root */ 79 xtpage_t _xtroot; /* 288: xtree root */
@@ -107,8 +103,6 @@ struct jfs_inode_info {
107#define i_inline u.link._inline 103#define i_inline u.link._inline
108#define i_inline_ea u.link._inline_ea 104#define i_inline_ea u.link._inline_ea
109 105
110#define JFS_ACL_NOT_CACHED ((void *)-1)
111
112#define IREAD_LOCK(ip, subclass) \ 106#define IREAD_LOCK(ip, subclass) \
113 down_read_nested(&JFS_IP(ip)->rdwrlock, subclass) 107 down_read_nested(&JFS_IP(ip)->rdwrlock, subclass)
114#define IREAD_UNLOCK(ip) up_read(&JFS_IP(ip)->rdwrlock) 108#define IREAD_UNLOCK(ip) up_read(&JFS_IP(ip)->rdwrlock)
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 09b1b6ee2186..37e6dcda8fc8 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -128,18 +128,6 @@ static void jfs_destroy_inode(struct inode *inode)
128 ji->active_ag = -1; 128 ji->active_ag = -1;
129 } 129 }
130 spin_unlock_irq(&ji->ag_lock); 130 spin_unlock_irq(&ji->ag_lock);
131
132#ifdef CONFIG_JFS_POSIX_ACL
133 if (ji->i_acl != JFS_ACL_NOT_CACHED) {
134 posix_acl_release(ji->i_acl);
135 ji->i_acl = JFS_ACL_NOT_CACHED;
136 }
137 if (ji->i_default_acl != JFS_ACL_NOT_CACHED) {
138 posix_acl_release(ji->i_default_acl);
139 ji->i_default_acl = JFS_ACL_NOT_CACHED;
140 }
141#endif
142
143 kmem_cache_free(jfs_inode_cachep, ji); 131 kmem_cache_free(jfs_inode_cachep, ji);
144} 132}
145 133
@@ -798,10 +786,6 @@ static void init_once(void *foo)
798 init_rwsem(&jfs_ip->xattr_sem); 786 init_rwsem(&jfs_ip->xattr_sem);
799 spin_lock_init(&jfs_ip->ag_lock); 787 spin_lock_init(&jfs_ip->ag_lock);
800 jfs_ip->active_ag = -1; 788 jfs_ip->active_ag = -1;
801#ifdef CONFIG_JFS_POSIX_ACL
802 jfs_ip->i_acl = JFS_ACL_NOT_CACHED;
803 jfs_ip->i_default_acl = JFS_ACL_NOT_CACHED;
804#endif
805 inode_init_once(&jfs_ip->vfs_inode); 789 inode_init_once(&jfs_ip->vfs_inode);
806} 790}
807 791
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
index 61dfa8173ebc..f6e90e343593 100644
--- a/fs/jfs/xattr.c
+++ b/fs/jfs/xattr.c
@@ -727,10 +727,10 @@ static int can_set_system_xattr(struct inode *inode, const char *name,
727 /* 727 /*
728 * We're changing the ACL. Get rid of the cached one 728 * We're changing the ACL. Get rid of the cached one
729 */ 729 */
730 acl =JFS_IP(inode)->i_acl; 730 acl =inode->i_acl;
731 if (acl != JFS_ACL_NOT_CACHED) 731 if (acl != ACL_NOT_CACHED)
732 posix_acl_release(acl); 732 posix_acl_release(acl);
733 JFS_IP(inode)->i_acl = JFS_ACL_NOT_CACHED; 733 inode->i_acl = ACL_NOT_CACHED;
734 734
735 return 0; 735 return 0;
736 } else if (strcmp(name, POSIX_ACL_XATTR_DEFAULT) == 0) { 736 } else if (strcmp(name, POSIX_ACL_XATTR_DEFAULT) == 0) {
@@ -746,10 +746,10 @@ static int can_set_system_xattr(struct inode *inode, const char *name,
746 /* 746 /*
747 * We're changing the default ACL. Get rid of the cached one 747 * We're changing the default ACL. Get rid of the cached one
748 */ 748 */
749 acl =JFS_IP(inode)->i_default_acl; 749 acl = inode->i_default_acl;
750 if (acl && (acl != JFS_ACL_NOT_CACHED)) 750 if (acl && (acl != ACL_NOT_CACHED))
751 posix_acl_release(acl); 751 posix_acl_release(acl);
752 JFS_IP(inode)->i_default_acl = JFS_ACL_NOT_CACHED; 752 inode->i_default_acl = ACL_NOT_CACHED;
753 753
754 return 0; 754 return 0;
755 } 755 }