SMB2 SET_ZERO_DATA and PUNCH_HOLE

David Disseldorp ddiss at samba.org
Fri May 3 21:08:03 UTC 2019


On Thu, 25 Apr 2019 17:23:56 +1000, ronnie sahlberg wrote:

> Folks.
> 
> In the cifs client  we use FSCTL_SET_ZERO_DATA when userspace wants to
> punch a hole in a file. SET_ZERO_DATA maps quite well to the
> PUNCH_HOLE semantics in that it will deallocate what it can and
> overwrite what it can not with 0.

Cool, I'd be interested to hear how things go when testing against
a Samba SMB2+ server - it similarly maps FSCTL_SET_ZERO_DATA to
PUNCH_HOLE.

> On windows 16/ntfs the deallocate blocksize is 64k.
> 
> Does anyone know if this is always 64k or if there is a way to query
> the server for this?

smbtorture4 includes a sparse_hole_dealloc test for checking this via
incremental ZERO_DATA + QAR requests:
https://git.samba.org/?p=samba.git;a=blob;f=source4/torture/smb2/ioctl.c#l3981

I don't recall seeing anything non-64k at the time, but I didn't check
that thoroughly.

Cheers, David



More information about the samba-technical mailing list