public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Cygwin api to punch a hole into a file?
Date: Fri, 1 Dec 2023 12:02:12 +0100	[thread overview]
Message-ID: <ZWm9NNUlxdOunBGP@calimero.vinschen.de> (raw)
In-Reply-To: <CALXu0UcLK5AvrYDOg-9L2wFVhvjJuJre6X6GvL+5SyL744eygA@mail.gmail.com>

On Dec  1 11:22, Cedric Blancher via Cygwin wrote:
> I see the value of 128k (128*1024 bytes) quite often in your sparse
> file commits.

Yes, but they have been removed.  Read the patches again, especially commit
65831f88d6c4.

> Can you please make this value a per filesystem tunable?

No, because we don't have a facility for that.

> Not all filesystems have a 128k block/stripe size, and certainly most
> filesystems have smaller minimum hole sizes than 128k (e.g. 512bytes
> is common, ref pathconf _PC_MIN_HOLE_SIZE).

There's no _PC_MIN_HOLE_SIZE in Linux or POSIX.  In Windows, a sparse
file uses chunks of 64K.  You can see this even with a file of just
a single block.  Try this:

  $ touch x
  $ chattr +S x

  $ echo 1234567890123456789012345678901234567890123456789012345678901234567890123456789 >> x
  $ ls -ls x
  1 -rw-r--r-- 1 corinna vinschen 80 Dec  1 11:56 x

  [repeat echo and ls -ls until...]

  $ echo 1234567890123456789012345678901234567890123456789012345678901234567890123456789 >> x
  $ ls -ls x
  1 -rw-r--r-- 1 corinna vinschen 720 Dec  1 11:56 x
  $ echo 1234567890123456789012345678901234567890123456789012345678901234567890123456789 >> x
  $ ls -ls x
  64 -rw-r--r-- 1 corinna vinschen 800 Dec  1 11:56 x2
  ^^
  This

I don't know how Windows stores short files, maybe they are part of the
metadata up to a point or some such.  However, as soon as you raise the
size over a given point, the *allocation size* will be rounded up to 64K
and from that point on, it will be in 64K chunks.  Also sparsifying and
desparsifying of blocks only works in 64K chunks.


Corinna

  reply	other threads:[~2023-12-01 11:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23 22:36 Cedric Blancher
2023-11-24 11:01 ` Corinna Vinschen
2023-11-28 10:29   ` Corinna Vinschen
2023-12-01 10:22     ` Cedric Blancher
2023-12-01 11:02       ` Corinna Vinschen [this message]
2023-12-04 16:07         ` Andrey Repin
2023-12-05  6:36         ` Thomas Wolff
2023-12-05 13:53           ` Corinna Vinschen
2023-12-05 14:40             ` Thomas Wolff
2023-12-05 14:47               ` Thomas Wolff
2023-12-05 15:15                 ` Corinna Vinschen
2023-12-01 10:44     ` _PC_MIN_HOLE_SIZE pathconf() " Cedric Blancher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZWm9NNUlxdOunBGP@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).