From: Liu Bo <obuil.liubo@gmail.com>
To: David Sterba <dsterba@suse.cz>, Liu Bo <obuil.liubo@gmail.com>,
Liu Bo <bo.liu@linux.alibaba.com>,
linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: do not abort transaction when failing to insert hole extent
Date: Wed, 11 Apr 2018 18:39:30 -0700 [thread overview]
Message-ID: <CANQeFDB9RERAaTiuz=Qda4HKjRz7J_JTy2RLuqdoAddg+QkcBQ@mail.gmail.com> (raw)
In-Reply-To: <20180410121214.GC2817@twin.jikos.cz>
On Tue, Apr 10, 2018 at 5:12 AM, David Sterba <dsterba@suse.cz> wrote:
> On Mon, Apr 09, 2018 at 06:23:14PM -0700, Liu Bo wrote:
>> >>> As maybe_insert_hole is only called by btrfs_cont_expand here, which
>> >>> means it's a really hole, I don't expect drop_extents would drop
>> >>> anything, we can remove this drop_extents and put an assert after
>> >>> btrfs_insert_file_extent for checking EEXIST.
>> >> Sounds good.
>> > Let me make a v2 and have a fstests run.
>> It turns out that the btrfs_drop_extents() here is quite necessary
>> since fallocate(2) has a FALLOC_FL_KEEP_SIZE option, and when that
>> happens, a hole extent would be appended between the EOF and fallocate
>> range's start, then a later truncate up would have to drop these hole
>> extents in order to expand with a new hole...
>
> Would it make sense to split the cases where FALLOC_FL_KEEP_SIZE is and
> is not used? Either passing an argument or 2 functions where one could
> avoid the drop. I've looked at the code only briefly, so this may be a
> nonsense in the end.
>
I'm afraid that It won't work as there is no way I could think of to
know whether an inode has been fallocate with KEEP_SIZE, IOW, seems
that we have to do a search to check if there are extra extents beyond
EOF.
thanks,
liubo
>> As I don't see a way to gracefully solve this except keeping
>> drop_extents(), lets drop this patch instead.
>
> Understood.
prev parent reply other threads:[~2018-04-12 1:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-30 22:11 [PATCH] Btrfs: do not abort transaction when failing to insert hole extent Liu Bo
2018-04-05 16:48 ` David Sterba
2018-04-05 18:58 ` Liu Bo
2018-04-06 13:21 ` David Sterba
2018-04-06 17:43 ` Liu Bo
2018-04-10 1:23 ` Liu Bo
2018-04-10 12:12 ` David Sterba
2018-04-12 1:39 ` Liu Bo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CANQeFDB9RERAaTiuz=Qda4HKjRz7J_JTy2RLuqdoAddg+QkcBQ@mail.gmail.com' \
--to=obuil.liubo@gmail.com \
--cc=bo.liu@linux.alibaba.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).