public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dong Fang <yp.fangdong@gmail.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vfs: remove the unnecessrary code of fs/inode.c
Date: Tue, 02 Jul 2013 02:11:34 -0400	[thread overview]
Message-ID: <51D26F16.4040803@gmail.com> (raw)
In-Reply-To: <20130702044122.GJ4165@ZenIV.linux.org.uk>

On 07/02/2013 12:41 AM, Al Viro wrote:
> On Mon, Jul 01, 2013 at 08:19:03AM -0400, Dong Fang wrote:
>> These functions, such as find_inode_fast() and find_inode(), iget_lock() and
>> iget5_lock(), insert_inode_locked() and insert_inode_locked4(), almost have
>> the same code.
>
> NAK.  These functions exist exactly because the variant with callbacks
> costs more.  We walk the hash chain and for each inode on it your
> variant would result in
> 	* call
> 	* fetching ino from memory
> 	* comparison (and storing result in general-purpose register)
> 	* return
> 	* checking that register and branch on the result of that check
> What's more, the whole thing's not fun for branch predictor.
>
> It is a hot enough path to warrant a special-cased variant; if we can't
> get away with that, we use the variants with callbacks, but on filesystems
> where ->i_ino is sufficient as search key we really want to avoid the
> overhead.
>

that's right, i didn't think of it, but i think may be we can remove
the deduplicate codes of iget_lock() and iget5_lock() function, right?

if ok, i will send a new patch later. :)

thx Viro.

  reply	other threads:[~2013-07-02  6:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-01 12:19 [PATCH] vfs: remove the unnecessrary code of fs/inode.c Dong Fang
2013-07-02  4:15 ` Gu Zheng
2013-07-02  6:00   ` Dong Fang
2013-07-02  4:41 ` Al Viro
2013-07-02  6:11   ` Dong Fang [this message]
2013-07-02  6:22     ` Dong Fang

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=51D26F16.4040803@gmail.com \
    --to=yp.fangdong@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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