Re: [PATCH v2] block: improve discard bio alignment in __blkdev_issue_discard()

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

 



On 2020/5/30 09:27, Bart Van Assche wrote:
> On 2020-05-29 09:34, Coly Li wrote:
>> +static inline unsigned int bio_aligned_discard_max_sectors(
>> +					struct request_queue *q)
>> +{
>> +	return round_down(UINT_MAX,
>> +			 (q->limits.max_discard_sectors << SECTOR_SHIFT))
>> +			>> SECTOR_SHIFT;
>> +}
> 
> max_discard_sectors has been declared as an unsigned int. Can the shift
> left operation overflow?

It seems to work with
    round_down(UINT_MAX >> SECTOR_SHIFT, q->limits.max_discard_sectors)

I will use this for v3 version. Thanks for the remind.

Coly Li





[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