]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
f2fs: clean up acl flow for better readability
authorJaegeuk Kim <jaegeuk.kim@samsung.com>
Mon, 28 Oct 2013 04:12:09 +0000 (13:12 +0900)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Mon, 28 Oct 2013 04:38:21 +0000 (13:38 +0900)
This patch cleans up a couple of acl codes.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fs/f2fs/acl.c
fs/f2fs/acl.h

index b7826ec1b47062fdb30891192b42a8dbf5e20788..f1a6975846519064a45e6a205a7c33e20fb5cab0 100644 (file)
@@ -262,8 +262,8 @@ static int f2fs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
 
 int f2fs_init_acl(struct inode *inode, struct inode *dir)
 {
-       struct posix_acl *acl = NULL;
        struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb);
+       struct posix_acl *acl = NULL;
        int error = 0;
 
        if (!S_ISLNK(inode->i_mode)) {
@@ -276,19 +276,19 @@ int f2fs_init_acl(struct inode *inode, struct inode *dir)
                        inode->i_mode &= ~current_umask();
        }
 
-       if (test_opt(sbi, POSIX_ACL) && acl) {
+       if (!test_opt(sbi, POSIX_ACL) || !acl)
+               goto cleanup;
 
-               if (S_ISDIR(inode->i_mode)) {
-                       error = f2fs_set_acl(inode, ACL_TYPE_DEFAULT, acl);
-                       if (error)
-                               goto cleanup;
-               }
-               error = posix_acl_create(&acl, GFP_KERNEL, &inode->i_mode);
-               if (error < 0)
-                       return error;
-               if (error > 0)
-                       error = f2fs_set_acl(inode, ACL_TYPE_ACCESS, acl);
+       if (S_ISDIR(inode->i_mode)) {
+               error = f2fs_set_acl(inode, ACL_TYPE_DEFAULT, acl);
+               if (error)
+                       goto cleanup;
        }
+       error = posix_acl_create(&acl, GFP_KERNEL, &inode->i_mode);
+       if (error < 0)
+               return error;
+       if (error > 0)
+               error = f2fs_set_acl(inode, ACL_TYPE_ACCESS, acl);
 cleanup:
        posix_acl_release(acl);
        return error;
@@ -313,6 +313,7 @@ int f2fs_acl_chmod(struct inode *inode)
        error = posix_acl_chmod(&acl, GFP_KERNEL, mode);
        if (error)
                return error;
+
        error = f2fs_set_acl(inode, ACL_TYPE_ACCESS, acl);
        posix_acl_release(acl);
        return error;
index 80f430674417a696925f90fdf622dac8710e0909..3839048f2e968541f7ef2dd3840f2e9a9dde0633 100644 (file)
@@ -36,9 +36,9 @@ struct f2fs_acl_header {
 
 #ifdef CONFIG_F2FS_FS_POSIX_ACL
 
-extern struct posix_acl *f2fs_get_acl(struct inode *inode, int type);
-extern int f2fs_acl_chmod(struct inode *inode);
-extern int f2fs_init_acl(struct inode *inode, struct inode *dir);
+extern struct posix_acl *f2fs_get_acl(struct inode *, int);
+extern int f2fs_acl_chmod(struct inode *);
+extern int f2fs_init_acl(struct inode *, struct inode *);
 #else
 #define f2fs_check_acl NULL
 #define f2fs_get_acl   NULL