From: Sahil Kang <sahil.kang@asilaycomputing.com>
To: dsterba@suse.com
Cc: linux-btrfs@vger.kernel.org, sahil.kang@asilaycomputing.com
Subject: [PATCH 1/1] Remove unnecessary branching in free-space-tree.c
Date: Wed, 17 May 2017 03:33:45 -0700 [thread overview]
Message-ID: <1495017225-8268-2-git-send-email-sahil.kang@asilaycomputing.com> (raw)
In-Reply-To: <1495017225-8268-1-git-send-email-sahil.kang@asilaycomputing.com>
Both btrfs_create_free_space_tree and btrfs_clear_free_space_tree
contain:
if (ret)
return ret;
return 0;
The if statement is only false when ret equals zero, and since we return
zero in such cases, we can safely remove the branching.
Signed-off-by: Sahil Kang <sahil.kang@asilaycomputing.com>
---
fs/btrfs/free-space-tree.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c
index 53dbeaf..ac7dcaf 100644
--- a/fs/btrfs/free-space-tree.c
+++ b/fs/btrfs/free-space-tree.c
@@ -1185,11 +1185,7 @@ int btrfs_create_free_space_tree(struct btrfs_fs_info *fs_info)
btrfs_set_fs_compat_ro(fs_info, FREE_SPACE_TREE);
fs_info->creating_free_space_tree = 0;
- ret = btrfs_commit_transaction(trans, tree_root);
- if (ret)
- return ret;
-
- return 0;
+ return btrfs_commit_transaction(trans, tree_root);
abort:
fs_info->creating_free_space_tree = 0;
@@ -1273,11 +1269,7 @@ int btrfs_clear_free_space_tree(struct btrfs_fs_info *fs_info)
free_extent_buffer(free_space_root->commit_root);
kfree(free_space_root);
- ret = btrfs_commit_transaction(trans, tree_root);
- if (ret)
- return ret;
-
- return 0;
+ return btrfs_commit_transaction(trans, tree_root);
abort:
btrfs_abort_transaction(trans, tree_root, ret);
--
2.1.4
next prev parent reply other threads:[~2017-05-17 10:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-17 10:33 [PATCH 0/1] Remove unnecessary branching in free-space-tree.c Sahil Kang
2017-05-17 10:33 ` Sahil Kang [this message]
2017-05-17 18:41 ` [PATCH 1/1] " David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1495017225-8268-2-git-send-email-sahil.kang@asilaycomputing.com \
--to=sahil.kang@asilaycomputing.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).