Re: [PATCH v10 04/41] btrfs: get zone information of zoned block devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 25, 2020 at 10:47:53PM +0100, David Sterba wrote:
> On Tue, Nov 10, 2020 at 08:26:07PM +0900, Naohiro Aota wrote:
> > +int btrfs_get_dev_zone_info(struct btrfs_device *device)
> > +{
> > +	struct btrfs_zoned_device_info *zone_info = NULL;
> > +	struct block_device *bdev = device->bdev;
> > +	sector_t nr_sectors = bdev->bd_part->nr_sects;
> > +	sector_t sector = 0;
> 
> I'd rather replace the sector_t types with u64. The type is unsigned
> long and does not have the same width on 32/64 bit. The typecasts must
> be used and if not, bugs happen (and happened).

Like in the same function a few lines below

   95         /* Get zones type */
   96         while (sector < nr_sectors) {
   97                 nr_zones = BTRFS_REPORT_NR_ZONES;
   98                 ret = btrfs_get_dev_zones(device, sector << SECTOR_SHIFT, zones,
   99                                           &nr_zones);

sector without a type cast to u64



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux