[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220427160255.300418-12-p.raghav@samsung.com>
Date: Wed, 27 Apr 2022 18:02:50 +0200
From: Pankaj Raghav <p.raghav@...sung.com>
To: jaegeuk@...nel.org, axboe@...nel.dk, snitzer@...nel.org,
hch@....de, mcgrof@...nel.org, naohiro.aota@....com,
sagi@...mberg.me, damien.lemoal@...nsource.wdc.com,
dsterba@...e.com, johannes.thumshirn@....com
Cc: linux-kernel@...r.kernel.org, linux-btrfs@...r.kernel.org,
clm@...com, gost.dev@...sung.com, chao@...nel.org,
linux-f2fs-devel@...ts.sourceforge.net, josef@...icpanda.com,
jonathan.derrick@...ux.dev, agk@...hat.com, kbusch@...nel.org,
kch@...dia.com, linux-nvme@...ts.infradead.org,
dm-devel@...hat.com, bvanassche@....org, jiangbo.365@...edance.com,
linux-fsdevel@...r.kernel.org, matias.bjorling@....com,
linux-block@...r.kernel.org, Pankaj Raghav <p.raghav@...sung.com>
Subject: [PATCH 11/16] btrfs: zoned: relax the alignment constraint for
zoned devices
Checks were in place to return error when a non power-of-2 zoned devices
is detected. Remove those checks as non power-of-2 zoned devices are
now supported.
Relax the zone size constraint to align with the BTRFS_STRIPE_LEN(64k)
so that block groups are aligned to the BTRFS_STRIPE_LEN.
Reviewed-by: Luis Chamberlain <mcgrof@...nel.org>
Signed-off-by: Pankaj Raghav <p.raghav@...sung.com>
---
fs/btrfs/zoned.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 8f3f542e174c..3ed085762f14 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -395,8 +395,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(zone_sectors != 0 && IS_ALIGNED(zone_sectors, BTRFS_STRIPE_LEN));
zone_info->zone_size = zone_sectors << SECTOR_SHIFT;
/* We reject devices with a zone size larger than 8GB */
@@ -835,9 +834,11 @@ int btrfs_sb_log_location_bdev(struct block_device *bdev, int mirror, int rw,
ASSERT(rw == READ || rw == WRITE);
- if (!is_power_of_2(bdev_zone_sectors(bdev)))
- return -EINVAL;
nr_sectors = bdev_nr_sectors(bdev);
+
+ if (!IS_ALIGNED(nr_sectors, BTRFS_STRIPE_LEN))
+ return -EINVAL;
+
nr_zones = bdev_zone_no(bdev, nr_sectors);
sb_zone = sb_zone_number(bdev, mirror);
--
2.25.1
Powered by blists - more mailing lists