All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: cmm@us.ibm.com, tytso@mit.edu, adilger@sun.com,
	linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: Fix ext4_bmap to flush the data to the disk with delalloc
Date: Thu, 19 Jun 2008 00:00:47 +0530	[thread overview]
Message-ID: <20080618183047.GA24400@skywalker> (raw)
In-Reply-To: <48594DF4.3060000@redhat.com>

On Wed, Jun 18, 2008 at 01:03:32PM -0500, Eric Sandeen wrote:
> Aneesh Kumar K.V wrote:
> > With delalloc we don't do block allocation in the write_begin/write_end.
> > So when using bmap we first need to flush data to the disk so that blocks
> > get allocated and then call generic_block_bmap.
> > 
> > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> > ---
> >  fs/ext4/inode.c |   11 +++++++++++
> >  1 files changed, 11 insertions(+), 0 deletions(-)
> > 
> > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> > index 7035621..cfeb869 100644
> > --- a/fs/ext4/inode.c
> > +++ b/fs/ext4/inode.c
> > @@ -1833,6 +1833,17 @@ sector_t ext4_bmap(struct address_space *mapping, sector_t block)
> >  	journal_t *journal;
> >  	int err;
> >  
> > +	if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY) &&
> > +			test_opt(inode->i_sb, DELALLOC)) {
> > +		/*
> > +		 * With delalloc we want to sync the file
> > +		 * so that we can make sure we allocate
> > +		 * blocks for file
> > +		 */
> > +		filemap_fdatawrite(mapping);
> > +		filemap_fdatawait(mapping);
> > +	}
> 
> This seems fine.
> 
> I wonder, does it make any sense at all to only do the flushing if the
> block we wish to map is actually in a delalloc state at the moment?
> 

I am not sure it is worth the complexity considering bmap is not a
frequently used API. Initially I was even thinking should i be doing
it only for delalloc. That test seems to be a simple one to put.

-aneesh

  reply	other threads:[~2008-06-18 18:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-18 17:52 [PATCH] ext4: Fix ext4_bmap to flush the data to the disk with delalloc Aneesh Kumar K.V
2008-06-18 18:03 ` Eric Sandeen
2008-06-18 18:30   ` Aneesh Kumar K.V [this message]
2008-06-18 22:26 ` Mingming
2008-06-19  3:29   ` Aneesh Kumar K.V

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=20080618183047.GA24400@skywalker \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=adilger@sun.com \
    --cc=cmm@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --cc=tytso@mit.edu \
    /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.