smb3: update allocation size more accurately on write completion
authorSteve French <stfrench@microsoft.com>
Thu, 22 Feb 2024 06:26:52 +0000 (00:26 -0600)
committerSteve French <stfrench@microsoft.com>
Mon, 11 Mar 2024 00:33:54 +0000 (19:33 -0500)
commitdbfdff402d89854126658376cbcb08363194d3cd
treeb58716dd7bdf6ae67d0395a36dbec0cb166bd877
parent13c2e30809c751a81d7eb01897825f7221c94e3c
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).

Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/file.c