Re: [GIT PULL] bdev size cleanups

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

 



On 11/1/21 5:50 PM, Linus Torvalds wrote:
> On Mon, Nov 1, 2021 at 4:20 PM Jens Axboe <axboe@xxxxxxxxx> wrote:
>>
>> Yes, probably safer just to make bdev_nr_bytes() return sector_t as
>> well, even if loff_t isn't strictly wrong.
> 
> Well, that would actually change the sign of some of the existing
> comparisons. Possibly changing their meaning entirely..
> 
> So having 'loff_t' being signed may be an odd choice for a byte size,
> but it is what it is. At least the current set of cleanups seemed to
> keep the type logic the same when it changed i_size_read() to be
> bdev_nr_bytes() instead.
> 
> Changing it to 'sector_t' not only doesn't make conceptual sense when
> it's a byte count, it might also be dangerous.
> 
> So my reaction was really that it wasn't obvious that bdev_nr_bytes()
> did the shift in the right type.. It does happen to do that, but
> historically sector_t was the smaller type.

OK, I misunderstood your original email, as per Christoph's email as
well. May be worth adding loff_t cast, if for nothing else just to have
it stick out to the next person touching it.

-- 
Jens Axboe




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux