From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [PATCH 09/17] fs: Make last_ino, iunique independent of inode_lock Date: Wed, 29 Sep 2010 21:53:02 -0700 Message-ID: <20100929215302.1f4536be.akpm@linux-foundation.org> References: <1285762729-17928-1-git-send-email-david@fromorbit.com> <1285762729-17928-10-git-send-email-david@fromorbit.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Dave Chinner Return-path: In-Reply-To: <1285762729-17928-10-git-send-email-david@fromorbit.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Wed, 29 Sep 2010 22:18:41 +1000 Dave Chinner wrote: > From: Nick Piggin > > Before removing the inode_lock, we need to make the last_ino and iunique > counters independent of the inode_lock. last_ino can be trivially converted to > an atomic variable, while the iunique counter needs a new lock nested inside > the inode_lock to provide the same protection that the inode_lock previously > provided. > > > ... > > +static int test_inode_iunique(struct super_block * sb, struct hlist_head *head, unsigned long ino) > +{ > + struct hlist_node *node; > + struct inode * inode = NULL; > + > + spin_lock(&inode_hash_lock); > + hlist_for_each_entry(inode, node, head, i_hash) { > + if (inode->i_ino == ino && inode->i_sb == sb) { > + spin_unlock(&inode_hash_lock); > + return 0; > + } > + } > + spin_unlock(&inode_hash_lock); > + return 1; > +} Please run all the patches through checkpatch. Please document this function. Why does it exist? What does it do? How does it do it? Try to improve the code! > > ... >