linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-ext4@vger.kernel.org
Subject: Re: no buffers in ext4_writepage?
Date: Tue, 15 Jun 2010 11:41:32 -0500	[thread overview]
Message-ID: <4C17AD3C.6080502@redhat.com> (raw)
In-Reply-To: <20100615162957.GA14500@infradead.org>

Christoph Hellwig wrote:
> ext4_writepage currently has a and else case after the
> page_has_buffers() check where it does I/O if there are no buffers
> attached.  But given how ext4 uses a write_begin method that always
> creates buffer, the normal set_page_dirty which creates buffers
> and a ->page_mkwrite that creates buffers I just can't see how that case
> can happen at all.


It was all added from:

commit f0e6c98593eb8a77edb7dd0edb22bb9f9368c567
Author: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Date:   Fri Jul 11 19:27:31 2008 -0400

    ext4: Handle page without buffers in ext4_*_writepage()
    
    It can happen that buffers are removed from the page before it gets
    marked dirty and then is passed to writepage().  In writepage() we just
    initialize the buffers and check whether they are mapped and non
    delay. If they are mapped and non delay we write the page. Otherwise we
    mark them dirty.  With this change we don't do block allocation at all
    in ext4_*_write_page.
    
    writepage() can get called under many condition and with a locking order
    of journal_start -> lock_page, we should not try to allocate blocks in
    writepage() which get called after taking page lock.  writepage() can
    get called via shrink_page_list even with a journal handle which was
    created for doing inode update.  For example when doing
    ext4_da_write_begin we create a journal handle with credit 1 expecting a
    i_disksize update for the inode. But ext4_da_write_begin can cause
    shrink_page_list via _grab_page_cache. So having a valid handle via
    ext4_journal_current_handle is not a guarantee that we can use the
    handle for block allocation in writepage, since we shouldn't be using
    credits that had been reserved for other updates.  That it could result
    in we running out of credits when we update inodes.
    
    Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
    Signed-off-by: Mingming Cao <cmm@us.ibm.com>
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>


FWIW...

-Eric

      reply	other threads:[~2010-06-15 17:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15 16:29 no buffers in ext4_writepage? Christoph Hellwig
2010-06-15 16:41 ` Eric Sandeen [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=4C17AD3C.6080502@redhat.com \
    --to=sandeen@redhat.com \
    --cc=hch@infradead.org \
    --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 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).