Re: [PATCH 09/17] fs: Make last_ino, iunique independent ofinode_lock

From: Andrew Morton
Date: Thu Sep 30 2010 - 00:52:05 EST


On Wed, 29 Sep 2010 22:18:41 +1000 Dave Chinner <david@xxxxxxxxxxxxx> wrote:

> From: Nick Piggin <npiggin@xxxxxxx>
>
> 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!

>
> ...
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/