linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* SMB2 SET_ZERO_DATA and PUNCH_HOLE
@ 2019-04-25  7:23 ronnie sahlberg
  2019-04-25 16:29 ` Tom Talpey
  2019-05-03 21:08 ` David Disseldorp
  0 siblings, 2 replies; 3+ messages in thread
From: ronnie sahlberg @ 2019-04-25  7:23 UTC (permalink / raw)
  To: linux-cifs, Steve French

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.

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?

regards
ronnie sahlberg

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: SMB2 SET_ZERO_DATA and PUNCH_HOLE
  2019-04-25  7:23 SMB2 SET_ZERO_DATA and PUNCH_HOLE ronnie sahlberg
@ 2019-04-25 16:29 ` Tom Talpey
  2019-05-03 21:08 ` David Disseldorp
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Talpey @ 2019-04-25 16:29 UTC (permalink / raw)
  To: ronnie sahlberg, linux-cifs, Steve French

> -----Original Message-----
> From: linux-cifs-owner@vger.kernel.org <linux-cifs-owner@vger.kernel.org> On
> Behalf Of ronnie sahlberg
> Sent: Thursday, April 25, 2019 3:24 AM
> To: linux-cifs <linux-cifs@vger.kernel.org>; Steve French
> <smfrench@gmail.com>
> Subject: SMB2 SET_ZERO_DATA and PUNCH_HOLE
> 
> 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.
> 
> On windows 16/ntfs the deallocate blocksize is 64k.

This processing is defined in MS-FSA section 2.1.5.9.35 and it's not a constant
but is dependent on a number of filesystem parameters, primarily the cluster
size (aka the "allocation unit").

> Does anyone know if this is always 64k or if there is a way to query
> the server for this?

Cluster size can be queried via filesystem-specific fsctl's, but beware the special
cases... 

Tom.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: SMB2 SET_ZERO_DATA and PUNCH_HOLE
  2019-04-25  7:23 SMB2 SET_ZERO_DATA and PUNCH_HOLE ronnie sahlberg
  2019-04-25 16:29 ` Tom Talpey
@ 2019-05-03 21:08 ` David Disseldorp
  1 sibling, 0 replies; 3+ messages in thread
From: David Disseldorp @ 2019-05-03 21:08 UTC (permalink / raw)
  To: ronnie sahlberg; +Cc: linux-cifs, Steve French, Samba Technical

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-03 21:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-25  7:23 SMB2 SET_ZERO_DATA and PUNCH_HOLE ronnie sahlberg
2019-04-25 16:29 ` Tom Talpey
2019-05-03 21:08 ` David Disseldorp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).