xfs
[Top] [All Lists]

Re: [PATCH v6] ext4: Add support FALLOC_FL_COLLAPSE_RANGE for fallocate

To: Namjae Jeon <linkinjeon@xxxxxxxxx>
Subject: Re: [PATCH v6] ext4: Add support FALLOC_FL_COLLAPSE_RANGE for fallocate
From: Theodore Ts'o <tytso@xxxxxxx>
Date: Wed, 26 Feb 2014 11:48:28 -0500
Cc: viro@xxxxxxxxxxxxxxxxxx, david@xxxxxxxxxxxxx, bpm@xxxxxxx, adilger.kernel@xxxxxxxxx, jack@xxxxxxx, mtk.manpages@xxxxxxxxx, lczerner@xxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, linux-ext4@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, Namjae Jeon <namjae.jeon@xxxxxxxxxxx>, Ashish Sangwan <a.sangwan@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=thunk.org; s=mail; t=1393433308; bh=Y0KOcpNEBR96BD83AtQeNfnBW5Utkrl0Y6UV1B4FFRU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=exB+CGuc/7JqZq02l7Md0WMZelt9b+6sf91gMYLCj67q2Uf0Urv2dHndj5Cva9TY4 YeaOJSwCquk21NYM9hLdLT87jWRPaI1USvlhQiARokwQUpk3gufYiItNqMF2ZcYif7 p7AqbiO/OB4WjhoAu3rgUPmtMUXflwNFapcxV4oA=
In-reply-to: <CAKYAXd9vTbjTnJOQ1Y=pi4QJSYj41fWsQgRD3Fkufskez2W-YA@xxxxxxxxxxxxxx>
Mail-followup-to: Theodore Ts'o <tytso@xxxxxxx>, Namjae Jeon <linkinjeon@xxxxxxxxx>, viro@xxxxxxxxxxxxxxxxxx, david@xxxxxxxxxxxxx, bpm@xxxxxxx, adilger.kernel@xxxxxxxxx, jack@xxxxxxx, mtk.manpages@xxxxxxxxx, lczerner@xxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, linux-ext4@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, Namjae Jeon <namjae.jeon@xxxxxxxxxxx>, Ashish Sangwan <a.sangwan@xxxxxxxxxxx>
References: <1392908861-3563-1-git-send-email-linkinjeon@xxxxxxxxx> <20140222170930.GE26637@xxxxxxxxx> <CAKYAXd9vTbjTnJOQ1Y=pi4QJSYj41fWsQgRD3Fkufskez2W-YA@xxxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Mon, Feb 24, 2014 at 10:22:10AM +0900, Namjae Jeon wrote:
> >> +  ret = ext4_es_remove_extent(inode, punch_start,
> >> +                              EXT_MAX_BLOCKS - punch_start - 1);
> >> +  if (ret) {
> >> +          up_write(&EXT4_I(inode)->i_data_sem);
> >> +          goto out_stop;
> >> +  }
> >
> > Doing this at first is probably a bad idea; you should do this at the
> > end, and then completely invalidate the es cache for that inode.  That
> > way, the right thing happens if you get an error in the middle
> > releasing the boxes and shifting the extents:
> Okay, I see.

Actually, thinking about this some more, we do want to do this first,
since if we error out, we do need to make sure the extent cache is
flushed.

> If there is error in the middle of extent shifting, the hole will
> present between the last shifted extent and the extent at which error
> happen so this will be consistent state.
> IMHO even if there is error in between the shift, filesystem will be
> in consistent state.
> Am I missing something?

No, I was wrong about that; you're right.  The file will be in an
inconsistent statement, which will probably be highly confusing for
the application, but the file system will be fine.

So I withdraw my complaints.  I'll do a bit more testing, but so far
the patch looks fine to me.  Thanks for your reply and your work!

                                        - Ted

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