Skip to contentSkip to conversation

btrfs: remove dead code

PATCH In review Michal Nazarewicz 2 participants 2 messages Nov 29, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: remove dead code

From: Michal Nazarewicz <[email protected]>

[commit 8185554d: fix incorrect inode acl reset] introduced a dead code by adding a condition which can never be true to an else branch. The condition can never be true because it is already checked by a previous if statement which causes function to return.

---
 fs/btrfs/acl.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
fs/btrfs/acl.c +1 -6
index 0890c83..460f36b 100644
@@ -225,13 +225,8 @@ int btrfs_init_acl(struct btrfs_trans_handle *trans,
 		ret = posix_acl_create(&acl, GFP_NOFS, &inode->i_mode);
 		if (ret < 0)
 			return ret;
-
-		if (ret > 0) {
-			/* we need an acl */
+		if (ret > 0) /* we need an acl */
 			ret = btrfs_set_acl(trans, inode, acl, ACL_TYPE_ACCESS);
-		} else if (ret < 0) {
-			cache_no_acl(inode);
-		}
 	} else {
 		cache_no_acl(inode);
 	}
Signature · 1 line
1.8.4.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Michal Nazarewicz

From: Michal Nazarewicz <[email protected]>

[commit 8185554d: fix incorrect inode acl reset] introduced a dead code by adding a condition which can never be true to an else branch. The condition can never be true because it is already checked by a previous if statement which causes function to return.

Quoted 26 lines
---
 fs/btrfs/acl.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
fs/btrfs/acl.c +1 -7
index 0890c83..460f36b 100644
@@ -225,13 +225,8 @@ int btrfs_init_acl(struct btrfs_trans_handle *trans,
                ret = posix_acl_create(&acl, GFP_NOFS, &inode->i_mode);
                if (ret < 0)
                        return ret;
-
-               if (ret > 0) {
-                       /* we need an acl */
+               if (ret > 0) /* we need an acl */
                        ret = btrfs_set_acl(trans, inode, acl, ACL_TYPE_ACCESS);
-               } else if (ret < 0) {
-                       cache_no_acl(inode);
-               }
        } else {
                cache_no_acl(inode);
        }
--

1.8.4.1

Signature · 5 lines
Filipe David Manana,

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."