From: Jan Kara <jack@suse.cz>
To: Zheng Liu <gnehzuil.liu@gmail.com>
Cc: Jan Kara <jack@suse.cz>, Ted Tso <tytso@mit.edu>,
linux-ext4@vger.kernel.org, Zheng Liu <wenqing.lz@taobao.com>
Subject: Re: [PATCH] ext4: Remove extent tree purging from ext4_da_page_release_reservation()
Date: Wed, 24 Jul 2013 22:05:36 +0200 [thread overview]
Message-ID: <20130724200536.GC27307@quack.suse.cz> (raw)
In-Reply-To: <20130719004439.GA21615@gmail.com>
Hi Zheng,
On Fri 19-07-13 08:44:39, Zheng Liu wrote:
> On Thu, Jul 18, 2013 at 12:10:15AM +0200, Jan Kara wrote:
> > ext4_da_page_release_reservation() gets called from
> > ext4_da_invalidatepage(). This function is used when we are truncating
> > page cache for punch hole or truncate operations. In either case these
> > operations take care of removing extents from the extent tree. This is
> > more efficient and the code in ext4_da_page_release_reservation() is
> > actually buggy anyway. So just remove it.
>
> I remember that I try to remove the entry from extent status tree here
> because at the end of this function it tries to relase the reserved
> space for delalloc. For 4k block we can simply release it because
> ->s_cluster_ratio == 1. But when bigalloc is enabled, we need to
> determine whether we can release the reserved space according to the
> result of ext4_find_delalloc_cluster() as the comment described. If we
> don't remove the entry from extent status tree here, we could lost some
> spaces that could be reused by other files. If I remember correctly, I
> have hitted a warning message when I run xfstests to test it. These
> days I try to trigger it using xfstests but I failed. Have you seen a
> prblem that is caused by this code? Maybe we need to refactor out the
> code and release the reserved space outside this function.
Ah, I see. No, I didn't observe any problem due to this code, I just
didn't understand why is it there. Also when blocksize < pagesize, the code
is wrong because delayed buffers to release need not be contiguous so
ext4_es_remove_extent(inode, lblk, to_release) may not free all the buffers
we want. But subsequent extent tree truncation in ext4_ext_truncate() hides
this problem.
So I think we might just change the condition:
if (to_release) {
to
if (to_release && sbi->s_cluster_ratio > 1) {
and add explanatory comment why cluster_ratio > 1 needs the truncation and
other cases don't. It will also save some needlessly burned CPU cycles
spent when manipulating extent tree.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2013-07-24 20:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-17 22:10 [PATCH] ext4: Remove extent tree purging from ext4_da_page_release_reservation() Jan Kara
2013-07-19 0:44 ` Zheng Liu
2013-07-24 20:05 ` Jan Kara [this message]
2013-07-25 11:52 ` Zheng Liu
2013-07-25 14:05 ` Jan Kara
2013-07-25 23:36 ` Zheng Liu
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=20130724200536.GC27307@quack.suse.cz \
--to=jack@suse.cz \
--cc=gnehzuil.liu@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=wenqing.lz@taobao.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.