SMB3 Unix extensions
David Disseldorp
ddiss at suse.de
Tue May 2 10:58:41 UTC 2017
On Mon, 1 May 2017 08:05:45 -0700, Christoph Hellwig via samba-technical wrote:
> > and this is plumbed down into source3/lib/system.c:sys_fallocate().
> >
> > You get to this via SMB2 ioctl FSCTL_SET_ZERO_DATA.
>
> Note that in Linux FALLOC_FL_PUNCH_HOLE will release space allocated
> in the range as much as possible, thus creating a sparse file.
>
> If you just want to zero the range the flag to use is
> FALLOC_FL_ZERO_RANGE.
>
> The SMB2 ioctl sounds closer to the latter at least by name, I haven't
> found a definition of the semantics.
FSCTL_SET_ZERO_DATA is defined in MS-FSCC 2.3.67. Deallocation is
permitted via the clause:
How an implementation zeros data within a file is
implementation-dependent. A file system MAY choose to deallocate
regions of disk space that have been zeroed.
If a file is marked non-sparse (and strict-allocate is configured),
then we reallocate the punched region. I left a todo to use
FL_ZERO_RANGE for non-sparse files in future:
* File marked non-sparse and "strict allocate" is enabled -
* allocate the range that we just punched out.
* In future FALLOC_FL_ZERO_RANGE could be used exclusively for
* this, but it's currently only supported on XFS and ext4.
...looks like it's still missing from Btrfs.
Cheers, David
More information about the samba-technical
mailing list