Re: [PATCH 03/26] netfs: Update i_blocks when write committed to pagecache
From: David Howells
Date: Tue Apr 16 2024 - 18:50:41 EST
Jeff Layton <jlayton@xxxxxxxxxx> wrote:
> > Update i_blocks when i_size is updated when we finish making a write to the
> > pagecache to reflect the amount of space we think will be consumed.
> >
>
> Umm ok, but why? I get that the i_size and i_blocks would be out of sync
> until we get back new attrs from the server, but is that a problem? I'm
> mainly curious as to what's paying attention to the i_blocks during this
> window.
This is taking over from a cifs patch that does the same thing - but in code
that is removed by my cifs-netfs branch, so I should probably let Steve speak
to that, though I think the problem with cifs is that these fields aren't
properly updated until the closure occurs and the server is consulted.
commit dbfdff402d89854126658376cbcb08363194d3cd
Author: Steve French <stfrench@xxxxxxxxxxxxx>
Date: Thu Feb 22 00:26:52 2024 -0600
smb3: update allocation size more accurately on write completion
Changes to allocation size are approximated for extending writes of cached
files until the server returns the actual value (on SMB3 close or query info
for example), but it was setting the estimated value for number of blocks
to larger than the file size even if the file is likely sparse which
breaks various xfstests (e.g. generic/129, 130, 221, 228).
When i_size and i_blocks are updated in write completion do not increase
allocation size more than what was written (rounded up to 512 bytes).
David