Re: [PATCH 01/21] block: Add atomic write operations to request_queue limits

John Garry
2023-11-09T17:01:58Z

On 09/11/2023 15:10, Christoph Hellwig wrote:
>> Documentation/ABI/stable/sysfs-block | 42 +++++++++++++++++++
>> block/blk-settings.c | 60 ++++++++++++++++++++++++++++
>> block/blk-sysfs.c | 33 +++++++++++++++
>> include/linux/blkdev.h | 33 +++++++++++++++
>> 4 files changed, 168 insertions(+)
>>
>> diff --git a/Documentation/ABI/stable/sysfs-block b/Documentation/ABI/stable/sysfs-block
>> index 1fe9a553c37b..05df7f74cbc1 100644
>> --- a/Documentation/ABI/stable/sysfs-block
>> +++ b/Documentation/ABI/stable/sysfs-block
>> @@ -21,6 +21,48 @@ Description:
>> device is offset from the internal allocation unit's
>> natural alignment.
>>
>> +What: /sys/block/<disk>/atomic_write_max_bytes
>> +Date: May 2023
>> +Contact: Himanshu Madhani<himanshu.madhani@oracle.com>
>> +Description:
>> + [RO] This parameter specifies the maximum atomic write
>> + size reported by the device. An atomic write operation
>> + must not exceed this number of bytes.
>> +What: /sys/block/<disk>/atomic_write_unit_max_bytes
>> +Date: January 2023
>> +Contact: Himanshu Madhani<himanshu.madhani@oracle.com>
>> +Description:
>> + [RO] This parameter defines the largest block which can be
>> + written atomically with an atomic write operation. This
>> + value must be a multiple of atomic_write_unit_min and must
>> + be a power-of-two.
> What is the difference between these two values?

Generally they come from the same device property. Then since
atomic_write_unit_max_bytes must be a power-of-2 (and
atomic_write_max_bytes may not be), they may be different. In addition,
atomic_write_unit_max_bytes is required to be limited by whatever is
guaranteed to be able to fit in a bio.

atomic_write_max_bytes is really only relevant for merging writes. Maybe
we should not even expose via sysfs.

BTW, I do still wonder whether all these values should be limited by
max_sectors_kb (which they aren't currently).

>
>
>> +Date: May 2023
>> +Contact: Himanshu Madhani<himanshu.madhani@oracle.com>
>> +Description:
>> + [RO] This parameter specifies the smallest block which can
>> + be written atomically with an atomic write operation. All
>> + atomic write operations must begin at a
>> + atomic_write_unit_min boundary and must be multiples of
>> + atomic_write_unit_min. This value must be a power-of-two.
> How can the minimum unit be anythіng but one logical block?
>
>> +extern void blk_queue_atomic_write_max_bytes(struct request_queue *q,
>> + unsigned int bytes);
> Please don't add pointless externs to prototypes in headers.

ok, fine - blkdev.h seems to have a mix for declarations with and
without extern, so at least we would be consistently inconsistent.

>
>> +static inline unsigned int queue_atomic_write_unit_max_bytes(const struct request_queue *q)
> .. and please avoid the overly long lines.

ok

Thanks,
John

>