linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] btrfs: remove always true if branch in find_delalloc_range
@ 2018-11-28  3:21 Lu Fengqi
  2018-11-28  3:22 ` [PATCH 2/3] btrfs: cleanup the useless DEFINE_WAIT in cleanup_transaction Lu Fengqi
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Lu Fengqi @ 2018-11-28  3:21 UTC (permalink / raw)
  To: linux-btrfs

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




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

end of thread, other threads:[~2018-12-04 14:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-28  3:21 [PATCH 1/3] btrfs: remove always true if branch in find_delalloc_range Lu Fengqi
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

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