Re: [PATCH 01/10] block: introduce BLK_FEAT_WRITE_ZEROES_UNMAP to queue limits features

From: Zhang Yi
Date: Thu Jun 12 2025 - 07:21:42 EST


On 2025/6/12 12:47, Christoph Hellwig wrote:
> On Wed, Jun 11, 2025 at 03:31:21PM +0800, Zhang Yi wrote:
>>>> +/* supports unmap write zeroes command */
>>>> +#define BLK_FEAT_WRITE_ZEROES_UNMAP ((__force blk_features_t)(1u << 17))
>>>
>>>
>>> Should this be exposed through sysfs as a read-only value?
>>
>> Uh, are you suggesting adding another sysfs interface to expose
>> this feature?
>
> That was the idea. Or do we have another way to report this capability?
>

Exposing this feature looks useful, but I think adding a new interface
might be somewhat redundant, and it's also difficult to name the new
interface. What about extend this interface to include 3 types? When
read, it exposes the following:

- none : the device doesn't support BLK_FEAT_WRITE_ZEROES_UNMAP.
- enabled : the device supports BLK_FEAT_WRITE_ZEROES_UNMAP, but the
BLK_FLAG_WRITE_ZEROES_UNMAP_DISABLED is not set.
- disabled : the device supports BLK_FEAT_WRITE_ZEROES_UNMAP, and the
BLK_FLAG_WRITE_ZEROES_UNMAP_DISABLED is set.

Users can write '0' and '1' to disable and enable this operation if it
is not 'none', thoughts?

Best regards,
Yi.