xfs
[Top] [All Lists]

Re: [PATCH 4/6] Ext4: fail if we try to use hole punch

To: Josef Bacik <josef@xxxxxxxxxx>
Subject: Re: [PATCH 4/6] Ext4: fail if we try to use hole punch
From: Greg Freemyer <greg.freemyer@xxxxxxxxx>
Date: Tue, 16 Nov 2010 12:47:20 -0800
Cc: Avi Kivity <avi@xxxxxxxxxx>, david@xxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-btrfs@xxxxxxxxxxxxxxx, linux-ext4@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, cmm@xxxxxxxxxx, cluster-devel@xxxxxxxxxx, ocfs2-devel@xxxxxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=/UoOis9BtKWderD2lmt6nHVVztkB7IJA1Ask2khYg5I=; b=SN6tGxZCTsLhzSj+VpTd7EFJ0T8KN1OGMOQvpxI56hQBz36Ig1PgS4p48Rxntn9clN QOCh1TtVRi43ra5raZndGtS0PJqd0v+V8+m8TNlSeH+WWZ/iGJNJyJVTQxtwy4HdGus2 OnrzSzcDSWAQyiJtYgK/WK2hNPRmzcjhozb84=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=mcL3pzGxVx48Wf/ToqzUslmc7y7W4yD9O+zaWqGy8ALzvy+FwT0LGIPYnzvMzsXvhy uh/2PkX/XTP4gIHc1mpudpMlfe1g/bh88rRUOtvSHs6jTTEKC6Zr3bE1uCQe7rCjRGWH FHLzTcQJquGHdLF4cFEO0V7eokrcJD1G54uEI=
In-reply-to: <20101116160545.GA2524@xxxxxxxxxxxxxxxxxxxxx>
References: <1289840723-3056-1-git-send-email-josef@xxxxxxxxxx> <1289840723-3056-5-git-send-email-josef@xxxxxxxxxx> <4CE2783F.1020004@xxxxxxxxxx> <20101116125016.GA31957@xxxxxxxxxxxxxxxxxxxxxxxxxx> <4CE28211.6060204@xxxxxxxxxx> <20101116160545.GA2524@xxxxxxxxxxxxxxxxxxxxx>
On Tue, Nov 16, 2010 at 8:05 AM, Josef Bacik <josef@xxxxxxxxxx> wrote:
> On Tue, Nov 16, 2010 at 03:07:29PM +0200, Avi Kivity wrote:
>> On 11/16/2010 02:50 PM, Josef Bacik wrote:
>>> On Tue, Nov 16, 2010 at 02:25:35PM +0200, Avi Kivity wrote:
>>> >  On 11/15/2010 07:05 PM, Josef Bacik wrote:
>>> >>  Ext4 doesn't have the ability to punch holes yet, so make sure we return
>>> >>  EOPNOTSUPP if we try to use hole punching through fallocate.  This 
>>> >> support can
>>> >>  be added later.  Thanks,
>>> >>
>>> >
>>> >  Instead of teaching filesystems to fail if they don't support the
>>> >  capability, why don't supporting filesystems say so, allowing the fail
>>> >  code to be in common code?
>>> >
>>>
>>> There is no simple way to test if a filesystem supports hole punching or 
>>> not so
>>> the check has to be done per fs.  Thanks,
>>
>> Could put a flag word in superblock_operations.  Filesystems which
>> support punching (or other features) can enable it there.
>>
>> Or even have its own callback.
>>
>
> Sure but then you have to do the same thing for every other flag you add to
> fallocate and then you have this huge mess of random flags just so you don't
> call into the filesystem.  This way is a lesser of two evils I think.  Thanks,
>
> Josef

I'm not a true kernel hacker, so my opinion is not critical but I find
it hard to read / expand as

> +     /* We only support the FALLOC_FL_KEEP_SIZE mode */
> +     if (mode && (mode != FALLOC_FL_KEEP_SIZE))
> +             return -EOPNOTSUPP;

How about:

#define EXT4_FALLOC_MODES_SUPPORTED (FALLOC_FL_KEEP_SIZE)

if (modes & ~EXT4_FALLOC_MODES_SUPPORTED)
             return -EOPNOTSUPP;


Greg

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