From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [PATCH] vfs: remove the unnecessrary code of fs/inode.c Date: Tue, 2 Jul 2013 05:41:22 +0100 Message-ID: <20130702044122.GJ4165@ZenIV.linux.org.uk> References: <1372681143-23465-1-git-send-email-yp.fangdong@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Dong Fang Return-path: Content-Disposition: inline In-Reply-To: <1372681143-23465-1-git-send-email-yp.fangdong@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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.