public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Mike Snitzer" <snitzer@gmail.com>
To: "Mingming Cao" <cmm@us.ibm.com>
Cc: linux-ext4@vger.kernel.org,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Steven Rostedt" <rostedt@goodmis.org>
Subject: Re: why unlikely(rsv) in ext3_clear_inode()?
Date: Mon, 27 Oct 2008 20:09:01 -0400	[thread overview]
Message-ID: <170fa0d20810271709v1c6738co68fe7db339b31557@mail.gmail.com> (raw)
In-Reply-To: <1225151532.6685.31.camel@mingming-laptop>

On Mon, Oct 27, 2008 at 7:52 PM, Mingming Cao <cmm@us.ibm.com> wrote:
>
> 在 2008-10-27一的 18:29 -0400,Mike Snitzer写道:
>> Please see: e6022603b9aa7d61d20b392e69edcdbbc1789969
>>
>> Having a look at the LKML archives this was raised back in 2006:
>> http://lkml.org/lkml/2006/6/23/337
>>
>> I'm not interested in whether unlikely() actually helps here.
>>
>> I'm still missing _why_ rsv is mostly NULL at this callsite, as Andrew
>> asserted here:
>> http://lkml.org/lkml/2006/6/23/400
>>
>> And then Steve here: http://lkml.org/lkml/2006/6/24/76
>> Where he said:
>> "The problem is that in these cases the pointer is NULL several thousands
>> of times for every time it is not NULL (if ever).  The non-NULL case is
>> where an error occurred or something very special.  So I don't see how
>> the if here is a problem?"
>>
>> I'm missing which error or what "something very special" is the
>> unlikely() reason for having rsv be NULL.
>>
>> Looking at the code; ext3_clear_inode() is _the_ place where the
>> i_block_alloc_info is cleaned up.  In my testing the rsv is _never_
>> NULL if the file was open for writing.  Are we saying that reads are
>> much more common than writes?  May be a reasonable assumption but
>> saying as much is very different than what Steve seemed to be eluding
>> to...
>>
>
> i_block_alloc_info as the structure to keep track of block
> reservation/allocation,  is dynamically allocated when file does need
> blocks. So rsv remains NULL even if file is open for rewrite,  until
> file is about to do block allocation.

Yes, i_block_alloc_info is only allocated when a block must be allocated...

I over simplified this by making the distinction of the file open for
writing.  My intent was to point out that allocating blocks for writes
isn't that uncommon.

I was mainly just looking for clarification on i_block_alloc_info's
life-cycle... based on Steve's comment from 2006 I thought I might be
missing something.  It doesn't really look like I was.

regards,
Mike

      reply	other threads:[~2008-10-28  0:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-27 22:29 why unlikely(rsv) in ext3_clear_inode()? Mike Snitzer
2008-10-27 22:53 ` Steven Rostedt
2008-10-27 23:32 ` Steven Rostedt
2008-10-27 23:48   ` Andrew Morton
2008-10-28  0:13   ` Theodore Tso
2008-10-28  0:21     ` Steven Rostedt
2008-10-28  0:14   ` Mike Snitzer
2008-10-27 23:52 ` Mingming Cao
2008-10-28  0:09   ` Mike Snitzer [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=170fa0d20810271709v1c6738co68fe7db339b31557@mail.gmail.com \
    --to=snitzer@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cmm@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=rostedt@goodmis.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