Re: [GIT PULL] bdev size cleanups

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

 



On 11/1/21 11:02 AM, Linus Torvalds wrote:
> On Sun, Oct 31, 2021 at 12:41 PM Jens Axboe <axboe@xxxxxxxxx> wrote:
>>
>> On top of the core block branch, this topic branch cleans up the bdev
>> size handling.
> 
> So on the whole this seems to be a good cleanup, but some of it worries me.
> 
> For example, it seems to have lost the cast to "loff_t" when
> generating the byte size from a "sector_t".
> 
> Ok, so these days those are both 64-bit, and it doesn't actually
> matter (the time when we had a 32-bit sector_t as an option are long
> gone), but I think that bdev_nr_bytes() helper really ends up being
> subtler than it looks. It very much depends on 'sector_t' and 'loff_t'
> being the same size (although sector_t is an u64, loff_t ends up being
> the signed version).
> 
> I've pulled this, but I do think it might have been better with the
> type conversion being explicit. One of the reasons we had "sector_t"
> originally was that it ended up being configuration-dependent, and
> could be 32-bit. Those times may be gone, but it's still conceptually
> a very different type from "loff_t".

Yes, probably safer just to make bdev_nr_bytes() return sector_t as
well, even if loff_t isn't strictly wrong. Christoph, want to do a
followup?

-- 
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