SEEK_HOLE Support in Cygwin?

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Aug 21 08:32:58 GMT 2023


On Aug 21 06:33, Cedric Blancher wrote:
> On Thu, 10 Aug 2023 at 10:28, Corinna Vinschen
> <corinna-cygwin@cygwin.com> wrote:
> > On Aug 10 04:43, Cedric Blancher wrote:
> > > So this supports multiple holes in one file, right?
> >
> > Curious question.  Cygwin supports sparse files for ages.  Only the
> > lseek options SEEK_HOLE and SEEK_DATA are new.
> 
> Is SEEK_HOLE support enabled for MSFT NFSv3 client?

NFSv3 doesn't return the FILE_SUPPORTS_SPARSE_FILES capability and
doesn't support Windows sparse file functions.  Sparsification is
(correctly) the responsibility of the remote file system.

> > But, yes, it supports what Windows supports.  But note that Cygwin
> > *only* switches files to sparse, if you seek by more than 128K beyond
> > current EOF and then wrote something, or if you call truncate/ftruncate,
> > raising the filesize by more than 128K.
> 
> Where does the value of 128K come from? Is this a Windows limit,
> kernel tunable, or something from Cygwin?

Something from Cygwin.

> > In contrast to Linux, one has to sparsify a file explicitely on WIndows,
> > and that's Cygwin's strategy.
> 
> Maybe add a O_SPARSEFILE to open/openat()?

We won't add any non-standard or non-Linux open flags.  You can use
the chattr/lsattr tools.

> > > Why is "sparse" not the default mount option?
> >
> > It was, at one point long ago.  People complained that sparse file
> > access is slower than standard file access, so the "sparse" mount option
> > was added.
> 
> Do you have any refs in the mailing list?

Not without searching myself.


Corinna


More information about the Cygwin-developers mailing list