diff options
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/acl.c | 67 | ||||
-rw-r--r-- | fs/ext4/acl.h | 4 | ||||
-rw-r--r-- | fs/ext4/ext4.h | 4 | ||||
-rw-r--r-- | fs/ext4/inode.c | 4 | ||||
-rw-r--r-- | fs/ext4/super.c | 16 |
5 files changed, 9 insertions, 86 deletions
diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c index 605aeed96d68..f6d8967149ca 100644 --- a/fs/ext4/acl.c +++ b/fs/ext4/acl.c | |||
@@ -126,33 +126,6 @@ fail: | |||
126 | return ERR_PTR(-EINVAL); | 126 | return ERR_PTR(-EINVAL); |
127 | } | 127 | } |
128 | 128 | ||
129 | static inline struct posix_acl * | ||
130 | ext4_iget_acl(struct inode *inode, struct posix_acl **i_acl) | ||
131 | { | ||
132 | struct posix_acl *acl = ACCESS_ONCE(*i_acl); | ||
133 | |||
134 | if (acl) { | ||
135 | spin_lock(&inode->i_lock); | ||
136 | acl = *i_acl; | ||
137 | if (acl != EXT4_ACL_NOT_CACHED) | ||
138 | acl = posix_acl_dup(acl); | ||
139 | spin_unlock(&inode->i_lock); | ||
140 | } | ||
141 | |||
142 | return acl; | ||
143 | } | ||
144 | |||
145 | static inline void | ||
146 | ext4_iset_acl(struct inode *inode, struct posix_acl **i_acl, | ||
147 | struct posix_acl *acl) | ||
148 | { | ||
149 | spin_lock(&inode->i_lock); | ||
150 | if (*i_acl != EXT4_ACL_NOT_CACHED) | ||
151 | posix_acl_release(*i_acl); | ||
152 | *i_acl = posix_acl_dup(acl); | ||
153 | spin_unlock(&inode->i_lock); | ||
154 | } | ||
155 | |||
156 | /* | 129 | /* |
157 | * Inode operation get_posix_acl(). | 130 | * Inode operation get_posix_acl(). |
158 | * | 131 | * |
@@ -161,7 +134,6 @@ ext4_iset_acl(struct inode *inode, struct posix_acl **i_acl, | |||
161 | static struct posix_acl * | 134 | static struct posix_acl * |
162 | ext4_get_acl(struct inode *inode, int type) | 135 | ext4_get_acl(struct inode *inode, int type) |
163 | { | 136 | { |
164 | struct ext4_inode_info *ei = EXT4_I(inode); | ||
165 | int name_index; | 137 | int name_index; |
166 | char *value = NULL; | 138 | char *value = NULL; |
167 | struct posix_acl *acl; | 139 | struct posix_acl *acl; |
@@ -170,23 +142,19 @@ ext4_get_acl(struct inode *inode, int type) | |||
170 | if (!test_opt(inode->i_sb, POSIX_ACL)) | 142 | if (!test_opt(inode->i_sb, POSIX_ACL)) |
171 | return NULL; | 143 | return NULL; |
172 | 144 | ||
145 | acl = get_cached_acl(inode, type); | ||
146 | if (acl != ACL_NOT_CACHED) | ||
147 | return acl; | ||
148 | |||
173 | switch (type) { | 149 | switch (type) { |
174 | case ACL_TYPE_ACCESS: | 150 | case ACL_TYPE_ACCESS: |
175 | acl = ext4_iget_acl(inode, &ei->i_acl); | ||
176 | if (acl != EXT4_ACL_NOT_CACHED) | ||
177 | return acl; | ||
178 | name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS; | 151 | name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS; |
179 | break; | 152 | break; |
180 | |||
181 | case ACL_TYPE_DEFAULT: | 153 | case ACL_TYPE_DEFAULT: |
182 | acl = ext4_iget_acl(inode, &ei->i_default_acl); | ||
183 | if (acl != EXT4_ACL_NOT_CACHED) | ||
184 | return acl; | ||
185 | name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT; | 154 | name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT; |
186 | break; | 155 | break; |
187 | |||
188 | default: | 156 | default: |
189 | return ERR_PTR(-EINVAL); | 157 | BUG(); |
190 | } | 158 | } |
191 | retval = ext4_xattr_get(inode, name_index, "", NULL, 0); | 159 | retval = ext4_xattr_get(inode, name_index, "", NULL, 0); |
192 | if (retval > 0) { | 160 | if (retval > 0) { |
@@ -203,17 +171,9 @@ ext4_get_acl(struct inode *inode, int type) | |||
203 | acl = ERR_PTR(retval); | 171 | acl = ERR_PTR(retval); |
204 | kfree(value); | 172 | kfree(value); |
205 | 173 | ||
206 | if (!IS_ERR(acl)) { | 174 | if (!IS_ERR(acl)) |
207 | switch (type) { | 175 | set_cached_acl(inode, type, acl); |
208 | case ACL_TYPE_ACCESS: | ||
209 | ext4_iset_acl(inode, &ei->i_acl, acl); | ||
210 | break; | ||
211 | 176 | ||
212 | case ACL_TYPE_DEFAULT: | ||
213 | ext4_iset_acl(inode, &ei->i_default_acl, acl); | ||
214 | break; | ||
215 | } | ||
216 | } | ||
217 | return acl; | 177 | return acl; |
218 | } | 178 | } |
219 | 179 | ||
@@ -226,7 +186,6 @@ static int | |||
226 | ext4_set_acl(handle_t *handle, struct inode *inode, int type, | 186 | ext4_set_acl(handle_t *handle, struct inode *inode, int type, |
227 | struct posix_acl *acl) | 187 | struct posix_acl *acl) |
228 | { | 188 | { |
229 | struct ext4_inode_info *ei = EXT4_I(inode); | ||
230 | int name_index; | 189 | int name_index; |
231 | void *value = NULL; | 190 | void *value = NULL; |
232 | size_t size = 0; | 191 | size_t size = 0; |
@@ -271,17 +230,9 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type, | |||
271 | value, size, 0); | 230 | value, size, 0); |
272 | 231 | ||
273 | kfree(value); | 232 | kfree(value); |
274 | if (!error) { | 233 | if (!error) |
275 | switch (type) { | 234 | set_cached_acl(inode, type, acl); |
276 | case ACL_TYPE_ACCESS: | ||
277 | ext4_iset_acl(inode, &ei->i_acl, acl); | ||
278 | break; | ||
279 | 235 | ||
280 | case ACL_TYPE_DEFAULT: | ||
281 | ext4_iset_acl(inode, &ei->i_default_acl, acl); | ||
282 | break; | ||
283 | } | ||
284 | } | ||
285 | return error; | 236 | return error; |
286 | } | 237 | } |
287 | 238 | ||
diff --git a/fs/ext4/acl.h b/fs/ext4/acl.h index cb45257a246e..949789d2bba6 100644 --- a/fs/ext4/acl.h +++ b/fs/ext4/acl.h | |||
@@ -53,10 +53,6 @@ static inline int ext4_acl_count(size_t size) | |||
53 | 53 | ||
54 | #ifdef CONFIG_EXT4_FS_POSIX_ACL | 54 | #ifdef CONFIG_EXT4_FS_POSIX_ACL |
55 | 55 | ||
56 | /* Value for inode->u.ext4_i.i_acl and inode->u.ext4_i.i_default_acl | ||
57 | if the ACL has not been cached */ | ||
58 | #define EXT4_ACL_NOT_CACHED ((void *)-1) | ||
59 | |||
60 | /* acl.c */ | 56 | /* acl.c */ |
61 | extern int ext4_permission(struct inode *, int); | 57 | extern int ext4_permission(struct inode *, int); |
62 | extern int ext4_acl_chmod(struct inode *); | 58 | extern int ext4_acl_chmod(struct inode *); |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 17b9998680e3..0ddf7e55abe1 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -595,10 +595,6 @@ struct ext4_inode_info { | |||
595 | */ | 595 | */ |
596 | struct rw_semaphore xattr_sem; | 596 | struct rw_semaphore xattr_sem; |
597 | #endif | 597 | #endif |
598 | #ifdef CONFIG_EXT4_FS_POSIX_ACL | ||
599 | struct posix_acl *i_acl; | ||
600 | struct posix_acl *i_default_acl; | ||
601 | #endif | ||
602 | 598 | ||
603 | struct list_head i_orphan; /* unlinked but open inodes */ | 599 | struct list_head i_orphan; /* unlinked but open inodes */ |
604 | 600 | ||
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 7c17ae275af4..60a26f3a6f8b 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -4453,10 +4453,6 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) | |||
4453 | return inode; | 4453 | return inode; |
4454 | 4454 | ||
4455 | ei = EXT4_I(inode); | 4455 | ei = EXT4_I(inode); |
4456 | #ifdef CONFIG_EXT4_FS_POSIX_ACL | ||
4457 | ei->i_acl = EXT4_ACL_NOT_CACHED; | ||
4458 | ei->i_default_acl = EXT4_ACL_NOT_CACHED; | ||
4459 | #endif | ||
4460 | 4456 | ||
4461 | ret = __ext4_get_inode_loc(inode, &iloc, 0); | 4457 | ret = __ext4_get_inode_loc(inode, &iloc, 0); |
4462 | if (ret < 0) | 4458 | if (ret < 0) |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 8bb9e2d3e4b8..8f4f079e6b9a 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -666,10 +666,6 @@ static struct inode *ext4_alloc_inode(struct super_block *sb) | |||
666 | if (!ei) | 666 | if (!ei) |
667 | return NULL; | 667 | return NULL; |
668 | 668 | ||
669 | #ifdef CONFIG_EXT4_FS_POSIX_ACL | ||
670 | ei->i_acl = EXT4_ACL_NOT_CACHED; | ||
671 | ei->i_default_acl = EXT4_ACL_NOT_CACHED; | ||
672 | #endif | ||
673 | ei->vfs_inode.i_version = 1; | 669 | ei->vfs_inode.i_version = 1; |
674 | ei->vfs_inode.i_data.writeback_index = 0; | 670 | ei->vfs_inode.i_data.writeback_index = 0; |
675 | memset(&ei->i_cached_extent, 0, sizeof(struct ext4_ext_cache)); | 671 | memset(&ei->i_cached_extent, 0, sizeof(struct ext4_ext_cache)); |
@@ -735,18 +731,6 @@ static void destroy_inodecache(void) | |||
735 | 731 | ||
736 | static void ext4_clear_inode(struct inode *inode) | 732 | static void ext4_clear_inode(struct inode *inode) |
737 | { | 733 | { |
738 | #ifdef CONFIG_EXT4_FS_POSIX_ACL | ||
739 | if (EXT4_I(inode)->i_acl && | ||
740 | EXT4_I(inode)->i_acl != EXT4_ACL_NOT_CACHED) { | ||
741 | posix_acl_release(EXT4_I(inode)->i_acl); | ||
742 | EXT4_I(inode)->i_acl = EXT4_ACL_NOT_CACHED; | ||
743 | } | ||
744 | if (EXT4_I(inode)->i_default_acl && | ||
745 | EXT4_I(inode)->i_default_acl != EXT4_ACL_NOT_CACHED) { | ||
746 | posix_acl_release(EXT4_I(inode)->i_default_acl); | ||
747 | EXT4_I(inode)->i_default_acl = EXT4_ACL_NOT_CACHED; | ||
748 | } | ||
749 | #endif | ||
750 | ext4_discard_preallocations(inode); | 734 | ext4_discard_preallocations(inode); |
751 | if (EXT4_JOURNAL(inode)) | 735 | if (EXT4_JOURNAL(inode)) |
752 | jbd2_journal_release_jbd_inode(EXT4_SB(inode->i_sb)->s_journal, | 736 | jbd2_journal_release_jbd_inode(EXT4_SB(inode->i_sb)->s_journal, |