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: Theodore Tso <tytso@mit.edu>, cmm@us.ibm.com, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 2/3] ext4: Clear the unwritten buffer_head flag properly
Date: Thu, 14 May 2009 11:10:02 +0530	[thread overview]
Message-ID: <20090514054002.GA7359@skywalker> (raw)
In-Reply-To: <4A0B17F8.3000402@redhat.com>

On Wed, May 13, 2009 at 01:56:56PM -0500, Eric Sandeen wrote:
> > 
> > I think it is good. But one thing missing in the commit message is,
> > what happens if we do a write to prealloc space. Since a
> > get_block(create = 1) is now split into __get_block(create = 0 )  and
> > __get_block(create = 1). That would mean if we pass a buffer head with
> > BH_Unwritten cleared we will have
> > 
> > 
> > 1) buffer_head as BH_Unwritten cleared.
> > 
> > 2) __get_block(create = 0 ) -> Since it is prealloc space we will have
> > BH_Unwritten set .
> 
> Why do we need to set BH_Unwritten on a !create call at all?
> 
> Or maybe another way of asking is, are there any !create callers of
> get_block who -want- BH_Unwritten set?
> 
> Which is to say, should we just not be setting BH_Unwritten in get_block
> in the !create case, ever?

It should only be set in the !create case. With create == 1, we would
have already converted the uninitialized extent to initialized one and
the buffer_head should not be unwritten at all. My understanding is
unwritten flag is used to indicate the buffer_head state between a
write_begin and write_page phase with delayed allocation. ie, when we
write to fallocate space, since we have delalloc enabled, we  just
do a block lookup (get_block with create = 0). The buffer_head returned
in the above case should have unwritten set so that during writepage
we do the actual block allocation (get_block writh create = 1)
looking at the flag.


> 
> The comment:
> 
>  	/*
> +	 * The above get_blocks can cause the buffer to be
> +	 * marked unwritten. So clear the same.
> +	 */
> +	clear_buffer_unwritten(bh);
> 
> is imho not helpful; to me it says "we -just- set this, so clear it!"
> It leaves me scratching my head.
> 
> > 3) __get_block(create = 1) -> get the blocks out of prealloc space.
> > and retun with BH_Mapped set. 
> > 
> > That would imply we have BH_Unwritten and BH_Mapped set in the above
> > case which is wrong. So we need a BH_Unwritten clear between (2) and
> > (3). The patch does the same. May be we need to capture it in commit
> > message.
> 
> Better in comments, I think.  :)
> 

-aneesh

  parent reply	other threads:[~2009-05-14  5:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-07 10:39 [PATCH 1/3] ext4: Properly initialize the buffer_head state Aneesh Kumar K.V
2009-05-07 10:39 ` [PATCH 2/3] ext4: Clear the unwritten buffer_head flag properly Aneesh Kumar K.V
2009-05-07 10:39   ` [PATCH 3/3] vfs: Add BUG_ON for delayed and unwritten extents in submit_bh Aneesh Kumar K.V
2009-05-07 15:37     ` Eric Sandeen
2009-05-12  3:17     ` Theodore Tso
2009-05-12  4:52       ` [PATCH 3/3] vfs: Add BUG_ON for delayed and unwritten extentsin submit_bh Aneesh Kumar K.V
2009-05-12 13:25         ` Eric Sandeen
2009-05-07 15:36   ` [PATCH 2/3] ext4: Clear the unwritten buffer_head flag properly Eric Sandeen
2009-05-08  8:12     ` Aneesh Kumar K.V
2009-05-12  3:08   ` Theodore Tso
2009-05-12  4:46     ` Aneesh Kumar K.V
2009-05-13 18:56       ` Eric Sandeen
2009-05-13 22:28         ` Theodore Tso
2009-05-14  6:00           ` Aneesh Kumar K.V
2009-05-14  5:40         ` Aneesh Kumar K.V [this message]
2009-05-14 13:14           ` Theodore Tso
2009-05-07 15:20 ` [PATCH 1/3] ext4: Properly initialize the buffer_head state Eric Sandeen
2009-05-10 23:57   ` Theodore Tso
2009-05-11  9:24     ` Aneesh Kumar K.V
2009-05-11 11:31       ` Theodore Tso
2009-05-11 14:49     ` Eric Sandeen
2009-05-12  3:17 ` Theodore Tso
2009-05-12  4:47   ` 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=20090514054002.GA7359@skywalker \
    --to=aneesh.kumar@linux.vnet.ibm.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.