This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Create new files as sparse on NT systems. (2nd try)


On Mon, Feb 17, 2003 at 07:20:42PM +0100, Vaclav Haisman wrote:
>>That's nice.  Did you read the bit above where I quoted MSDN?  Merely
>>setting the file as sparse will NOT SAVE SPACE on Windows.  So, no
>>space gain, and a performance penalty of untested magnitude.  I see
>>only disadvantages.
>
>Oh yes, it will.  Some applications do lseek() on rather long
>distances, then write few bytes, then do another lseek() etc.  Without
>this Windows will physicaly write zeros to the file which takes time
>and space.  With this patch regions of the file between the written
>bytes are not written to the file and do not occupy any space.  Judging
>by http://linux-ntfs.sourceforge.net/ntfs/concepts/data_runs.html there
>seems to be same amount of metada as in case of non-sparse file.

lseeks were what I was thinking of when I suggested just following the UNIX
convention.

Is anyone willing to run a few simple benchmarks to see if there is a
drawback to turning sparseness on for everything on an NTFS file system?

Btw, now that I've said that it occurred to me to check
GetVolumeInformation.  There is apparently a FILE_SUPPORTS_SPARSE_FILES
flag available.  That's the ultimate way to deal with this rather than
adding a wincap, I believe.  Check (pc->fs.flags &
FILE_SUPPORTS_SPARSE_FILES) in fhandler_disk_file::open and do the
appropriate thing there.

Sorry I didn't think of this before.

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]