linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: use a single if() statement for one outcome in get_block_rsv()
@ 2015-09-09  0:18 Alexandru Moise
  2015-09-22 13:05 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandru Moise @ 2015-09-09  0:18 UTC (permalink / raw)
  To: clm; +Cc: jbacik, dsterba, linux-btrfs, linux-kernel, 00moses.alexander00

Rather than have three separate if() statements for the same outcome
we should just OR them together in the same if() statement.

Signed-off-by: Alexandru Moise <00moses.alexander00@gmail.com>
---
 fs/btrfs/extent-tree.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 5411f0a..e8f2c15 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4890,13 +4890,9 @@ static struct btrfs_block_rsv *get_block_rsv(
 {
 	struct btrfs_block_rsv *block_rsv = NULL;
 
-	if (test_bit(BTRFS_ROOT_REF_COWS, &root->state))
-		block_rsv = trans->block_rsv;
-
-	if (root == root->fs_info->csum_root && trans->adding_csums)
-		block_rsv = trans->block_rsv;
-
-	if (root == root->fs_info->uuid_root)
+	if (test_bit(BTRFS_ROOT_REF_COWS, &root->state) ||
+	    (root == root->fs_info->csum_root && trans->adding_csums) ||
+	     (root == root->fs_info->uuid_root))
 		block_rsv = trans->block_rsv;
 
 	if (!block_rsv)
-- 
2.5.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs: use a single if() statement for one outcome in get_block_rsv()
  2015-09-09  0:18 [PATCH] btrfs: use a single if() statement for one outcome in get_block_rsv() Alexandru Moise
@ 2015-09-22 13:05 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2015-09-22 13:05 UTC (permalink / raw)
  To: Alexandru Moise; +Cc: clm, jbacik, dsterba, linux-btrfs, linux-kernel

On Wed, Sep 09, 2015 at 12:18:50AM +0000, Alexandru Moise wrote:
> Rather than have three separate if() statements for the same outcome
> we should just OR them together in the same if() statement.
> 
> Signed-off-by: Alexandru Moise <00moses.alexander00@gmail.com>

Reviewed-by: David Sterba <dsterba@suse.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-22 13:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-09  0:18 [PATCH] btrfs: use a single if() statement for one outcome in get_block_rsv() Alexandru Moise
2015-09-22 13:05 ` David Sterba

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).