From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Mingming Cao <cmm@us.ibm.com>
Cc: jack@suse.cz, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: Need clear buffer_delay after page writeout for delayed allocation
Date: Tue, 3 Jun 2008 15:37:34 +0530 [thread overview]
Message-ID: <20080603100734.GB16102@skywalker> (raw)
In-Reply-To: <1212468198.3636.116.camel@localhost.localdomain>
On Mon, Jun 02, 2008 at 09:43:18PM -0700, Mingming Cao wrote:
> >
> > Buffer marked as delay is also mapped
> > fs/ext4/inode.c
> >
> > 1437 map_bh(bh_result, inode->i_sb, 0);
> > 1438 set_buffer_new(bh_result);
> > 1439 set_buffer_delay(bh_result);
> >
> >
> I find a better place to handle this, it make sense to clear this bit in
> block_write_full_page() after get_block() returns successfully. This
> handles partial error case smoothly. Updated patch below (to replace the
> original patch)
>
> ext4: Need clear buffer_delay in block_write_full_page() after allocation
>
> From: Mingming Cao <cmm@us.ibm.com>
>
> Normally delayed buffer could be cleared in mpage_da_map_blocks(), after
> blocks are successfully allocated. But if allocation failed, it will
> keep buffer_delay marked and deferring to later
> ext4_da_writepage()(via block_write_full_page()) to do block allocation.
> This patch handles clear bh delay bit in this case. Clear buffer_delay
> in block_write_full_page() after the block is allocated.
>
> This patch also fixed a bug in block_write_full_page() error case, we need
> to check the delayed flag before flush bh to disk when trying to recover from
> error.
>
> Signed-off-by: Mingming Cao <cmm@us.ibm.com>
>
> ---
> fs/buffer.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> Index: linux-2.6.26-rc4/fs/buffer.c
> ===================================================================
> --- linux-2.6.26-rc4.orig/fs/buffer.c 2008-06-02 21:34:30.000000000 -0700
> +++ linux-2.6.26-rc4/fs/buffer.c 2008-06-02 21:35:17.000000000 -0700
> @@ -1697,6 +1697,7 @@ static int __block_write_full_page(struc
> err = get_block(inode, block, bh, 1);
> if (err)
> goto recover;
> + clear_buffer_delay(bh);
I still think we should clear the buffer_head delay bit in the get_block
rather than the callers. That way all the callers will be returned the
buffer_head with delay bit cleared. We do that for mapped and new bit
already.
> if (buffer_new(bh)) {
> /* blockdev mappings never come here */
> clear_buffer_new(bh);
> @@ -1775,7 +1776,8 @@ recover:
> bh = head;
> /* Recovery: lock and submit the mapped buffers */
> do {
> - if (buffer_mapped(bh) && buffer_dirty(bh)) {
> + if (buffer_mapped(bh) && buffer_dirty(bh)
> + && !buffer_delay(bh)) {
> lock_buffer(bh);
> mark_buffer_async_write(bh);
> } else {
>
>
This should be a separate bug fix patch. If we fail the allocation of a
block marked delay we should not write it.
-aneesh
prev parent reply other threads:[~2008-06-03 10:07 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-30 13:39 [PATCH -v2] delalloc and journal locking order inversion fixes Aneesh Kumar K.V
2008-05-30 13:39 ` [PATCH] ext4: Use page_mkwrite vma_operations to get mmap write notification Aneesh Kumar K.V
2008-05-30 13:39 ` [PATCH] ext4: Inverse locking order of page_lock and transaction start Aneesh Kumar K.V
2008-05-30 13:39 ` [PATCH] vfs: Move mark_inode_dirty() from under page lock in generic_write_end() Aneesh Kumar K.V
2008-05-30 13:39 ` [PATCH] ext4: Add validation to jbd lock inversion patch and split and writepage Aneesh Kumar K.V
2008-05-30 13:39 ` [PATCH] ext4: inverse locking ordering of page_lock and transaction start in delalloc Aneesh Kumar K.V
2008-05-30 13:39 ` [PATCH] ext4: Fix delalloc sync hang with journal lock inversion Aneesh Kumar K.V
2008-06-02 9:35 ` Jan Kara
2008-06-02 9:59 ` Aneesh Kumar K.V
2008-06-02 10:27 ` Jan Kara
2008-06-05 13:54 ` Aneesh Kumar K.V
2008-06-05 16:22 ` Jan Kara
2008-06-05 19:19 ` Aneesh Kumar K.V
2008-06-11 12:41 ` Jan Kara
2008-06-11 13:56 ` Aneesh Kumar K.V
2008-06-11 17:48 ` Jan Kara
2008-06-12 23:10 ` Mingming Cao
2008-06-02 9:31 ` [PATCH] ext4: Add validation to jbd lock inversion patch and split and writepage Jan Kara
2008-06-02 9:52 ` Aneesh Kumar K.V
2008-06-02 10:40 ` Jan Kara
2008-05-30 17:51 ` [PATCH -v2] delalloc and journal locking order inversion fixes Mingming
2008-06-01 21:10 ` [PATCH] ext4: Need clear buffer_delay after page writeout for delayed allocation Mingming Cao
2008-06-02 3:14 ` Aneesh Kumar K.V
2008-06-02 3:50 ` Mingming Cao
2008-06-02 4:09 ` Aneesh Kumar K.V
2008-06-02 5:38 ` Mingming Cao
2008-06-02 6:35 ` Aneesh Kumar K.V
2008-06-02 7:04 ` Mingming Cao
2008-06-02 8:05 ` Aneesh Kumar K.V
2008-06-03 4:43 ` Mingming Cao
2008-06-03 10:07 ` Aneesh Kumar K.V [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=20080603100734.GB16102@skywalker \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=cmm@us.ibm.com \
--cc=jack@suse.cz \
--cc=linux-ext4@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 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.