From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dong Fang Subject: Re: [PATCH] vfs: remove the unnecessrary code of fs/inode.c Date: Tue, 02 Jul 2013 02:11:34 -0400 Message-ID: <51D26F16.4040803@gmail.com> References: <1372681143-23465-1-git-send-email-yp.fangdong@gmail.com> <20130702044122.GJ4165@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Al Viro Return-path: In-Reply-To: <20130702044122.GJ4165@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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.