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

Re: Buffering of short-lived writes (was: is there a way to use a work buffer in Linux bash? ...)



On Tue, Dec 30, 2025 at 11:26:28AM +0100, Nicolas George wrote:
> Henrique de Moraes Holschuh (HE12025-12-29):
> > The "does not even hit the underlying storage" behavior is a function
> > of the Linux page-cache, and most of the widely-used filesystems
> > (certainly ext4 and xfs) will behave like that unless specifically
> > configured to operate in "sync" mode.
> 
> Sure, but that raises all sorts of questions about HOW it is done.
> 
> For example what happens two files are submitted for writing, but the
> first one would use the last block of the device? The second one should
> error with No space left on device, but that would imply the free blocks
> were already updated to account for the first one before it could have
> reached the block device.

"No space left on device" is handled by the fs code, when it decides
where to put a block. No need to actually write the block to disk.
Possibly some fs's permanent data are updated and thus scheduled
for write -- again a job for the buffer cache, which has to honour
itself ordering constraints (what to write first, etc.)

This one [1] seems to be a good entry point into that.

Cheers

[1] https://www.thomas-krenn.com/en/wiki/Linux_Page_Cache_Basics

-- 
t
> 

Attachment: signature.asc
Description: PGP signature


Reply to: