From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 2/4] btrfs: zoned: use helper to check a power of two zone size
Date: Mon, 31 Oct 2022 20:33:42 +0100 [thread overview]
Message-ID: <1e9e2015a56fb48dba859dff85f3eee1f69f74fc.1667244568.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1667244567.git.dsterba@suse.com>
We have a 64bit compatible helper to check if a value is a power of two,
use it instead of open coding it.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/zoned.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 9d12a23e1a59..32a5aac1cccb 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -393,8 +393,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache)
zone_sectors = bdev_zone_sectors(bdev);
}
- /* Check if it's power of 2 (see is_power_of_2) */
- ASSERT(zone_sectors != 0 && (zone_sectors & (zone_sectors - 1)) == 0);
+ ASSERT(is_power_of_two_u64(zone_sectors));
zone_info->zone_size = zone_sectors << SECTOR_SHIFT;
/* We reject devices with a zone size larger than 8GB */
--
2.37.3
next prev parent reply other threads:[~2022-10-31 19:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-31 19:33 [PATCH 0/4] Minor cleanups David Sterba
2022-10-31 19:33 ` [PATCH 1/4] btrfs: zlib: use copy_page for full page copy David Sterba
2022-10-31 23:49 ` Anand Jain
2022-10-31 19:33 ` David Sterba [this message]
2022-10-31 23:49 ` [PATCH 2/4] btrfs: zoned: use helper to check a power of two zone size Anand Jain
2022-10-31 19:33 ` [PATCH 3/4] btrfs: convert btrfs_block_group::needs_free_space to runtime flag David Sterba
2022-10-31 23:50 ` Anand Jain
2022-10-31 19:33 ` [PATCH 4/4] btrfs: convert btrfs_block_group::seq_zone " David Sterba
2022-10-31 23:50 ` Anand Jain
2022-11-03 13:16 ` [PATCH 0/4] Minor cleanups 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=1e9e2015a56fb48dba859dff85f3eee1f69f74fc.1667244568.git.dsterba@suse.com \
--to=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).