From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 7B6CF3858CDB; Fri, 1 Dec 2023 11:02:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B6CF3858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1701428537; bh=QpNv3dp6MET3pAr0esSp0nlqF83przLSCbktW9tz0J4=; h=Date:From:To:Subject:Reply-To:References:In-Reply-To:From; b=v4OgcLC+NC27U825xwOTcQE4/mwl0z6tLaF8soCZpe0kz+iIA3f7Ua+KUoe2iFbTm 6qQRoqNkLK6JHJpJz90SDGrMu18d3+Zo4wnht/F6xYA1FsJgV9kcFAdbB8/6TKMubO 6SvWxDbi3aRpUZdXZ5WNteRRySUlvkYEABup/NHY= Received: by calimero.vinschen.de (Postfix, from userid 500) id 7C86FA80C05; Fri, 1 Dec 2023 12:02:12 +0100 (CET) Date: Fri, 1 Dec 2023 12:02:12 +0100 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Cygwin api to punch a hole into a file? Message-ID: Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: 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