* [PATCH v2] statx.2: Add stx_atomic_write_unit_max_opt
@ 2025-06-19 9:05 John Garry
2025-06-19 11:05 ` Alejandro Colomar
0 siblings, 1 reply; 8+ messages in thread
From: John Garry @ 2025-06-19 9:05 UTC (permalink / raw)
To: alx; +Cc: linux-man, linux-fsdevel, hch, djwong, linux-xfs, John Garry
XFS supports atomic writes - or untorn writes - based on two different
methods:
- HW offload in the disk
- FS method based on out-of-place writes
The value reported in stx_atomic_write_unit_max will be the max size of the
FS-based method.
The max atomic write unit size of the FS-based atomic writes will
typically be much larger than what is capable from the HW offload. However,
FS-based atomic writes will also be typically much slower.
Advertise this HW offload size limit to the user in a new statx member,
stx_atomic_write_unit_max_opt.
We want STATX_WRITE_ATOMIC to get this new member in addition to the
already-existing members, so mention that a value of 0 means that
stx_atomic_write_unit_max holds this optimised limit.
Linux will zero unused statx members, so stx_atomic_write_unit_max_opt
will always hold 0 for older kernel versions which do not support
this FS-based atomic write method (for XFS).
Signed-off-by: John Garry <john.g.garry@oracle.com>
---
Differences to RFC (v1):
- general rewrite
- mention that linux zeroes unused statx fields
diff --git a/man/man2/statx.2 b/man/man2/statx.2
index ef7dbbcf9..29400d055 100644
--- a/man/man2/statx.2
+++ b/man/man2/statx.2
@@ -74,6 +74,9 @@ struct statx {
\&
/* File offset alignment for direct I/O reads */
__u32 stx_dio_read_offset_align;
+\&
+ /* Direct I/O atomic write max opt limit */
+ __u32 stx_atomic_write_unit_max_opt;
};
.EE
.in
@@ -266,7 +269,8 @@ STATX_SUBVOL Want stx_subvol
(since Linux 6.10; support varies by filesystem)
STATX_WRITE_ATOMIC Want stx_atomic_write_unit_min,
stx_atomic_write_unit_max,
- and stx_atomic_write_segments_max.
+ stx_atomic_write_segments_max,
+ and stx_atomic_write_unit_max_opt.
(since Linux 6.11; support varies by filesystem)
STATX_DIO_READ_ALIGN Want stx_dio_read_offset_align.
(since Linux 6.14; support varies by filesystem)
@@ -514,6 +518,20 @@ is supported on block devices since Linux 6.11.
The support on regular files varies by filesystem;
it is supported by xfs and ext4 since Linux 6.13.
.TP
+.I stx_atomic_write_unit_max_opt
+The maximum size (in bytes) which is optimised for writes issued with
+torn-write protection.
+If non-zero, this value will not exceed the value in
+.I stx_atomic_write_unit_max
+and will not be less than the value in
+.I stx_atomic_write_unit_min.
+A value of zero indicates that
+.I stx_atomic_write_unit_max
+is the optimised limit.
+Slower writes may be experienced when the size of the write exceeds
+.I stx_atomic_write_unit_max_opt
+(when non-zero).
+.TP
.I stx_atomic_write_segments_max
The maximum number of elements in an array of vectors
for a write with torn-write protection enabled.
--
2.31.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH v2] statx.2: Add stx_atomic_write_unit_max_opt
2025-06-19 9:05 [PATCH v2] statx.2: Add stx_atomic_write_unit_max_opt John Garry
@ 2025-06-19 11:05 ` Alejandro Colomar
2025-06-19 11:24 ` John Garry
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Alejandro Colomar @ 2025-06-19 11:05 UTC (permalink / raw)
To: John Garry; +Cc: linux-man, linux-fsdevel, hch, djwong, linux-xfs
[-- Attachment #1: Type: text/plain, Size: 3439 bytes --]
Hi John,
On Thu, Jun 19, 2025 at 09:05:10AM +0000, John Garry wrote:
> XFS supports atomic writes - or untorn writes - based on two different
> methods:
> - HW offload in the disk
> - FS method based on out-of-place writes
>
> The value reported in stx_atomic_write_unit_max will be the max size of the
> FS-based method.
>
> The max atomic write unit size of the FS-based atomic writes will
> typically be much larger than what is capable from the HW offload. However,
> FS-based atomic writes will also be typically much slower.
>
> Advertise this HW offload size limit to the user in a new statx member,
> stx_atomic_write_unit_max_opt.
>
> We want STATX_WRITE_ATOMIC to get this new member in addition to the
> already-existing members, so mention that a value of 0 means that
> stx_atomic_write_unit_max holds this optimised limit.
Please say a "a value of 0 *in stx_atomic_write_unit_max_opt* means
that ...", to clarify.
> Linux will zero unused statx members, so stx_atomic_write_unit_max_opt
> will always hold 0 for older kernel versions which do not support
> this FS-based atomic write method (for XFS).
>
> Signed-off-by: John Garry <john.g.garry@oracle.com>
> ---
> Differences to RFC (v1):
> - general rewrite
> - mention that linux zeroes unused statx fields
>
> diff --git a/man/man2/statx.2 b/man/man2/statx.2
> index ef7dbbcf9..29400d055 100644
> --- a/man/man2/statx.2
> +++ b/man/man2/statx.2
> @@ -74,6 +74,9 @@ struct statx {
> \&
> /* File offset alignment for direct I/O reads */
> __u32 stx_dio_read_offset_align;
> +\&
> + /* Direct I/O atomic write max opt limit */
> + __u32 stx_atomic_write_unit_max_opt;
Please align the member with the one above.
> };
> .EE
> .in
> @@ -266,7 +269,8 @@ STATX_SUBVOL Want stx_subvol
> (since Linux 6.10; support varies by filesystem)
> STATX_WRITE_ATOMIC Want stx_atomic_write_unit_min,
> stx_atomic_write_unit_max,
> - and stx_atomic_write_segments_max.
> + stx_atomic_write_segments_max,
> + and stx_atomic_write_unit_max_opt.
> (since Linux 6.11; support varies by filesystem)
> STATX_DIO_READ_ALIGN Want stx_dio_read_offset_align.
> (since Linux 6.14; support varies by filesystem)
> @@ -514,6 +518,20 @@ is supported on block devices since Linux 6.11.
> The support on regular files varies by filesystem;
> it is supported by xfs and ext4 since Linux 6.13.
> .TP
> +.I stx_atomic_write_unit_max_opt
> +The maximum size (in bytes) which is optimised for writes issued with
> +torn-write protection.
Please break the line before 'optimized' and remove the current line
break.
> +If non-zero, this value will not exceed the value in
Please break the line after ','.
> +.I stx_atomic_write_unit_max
> +and will not be less than the value in
> +.I stx_atomic_write_unit_min.
This should be IR, and the '.' separated by a space, so that the '.' is
not in italics.
Have a lovely day!
Alex
> +A value of zero indicates that
> +.I stx_atomic_write_unit_max
> +is the optimised limit.
> +Slower writes may be experienced when the size of the write exceeds
> +.I stx_atomic_write_unit_max_opt
> +(when non-zero).
> +.TP
> .I stx_atomic_write_segments_max
> The maximum number of elements in an array of vectors
> for a write with torn-write protection enabled.
> --
> 2.31.1
>
--
<https://www.alejandro-colomar.es/>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2] statx.2: Add stx_atomic_write_unit_max_opt
2025-06-19 11:05 ` Alejandro Colomar
@ 2025-06-19 11:24 ` John Garry
2025-06-19 11:30 ` Alejandro Colomar
2025-06-19 13:10 ` John Garry
2025-06-19 21:34 ` G. Branden Robinson
2 siblings, 1 reply; 8+ messages in thread
From: John Garry @ 2025-06-19 11:24 UTC (permalink / raw)
To: Alejandro Colomar; +Cc: linux-man, linux-fsdevel, hch, djwong, linux-xfs
On 19/06/2025 12:05, Alejandro Colomar wrote:
> Hi John,
>
> On Thu, Jun 19, 2025 at 09:05:10AM +0000, John Garry wrote:
>> XFS supports atomic writes - or untorn writes - based on two different
>> methods:
>> - HW offload in the disk
>> - FS method based on out-of-place writes
>>
>> The value reported in stx_atomic_write_unit_max will be the max size of the
>> FS-based method.
>>
>> The max atomic write unit size of the FS-based atomic writes will
>> typically be much larger than what is capable from the HW offload. However,
>> FS-based atomic writes will also be typically much slower.
>>
>> Advertise this HW offload size limit to the user in a new statx member,
>> stx_atomic_write_unit_max_opt.
>>
>> We want STATX_WRITE_ATOMIC to get this new member in addition to the
>> already-existing members, so mention that a value of 0 means that
>> stx_atomic_write_unit_max holds this optimised limit.
>
> Please say a "a value of 0 *in stx_atomic_write_unit_max_opt* means
> that ...", to clarify.
ok
>
>> Linux will zero unused statx members, so stx_atomic_write_unit_max_opt
>> will always hold 0 for older kernel versions which do not support
>> this FS-based atomic write method (for XFS).
>>
>> Signed-off-by: John Garry <john.g.garry@oracle.com>
>> ---
>> Differences to RFC (v1):
>> - general rewrite
>> - mention that linux zeroes unused statx fields
>>
>> diff --git a/man/man2/statx.2 b/man/man2/statx.2
>> index ef7dbbcf9..29400d055 100644
>> --- a/man/man2/statx.2
>> +++ b/man/man2/statx.2
>> @@ -74,6 +74,9 @@ struct statx {
>> \&
>> /* File offset alignment for direct I/O reads */
>> __u32 stx_dio_read_offset_align;
>> +\&
>> + /* Direct I/O atomic write max opt limit */
>> + __u32 stx_atomic_write_unit_max_opt;
>
> Please align the member with the one above.
ok
>
>> };
>> .EE
>> .in
>> @@ -266,7 +269,8 @@ STATX_SUBVOL Want stx_subvol
>> (since Linux 6.10; support varies by filesystem)
>> STATX_WRITE_ATOMIC Want stx_atomic_write_unit_min,
>> stx_atomic_write_unit_max,
>> - and stx_atomic_write_segments_max.
>> + stx_atomic_write_segments_max,
>> + and stx_atomic_write_unit_max_opt.
>> (since Linux 6.11; support varies by filesystem)
>> STATX_DIO_READ_ALIGN Want stx_dio_read_offset_align.
>> (since Linux 6.14; support varies by filesystem)
>> @@ -514,6 +518,20 @@ is supported on block devices since Linux 6.11.
>> The support on regular files varies by filesystem;
>> it is supported by xfs and ext4 since Linux 6.13.
>> .TP
>> +.I stx_atomic_write_unit_max_opt
>> +The maximum size (in bytes) which is optimised for writes issued with
>> +torn-write protection.
>
> Please break the line before 'optimized' and remove the current line
> break.
ok, but I am not sure the issue with the current formatting
>
>> +If non-zero, this value will not exceed the value in
>
> Please break the line after ','.
ok
>
>> +.I stx_atomic_write_unit_max
>> +and will not be less than the value in
>> +.I stx_atomic_write_unit_min.
>
> This should be IR, and the '.' separated by a space, so that the '.' is
> not in italics.
So you mean like the following:
.IR stx_atomic_write_unit_min .
right?
Cheers,
John
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2] statx.2: Add stx_atomic_write_unit_max_opt
2025-06-19 11:24 ` John Garry
@ 2025-06-19 11:30 ` Alejandro Colomar
0 siblings, 0 replies; 8+ messages in thread
From: Alejandro Colomar @ 2025-06-19 11:30 UTC (permalink / raw)
To: John Garry; +Cc: linux-man, linux-fsdevel, hch, djwong, linux-xfs
[-- Attachment #1: Type: text/plain, Size: 1586 bytes --]
Hi John,
On Thu, Jun 19, 2025 at 12:24:21PM +0100, John Garry wrote:
> > > @@ -514,6 +518,20 @@ is supported on block devices since Linux 6.11.
> > > The support on regular files varies by filesystem;
> > > it is supported by xfs and ext4 since Linux 6.13.
> > > .TP
> > > +.I stx_atomic_write_unit_max_opt
> > > +The maximum size (in bytes) which is optimised for writes issued with
> > > +torn-write protection.
> >
> > Please break the line before 'optimized' and remove the current line
> > break.
>
> ok, but I am not sure the issue with the current formatting
It's because of
$ MANWIDTH=72 man man-pages | sed -n '/Use semantic newlines/,/^$/p';
Use semantic newlines
In the source of a manual page, new sentences should be started
on new lines, long sentences should be split into lines at
clause breaks (commas, semicolons, colons, and so on), and long
clauses should be split at phrase boundaries. This convention,
sometimes known as "semantic newlines", makes it easier to see
the effect of patches, which often operate at the level of indi‐
vidual sentences, clauses, or phrases.
> > > +.I stx_atomic_write_unit_max
> > > +and will not be less than the value in
> > > +.I stx_atomic_write_unit_min.
> >
> > This should be IR, and the '.' separated by a space, so that the '.' is
> > not in italics.
>
> So you mean like the following:
>
> .IR stx_atomic_write_unit_min .
>
> right?
Yep.
Cheers,
Alex
--
<https://www.alejandro-colomar.es/>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] statx.2: Add stx_atomic_write_unit_max_opt
2025-06-19 11:05 ` Alejandro Colomar
2025-06-19 11:24 ` John Garry
@ 2025-06-19 13:10 ` John Garry
2025-06-19 13:45 ` Alejandro Colomar
2025-06-19 21:34 ` G. Branden Robinson
2 siblings, 1 reply; 8+ messages in thread
From: John Garry @ 2025-06-19 13:10 UTC (permalink / raw)
To: Alejandro Colomar; +Cc: linux-man, linux-fsdevel, hch, djwong, linux-xfs
Hi Alex,
On 19/06/2025 12:05, Alejandro Colomar wrote:
>> @@ -74,6 +74,9 @@ struct statx {
>> \&
>> /* File offset alignment for direct I/O reads */
>> __u32 stx_dio_read_offset_align;
>> +\&
>> + /* Direct I/O atomic write max opt limit */
>> + __u32 stx_atomic_write_unit_max_opt;
> Please align the member with the one above.
stx_dio_read_offset_align is actually misaligned (to the member above it):
/* Direct I/O atomic write limits */
__u32 stx_atomic_write_unit_min;
__u32 stx_atomic_write_unit_max;
__u32 stx_atomic_write_segments_max;
/* File offset alignment for direct I/O reads */
__u32 stx_dio_read_offset_align;
I'll just fix that separately.
Thanks,
John
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2] statx.2: Add stx_atomic_write_unit_max_opt
2025-06-19 13:10 ` John Garry
@ 2025-06-19 13:45 ` Alejandro Colomar
0 siblings, 0 replies; 8+ messages in thread
From: Alejandro Colomar @ 2025-06-19 13:45 UTC (permalink / raw)
To: John Garry; +Cc: linux-man, linux-fsdevel, hch, djwong, linux-xfs
[-- Attachment #1: Type: text/plain, Size: 1038 bytes --]
Hi John,
On Thu, Jun 19, 2025 at 02:10:27PM +0100, John Garry wrote:
> On 19/06/2025 12:05, Alejandro Colomar wrote:
> >> @@ -74,6 +74,9 @@ struct statx {
> >> \&
> >> /* File offset alignment for direct I/O reads */
> >> __u32 stx_dio_read_offset_align;
> >> +\&
> >> + /* Direct I/O atomic write max opt limit */
> >> + __u32 stx_atomic_write_unit_max_opt;
> > Please align the member with the one above.
>
> stx_dio_read_offset_align is actually misaligned (to the member above it):
>
> /* Direct I/O atomic write limits */
> __u32 stx_atomic_write_unit_min;
> __u32 stx_atomic_write_unit_max;
> __u32 stx_atomic_write_segments_max;
>
> /* File offset alignment for direct I/O reads */
> __u32 stx_dio_read_offset_align;
>
> I'll just fix that separately.
Ahh, thanks! I couldn't see that from the context. Makes sense. :)
Cheers,
Alex
--
<https://www.alejandro-colomar.es/>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] statx.2: Add stx_atomic_write_unit_max_opt
2025-06-19 11:05 ` Alejandro Colomar
2025-06-19 11:24 ` John Garry
2025-06-19 13:10 ` John Garry
@ 2025-06-19 21:34 ` G. Branden Robinson
2025-06-20 0:00 ` Alejandro Colomar
2 siblings, 1 reply; 8+ messages in thread
From: G. Branden Robinson @ 2025-06-19 21:34 UTC (permalink / raw)
To: linux-man
[-- Attachment #1: Type: text/plain, Size: 1080 bytes --]
[dropping all but linux-man@ since I'm addressing only a point of
typographical style]
Hi Alex,
At 2025-06-19T13:05:30+0200, Alejandro Colomar wrote:
> > +.I stx_atomic_write_unit_max
> > +and will not be less than the value in
> > +.I stx_atomic_write_unit_min.
>
> This should be IR, and the '.' separated by a space, so that the '.'
> is not in italics.
I recommend documenting your preference in this matter as a
linux-man-specific style convention.
To many eyes, having an italic correction between the slanted text and a
period looks bad when typeset. Including to me, although I admit when
viewing *roff terminal output where underlining is used to substitute
for italics, having a comma or period underlined _also_ looks weird/bad.
On the bright side, more and more terminal emulators are coming to
support slanted faces.
Further, since italics are (also) used for things that are not
necessarily literals, it's not necessarily the case that, grammatically,
the trailing punctuation should be set in a different face.
Regards,
Branden
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] statx.2: Add stx_atomic_write_unit_max_opt
2025-06-19 21:34 ` G. Branden Robinson
@ 2025-06-20 0:00 ` Alejandro Colomar
0 siblings, 0 replies; 8+ messages in thread
From: Alejandro Colomar @ 2025-06-20 0:00 UTC (permalink / raw)
To: G. Branden Robinson; +Cc: linux-man
[-- Attachment #1: Type: text/plain, Size: 1756 bytes --]
Hi Branden,
On Thu, Jun 19, 2025 at 04:34:32PM -0500, G. Branden Robinson wrote:
> [dropping all but linux-man@ since I'm addressing only a point of
> typographical style]
>
> Hi Alex,
>
> At 2025-06-19T13:05:30+0200, Alejandro Colomar wrote:
> > > +.I stx_atomic_write_unit_max
> > > +and will not be less than the value in
> > > +.I stx_atomic_write_unit_min.
> >
> > This should be IR, and the '.' separated by a space, so that the '.'
> > is not in italics.
>
> I recommend documenting your preference in this matter as a
> linux-man-specific style convention.
>
> To many eyes, having an italic correction between the slanted text and a
> period looks bad when typeset. Including to me, although I admit when
> viewing *roff terminal output where underlining is used to substitute
> for italics, having a comma or period underlined _also_ looks weird/bad.
> On the bright side, more and more terminal emulators are coming to
> support slanted faces.
>
> Further, since italics are (also) used for things that are not
> necessarily literals, it's not necessarily the case that, grammatically,
> the trailing punctuation should be set in a different face.
I never liked the american typography by which punctuation is put within
the quotes even if it's extraneous to them, and this seems the same kind
of thing. I confirm I want the period to be not part of quotes and also
not part of preceding formatting, regardless of being replaceable text
or anything else.
I guess I'll have to document this. I'll probably forget, so please
remind me again if I repeat this. :)
Have a lovely day!
Alex
P.S.: I'm in Colorado for 3 weeks. Are you around? :)
--
<https://www.alejandro-colomar.es/>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-06-20 0:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-19 9:05 [PATCH v2] statx.2: Add stx_atomic_write_unit_max_opt John Garry
2025-06-19 11:05 ` Alejandro Colomar
2025-06-19 11:24 ` John Garry
2025-06-19 11:30 ` Alejandro Colomar
2025-06-19 13:10 ` John Garry
2025-06-19 13:45 ` Alejandro Colomar
2025-06-19 21:34 ` G. Branden Robinson
2025-06-20 0:00 ` Alejandro Colomar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox