delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/03/08/04:44:19

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F1CE385B509
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1709891057;
bh=YLi8DZxu18gmlyOIfAXqqHvmXtjzQSvuT0GBRdMZTRA=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=rx66JwGZHe3G0rz2xFv6M//y0ZWbZEB6My7f+qsUhUPMJD86Oy44w1tTzgVWuleFw
wPe/aiQnqm+0dTPznXWa4V9TEpkJdVbpyAiBssv7O89g8OHPOxPkQrVqR/9d1nLhUP
P+vG4RI8/jpdWjysdq6ZNwdlJOQTWlcD503j19aI=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 06D593858D35
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 06D593858D35
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709890996; cv=none;
b=dwzjsgvVnxFqDSQqd2raMC852HUZJ+zmoyyEY+EwDe3hIGEDePRWMDRuMHtrodeVIdX4vYfNsf/EsBGhLZK4KSfh/JMlesRVKKqcVkQaosr1QBYUCfosazuVO8bAvthl2DaikqwVAXd2uP+8eIsrNdvVBwzK61mOB6KGEFCUhOc=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1709890996; c=relaxed/simple;
bh=SoIxiHKDLMbe8D1UGZvfGWTVOryIr9vnEOwSzvAiaYs=;
h=Message-ID:Date:MIME-Version:Subject:To:From;
b=hQeTLZ6LpnbC9DUvbM2qD452+fs1obbRW6D5DT1hdz+QBgMCj8+uGfxW3PxIaYiOZ33jDz64K9cCFs3KJpO9/3HQgpRwpmseFfLpb28eg/sqlpdHH5wR2OJIXAwvUlzBqUyTubGP3VCPV7j0nYLOhdUYOXOaYZTTsTnh3E3YCYc=
ARC-Authentication-Results: i=1; server2.sourceware.org
Message-ID: <90c44b42-9092-4ea0-aa90-a178cda30108@maxrnd.com>
Date: Fri, 8 Mar 2024 01:43:05 -0800
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: /usr/bin/fallocate -v -d -l 2 myfile takes forever
To: cygwin AT cygwin DOT com
References: <CALXu0UeXUwCjY+WVwXA2X68XGEcm63SPPOPQtO-ZiDKFqXYW5w AT mail DOT gmail DOT com>
<e01112b1-a8c9-4aa9-a5a2-5827187106dd AT maxrnd DOT com>
<1de1f9f9-f8ee-45bf-9c63-fd151b6714f7 AT maxrnd DOT com>
<CALXu0UdUXGPsbuwBhyT-_W7GXdsNw7=VYQvWS15d3fvJfyj7qg AT mail DOT gmail DOT com>
<cbfc3310-d359-4edf-94c4-fe8d998f5e14 AT maxrnd DOT com>
In-Reply-To: <cbfc3310-d359-4edf-94c4-fe8d998f5e14@maxrnd.com>
X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, BODY_8BITS,
KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP,
T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Mark Geisert via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Mark Geisert <mark AT maxrnd DOT com>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 4289iI0a295415

On 3/5/2024 2:43 AM, Mark Geisert via Cygwin wrote:
> On 3/5/2024 12:46 AM, Cedric Blancher via Cygwin wrote:
>> On Mon, 29 Jan 2024 at 10:46, Mark Geisert via Cygwin 
>> <cygwin AT cygwin DOT com> wrote:
>>>
>>> On 1/28/2024 11:56 PM, Mark Geisert via Cygwin wrote:
>>>> On 1/28/2024 10:44 PM, Cedric Blancher via Cygwin wrote:
>>>>> Good morning!
>>>>>
>>>>> rm -f myfile
>>>>> touch myfile
>>>>> /usr/bin/fallocate -v -d -l myfile takes forever with latest Cygwin 
>>>>> 3.5
>>>>                                ^ length goes here, before filename
>>>>
>>>> I believe you need to
>>>>       chattr +S myfile
>>>> after the 'touch' to make the file sparsifiable.
>>>>
>>>> Also, I'm unsure if '-d' makes sense when initially allocating a sparse
>>>> file.  If I leave it off, fallocate does the right thing.
>>>>
>>>> I'm separately investigating the 'takes forever' report.
>>>
>>> It's taking forever because it's in an infinite loop looking for data
>>> followed by a hole, which is not present in a new file being created.
>>> This is due to the '-d' option being specified.  fallocate ought to
>>> diagnose this condition rather than looping forever, but here we are.
>>>
>>> It's possible we have an old fallocate from an old util-linux package.
>>> I'll try to investigate this further when I have time.
>>>
>>
>> Any update on this issue?
> 
> Thanks for the reminder. I'll check repology to see if we can maybe 
> support a newer util-linux. No guarantees its fallocate is any better, 
> but lets first see if it builds at all. Give me a couple days, please.

A newer util-linux package has been uploaded. I find that its fallocate 
operates identically to the earlier one for your example.  So, to 
summarize, when allocating a brand new file:
   1) don't specify '-d' option,
   2) after creating file with 'touch', do 'chattr +S' on it,
   3) using fallocate on the file without step 2 won't sparsify it.

It's easier to see fallocate is working properly by giving it a file 
size large enough to make a difference by sparsifying. My testing shows 
that specifying '-l 2m' to create a 2MB file makes the file occupy 64 
blocks if it's sparsified, 2048 blocks if it isn't. Use 'stat <file>' to 
get the block size of the file. 'ls -l' will show 2MB either way.
HTH,

..mark


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019