[Top] [All Lists]

Re: [PATCH 1/6] fs: add hole punching to fallocate

To: Josef Bacik <josef@xxxxxxxxxx>
Subject: Re: [PATCH 1/6] fs: add hole punching to fallocate
From: Andreas Dilger <adilger@xxxxxxxxx>
Date: Wed, 17 Nov 2010 03:30:40 -0600
Cc: Dave Chinner <david@xxxxxxxxxxxxx>, Jan Kara <jack@xxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, linux-btrfs@xxxxxxxxxxxxxxx, linux-ext4@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, cmm@xxxxxxxxxx, cluster-devel@xxxxxxxxxx, ocfs2-devel@xxxxxxxxxxxxxx
In-reply-to: <20101117023456.GD5618@xxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <1289840723-3056-1-git-send-email-josef@xxxxxxxxxx> <1289840723-3056-2-git-send-email-josef@xxxxxxxxxx> <20101116111611.GA4757@xxxxxxxxxxxxx> <20101116114346.GB4757@xxxxxxxxxxxxx> <20101116125249.GB31957@xxxxxxxxxxxxxxxxxxxxxxxxxx> <20101116131451.GH4757@xxxxxxxxxxxxx> <18ACAA85-8847-4B12-9839-F99FB6C7B3E4@xxxxxxxxx> <20101117021150.GL22876@dastard> <20101117022814.GB5618@xxxxxxxxxxxxxxxxxxxxxxxxxx> <20101117023456.GD5618@xxxxxxxxxxxxxxxxxxxxxxxxxx>
On 2010-11-16, at 20:34, Josef Bacik wrote:
> FWIW I agree with Dave, the only question at this point is do we force users 
> to specify KEEP_SIZE with PUNCH_HOLE?  On one hand it makes the interface a 
> bit more consistent, on the other hand it makes the documentation a little 
> weird
> "We have mode here, but if you want to use PUNCH_HOLE you also have to 
> specify KEEP_SIZE, so really it's like a flags field it's just named poorly"

Even if this is the case, and we decide today that PUNCH_HOLE without KEEP_SIZE 
is not desirable to implement, it would be better to just return -EOPNOTSUPP if 
both flags are not set than assume one or the other is what the user wanted.  
That allows the ability to implement this in the future without breaking every 
application, while if it is assumed that KEEP_SIZE is always implicit there 
will never be a way to add that functionality without something awful like a 
separate CHANGE_SIZE flag for PUNCH_HOLE.

One option is to define FALLOC_FL_PUNCH_HOLE as 0x3 (so that KEEP_SIZE is 
always passed) and in the future we can define some new flag name like 
TRUNCATE_HOLE (or whatever) that is 0x2 only.

Cheers, Andreas

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