xfs
[Top] [All Lists]

Re: [PATCH 17/19] xfsprogs: disable truncating of files

To: jtulak@xxxxxxxxxx
Subject: Re: [PATCH 17/19] xfsprogs: disable truncating of files
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Fri, 8 Apr 2016 10:09:10 +1000
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1458818136-56043-18-git-send-email-jtulak@xxxxxxxxxx>
References: <1458818136-56043-1-git-send-email-jtulak@xxxxxxxxxx> <1458818136-56043-18-git-send-email-jtulak@xxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Mar 24, 2016 at 12:15:34PM +0100, jtulak@xxxxxxxxxx wrote:
> From: Jan Tulak <jtulak@xxxxxxxxxx>
> 
> Unify mkfs.xfs behaviour a bit and never truncate files. If the user
> is trying to mkfs an existing file, we don't want to destroy anything
> he did with the file before (sparse file, allocations...)

Why not? We do that with discard-by-default to block devices,
O_TRUNC is exactly the same situation with a file - we completely
re-initialise the file from a known state if mkfs has been asked to
create the file.


> @@ -1059,9 +1063,9 @@ check_device_type(
>       }
>  
>       /*
> -      * We only want to completely truncate and recreate an existing file if
> -      * we were specifically told it was a file. Set the create flag only in
> -      * this case to trigger that behaviour.
> +      * We only want to create a file only if we were specifically told
> +      * we want a file. Set the create flag only in this case to trigger
> +      * that behaviour.
>        */
>       if (S_ISREG(statbuf.st_mode)) {
>               if (!*isfile)

i.e. this situation.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>