Skip to content

Commit d734492

Browse files
naotakdave
authored andcommitted
btrfs: zoned: use sector_t for zone sectors
We need to use sector_t for zone_sectors, or it would set the zone size to zero when the size >= 4GB (= 2^24 sectors) by shifting the zone_sectors value by SECTOR_SHIFT. We're assuming zones sizes up to 8GiB. Fixes: 5b31646 ("btrfs: get zone information of zoned block devices") Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent c28ea61 commit d734492

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/btrfs/zoned.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device)
269269
sector_t sector = 0;
270270
struct blk_zone *zones = NULL;
271271
unsigned int i, nreported = 0, nr_zones;
272-
unsigned int zone_sectors;
272+
sector_t zone_sectors;
273273
char *model, *emulated;
274274
int ret;
275275

@@ -658,7 +658,7 @@ int btrfs_sb_log_location_bdev(struct block_device *bdev, int mirror, int rw,
658658
u64 *bytenr_ret)
659659
{
660660
struct blk_zone zones[BTRFS_NR_SB_LOG_ZONES];
661-
unsigned int zone_sectors;
661+
sector_t zone_sectors;
662662
u32 sb_zone;
663663
int ret;
664664
u8 zone_sectors_shift;

0 commit comments

Comments
 (0)