Linux Manual Pages development
 help / color / mirror / Atom feed
* Inaccurate description of statx(2) stx_blksize field?
@ 2026-04-22 10:37 Zeno Endemann
  2026-04-22 10:58 ` Alejandro Colomar
  0 siblings, 1 reply; 2+ messages in thread
From: Zeno Endemann @ 2026-04-22 10:37 UTC (permalink / raw)
  To: alx; +Cc: linux-man

Hi,

Currently, the documentation of stx_blksize in statx says:

 > The "preferred" block size for efficient filesystem I/O.
 > (Writing to a file in smaller chunks may cause an
 > inefficient read-modify-rewrite.)

I believe this is misleading; For ext4 this field is set
to the ext4 block size, but in that context "block size"
refers to the "smallest allocation unit" (which is chosen
at file system creation time, see the mkfs.ext4 -b option)
and not the most efficient I/O size that avoids the need
for read-modify-rewrite.

At least to my understanding, to avoid such a read-modify-
rewrite you rather want to do writes in multiples of the
page size (i.e. sysconf(PAGESIZE)), since that is the unit
the page cache operates on.

While in many cases ext4 will have a block size equal to
the page size, I think it is strictly better to use the
page size directly for that purpose. Or am I mistaken?


Thanks,
Zeno Endemann

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Inaccurate description of statx(2) stx_blksize field?
  2026-04-22 10:37 Inaccurate description of statx(2) stx_blksize field? Zeno Endemann
@ 2026-04-22 10:58 ` Alejandro Colomar
  0 siblings, 0 replies; 2+ messages in thread
From: Alejandro Colomar @ 2026-04-22 10:58 UTC (permalink / raw)
  To: Zeno Endemann; +Cc: linux-man, Theodore Ts'o

[-- Attachment #1: Type: text/plain, Size: 1207 bytes --]

[CC += Ted]

Hi,

On 2026-04-22T12:37:43+0200, Zeno Endemann wrote:
> Hi,
> 
> Currently, the documentation of stx_blksize in statx says:
> 
> > The "preferred" block size for efficient filesystem I/O.
> > (Writing to a file in smaller chunks may cause an
> > inefficient read-modify-rewrite.)
> 
> I believe this is misleading; For ext4 this field is set
> to the ext4 block size, but in that context "block size"
> refers to the "smallest allocation unit" (which is chosen
> at file system creation time, see the mkfs.ext4 -b option)
> and not the most efficient I/O size that avoids the need
> for read-modify-rewrite.
> 
> At least to my understanding, to avoid such a read-modify-
> rewrite you rather want to do writes in multiples of the
> page size (i.e. sysconf(PAGESIZE)), since that is the unit
> the page cache operates on.
> 
> While in many cases ext4 will have a block size equal to
> the page size, I think it is strictly better to use the
> page size directly for that purpose. Or am I mistaken?

I don't know.  You should CC someone expert about file systems when
asking fs questions.


Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-22 10:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-22 10:37 Inaccurate description of statx(2) stx_blksize field? Zeno Endemann
2026-04-22 10:58 ` Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox