Re: [PATCH v2 1/9] block: introduce max_{hw|user}_wzeroes_unmap_sectors to queue limits

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

 



On 8/21/2025 8:55 PM, John Garry wrote:
> On 19/06/2025 12:17, Zhang Yi wrote:
>>   }
>> @@ -333,6 +335,12 @@ int blk_validate_limits(struct queue_limits *lim)
>>       if (!lim->max_segments)
>>           lim->max_segments = BLK_MAX_SEGMENTS;
>>   +    if (lim->max_hw_wzeroes_unmap_sectors &&
>> +        lim->max_hw_wzeroes_unmap_sectors != lim->max_write_zeroes_sectors)
>> +        return -EINVAL;
> 
> JFYI, I noticed that I am failing this check in raid0_set_limits() -> queue_limits_set() -> queue_limits_commit_update() -> blk_validate_limits() for v6.17-rc2
> 
> The raid0 array consists of NVMe partitions. Here lim->max_hw_wzeroes_unmap_sectors = 4096 and lim->max_write_zeroes_sectors = 0 values for the failure, above.
> 
> john@raspberrypi:~ $ cat /sys/block/nvme0n1/queue/write_zeroes_max_bytes
> 2097152
> john@raspberrypi:~ $ cat /sys/block/nvme0n1/queue/write_zeroes_unmap_max_bytes
> 2097152
> john@raspberrypi:~ $ cat
> /sys/block/nvme0n1/queue/write_zeroes_unmap_max_hw_bytes
> 2097152
> john@raspberrypi:~ $
> 
> 

Thank you for checking on this!

The problem is that raid0_set_limits() only sets max_write_zeroes_sectors
without synchronously setting max_hw_wzeroes_unmap_sectors. It appears
that all stacked drivers that call blk_set_stacking_limits() to
initialize stacked limits but independently adjust
max_write_zeroes_sectors are problematic, including all md drivers and
drbd. These drivers need to update max_hw_wzeroes_unmap_sectors as well, I
will send out a fix soon.

Thanks,
Yi.

> 
>> +    lim->max_wzeroes_unmap_sectors = min(lim->max_hw_wzeroes_unmap_sectors,
>> +            lim->max_user_wzeroes_unmap_sectors);
>> +
>>       lim->max_discard_sectors =
>>           min(lim->max_hw_discard_sectors, lim->max_user_discard_sectors);
>>   @@ -418,10 +426,11 @@ int blk_set_default_limits(struct queue_limits *lim)





[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux