lkml.org 
[lkml]   [2010]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 14/18] fs: Protect inode->i_state with th einode->i_lock
On Fri, Oct 08, 2010 at 04:21:28PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> We currently protect the per-inode state flags with the inode_lock.
> Using a global lock to protect per-object state is overkill when we
> coul duse a per-inode lock to protect the state. Use the
> inode->i_lock for this, and wrap all the state changes and checks
> with the inode->i_lock.
>
> Based on work originally written by Nick Piggin.

> @@ -884,9 +897,9 @@ struct inode *new_inode(struct super_block *sb)
> inode = alloc_inode(sb);
> if (inode) {
> spin_lock(&inode_lock);
> - __inode_add_to_lists(sb, NULL, inode);
> inode->i_ino = ++last_ino;
> inode->i_state = 0;
> + __inode_add_to_lists(sb, NULL, inode);
> spin_unlock(&inode_lock);
> }
> return inode;

What's the point in doing this move?

> @@ -953,8 +966,8 @@ static struct inode *get_new_inode(struct super_block *sb,
> if (set(inode, data))
> goto set_failed;
>
> - __inode_add_to_lists(sb, b, inode);
> inode->i_state = I_NEW;
> + __inode_add_to_lists(sb, b, inode);

Same here.



Otherwise it looks good. But all this moving around of i_lock really
hurts my brain. I guess I'll need to review the placement on a tree
with the fully applied series again.


Reviewed-by: Christoph Hellwig <hch@lst.de>


\
 
 \ /
  Last update: 2010-10-08 09:51    [W:0.377 / U:1.564 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site