Re: [PATCH v4 07/13] btrfs: zoned: use generic btrfs zone helpers to support npo2 zoned devices

David Sterba
2022-05-18T11:26:37Z

On Wed, May 18, 2022 at 11:40:22AM +0200, Pankaj Raghav wrote:
> On 2022-05-17 14:30, David Sterba wrote:
> > On Mon, May 16, 2022 at 06:54:10PM +0200, Pankaj Raghav wrote:
> >> @@ -1108,14 +1101,14 @@ int btrfs_reset_device_zone(struct btrfs_device *device, u64 physical,
> >> int btrfs_ensure_empty_zones(struct btrfs_device *device, u64 start, u64 size)
> >> {
> >> struct btrfs_zoned_device_info *zinfo = device->zone_info;
> >> - const u8 shift = zinfo->zone_size_shift;
> >> - unsigned long begin = start >> shift;
> >> - unsigned long end = (start + size) >> shift;
> >> + unsigned long begin = bdev_zone_no(device->bdev, start >> SECTOR_SHIFT);
> >> + unsigned long end =
> >> + bdev_zone_no(device->bdev, (start + size) >> SECTOR_SHIFT);
> >
> > There are unsinged long types here though I'd rather see u64, better for
> > a separate patch. Fixed width types are cleaner here and in the zoned
> > code as there's always some conversion to/from sectors.
> >
> Ok. I will probably send a separate patch to convert them to fix width
> types. Is it ok if I do it as a separate patch instead of including it
> in this series?

Yes, it's a cleanup for later, not directly introduced or affecting this
patchset. I've checked zoned.c, in btrfs_ensure_empty_zones it's the
only instance so it's not some widespread problem.