Samba + exFAT : how to avoid pre-allocating when copying big files?

Jeremy Allison jra at
Tue Dec 8 04:21:32 UTC 2020

On Tue, Dec 08, 2020 at 12:18:43PM +0900, Namjae Jeon via samba-technical wrote:
>I didn't want to remove ftruncate before writing in samba. I mean that there is

Well the ftruncate call comes from the SetEndOfFile, not the write.
We don't call ftruncate on write.

>an improvement if exfat fallocate is implemented. One misunderstanding is that
>the FileEndOfFileInformation request must change the size of the file.

Yes it must (unless it's setting EOF to the same value as current EOF of course).
That's the purpose of the call.

>Because of that, We may not use keep size flags of fallocate(). BTW, Why do
>windows call FileEndOfFileInformation instead of FileAllocationInformation
>of smb2 setinfo before writing?

As Ronnie said,

FileEndOfFileInformation == ftruncate();

FileAllocationInformation == fallocate(.., FALLOC_FL_KEEP_SIZE, offset, len)

More information about the samba-technical mailing list