linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] Btrfs: fix bitwise vs logical condition
@ 2012-01-20  7:54 Dan Carpenter
  2012-01-20 14:24 ` Ilya Dryomov
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2012-01-20  7:54 UTC (permalink / raw)
  To: Chris Mason, Ilya Dryomov; +Cc: linux-btrfs, kernel-janitors

The intent here was to do a logical && instead of a bitwise &.  The
original condition tests whether they have the some of same bits set.
I have fixed that and rewritten it to be more clear.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Warning:  This is a static analysis bug and I'm not very familiar with
the code.  Please review carefully.

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 0b4e2af..0c54027 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2376,8 +2376,8 @@ static int should_balance_chunk(struct btrfs_root *root,
 	u64 chunk_type = btrfs_chunk_type(leaf, chunk);
 
 	/* type filter */
-	if (!((chunk_type & BTRFS_BLOCK_GROUP_TYPE_MASK) &
-	      (bctl->flags & BTRFS_BALANCE_TYPE_MASK))) {
+	if (!(chunk_type & BTRFS_BLOCK_GROUP_TYPE_MASK) ||
+	    !(bctl->flags & BTRFS_BALANCE_TYPE_MASK)) {
 		return 0;
 	}
 

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

end of thread, other threads:[~2012-01-20 16:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-20  7:54 [patch] Btrfs: fix bitwise vs logical condition Dan Carpenter
2012-01-20 14:24 ` Ilya Dryomov
2012-01-20 15:21   ` Dan Carpenter
2012-01-20 16:00     ` Ilya Dryomov

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