linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Subject: [PATCH 1/3] btrfs: remove always true if branch in find_delalloc_range
Date: Wed, 28 Nov 2018 11:21:30 +0800	[thread overview]
Message-ID: <20181128032130.11452-1-lufq.fnst@cn.fujitsu.com> (raw)

The @found is always false when it comes to the if branch. Besides, the
bool type is more suitable for @found.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
 fs/btrfs/extent_io.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 582b4b1c41e0..b4ee3399be96 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1461,7 +1461,7 @@ static noinline u64 find_delalloc_range(struct extent_io_tree *tree,
 	struct rb_node *node;
 	struct extent_state *state;
 	u64 cur_start = *start;
-	u64 found = 0;
+	bool found = false;
 	u64 total_bytes = 0;
 
 	spin_lock(&tree->lock);
@@ -1472,8 +1472,7 @@ static noinline u64 find_delalloc_range(struct extent_io_tree *tree,
 	 */
 	node = tree_search(tree, cur_start);
 	if (!node) {
-		if (!found)
-			*end = (u64)-1;
+		*end = (u64)-1;
 		goto out;
 	}
 
@@ -1493,7 +1492,7 @@ static noinline u64 find_delalloc_range(struct extent_io_tree *tree,
 			*cached_state = state;
 			refcount_inc(&state->refs);
 		}
-		found++;
+		found = true;
 		*end = state->end;
 		cur_start = state->end + 1;
 		node = rb_next(node);
-- 
2.19.2




             reply	other threads:[~2018-11-28  3:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28  3:21 Lu Fengqi [this message]
2018-11-28  3:22 ` [PATCH 2/3] btrfs: cleanup the useless DEFINE_WAIT in cleanup_transaction Lu Fengqi
2018-11-28  7:02   ` Nikolay Borisov
2018-11-28 13:34   ` Johannes Thumshirn
2018-11-28 16:24   ` David Sterba
2018-11-28  3:23 ` [PATCH 3/3] btrfs: remove redundant nowait check for buffered_write Lu Fengqi
2018-11-28  7:04   ` Nikolay Borisov
2018-11-28 16:20     ` David Sterba
2018-11-28 13:36   ` Johannes Thumshirn
2018-11-28  7:01 ` [PATCH 1/3] btrfs: remove always true if branch in find_delalloc_range Nikolay Borisov
2018-11-28  9:33   ` Lu Fengqi
2018-11-29  3:33 ` [PATCH v2 " Lu Fengqi
2018-11-29  7:05   ` Nikolay Borisov
2018-12-04 14:35   ` 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=20181128032130.11452-1-lufq.fnst@cn.fujitsu.com \
    --to=lufq.fnst@cn.fujitsu.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).