lkml.org 
[lkml]   [2010]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 08/35] fs: icache lock i_count
On 10/19/2010 05:42 AM, npiggin@kernel.dk wrote:
> Protect inode->i_count with i_lock, rather than having it atomic.
>
> Signed-off-by: Nick Piggin <npiggin@kernel.dk>
>
> ---
<>
> fs/exofs/inode.c | 12 +++++++---
> fs/exofs/namei.c | 4 ++-
<>
> Index: linux-2.6/fs/exofs/inode.c
> ===================================================================
> --- linux-2.6.orig/fs/exofs/inode.c 2010-10-19 14:17:26.000000000 +1100
> +++ linux-2.6/fs/exofs/inode.c 2010-10-19 14:19:18.000000000 +1100
> @@ -1107,7 +1107,9 @@
>

Hi Nick, Please use -p option in your diff(s) it is a bit hard to follow
and review without the proper function context. These patches are on a git
tree. Why don't you use git to produce and send these patches?

> set_obj_created(oi);
>
> - atomic_dec(&inode->i_count);
> + spin_lock(&inode->i_lock);
> + inode->i_count--;
> + spin_unlock(&inode->i_lock);

I've queued up a patch in Linux-next that will conflict with this.
The patch uses iput() instead.

> wake_up(&oi->i_wq);
> }
>
> @@ -1160,14 +1162,18 @@
> /* increment the refcount so that the inode will still be around when we
> * reach the callback
> */
> - atomic_inc(&inode->i_count);
> + spin_lock(&inode->i_lock);
> + inode->i_count++;
> + spin_unlock(&inode->i_lock);
>
> ios->done = create_done;
> ios->private = inode;
> ios->cred = oi->i_cred;
> ret = exofs_sbi_create(ios);
> if (ret) {
> - atomic_dec(&inode->i_count);
> + spin_lock(&inode->i_lock);
> + inode->i_count--;
> + spin_unlock(&inode->i_lock);

Here too. (iput)

> exofs_put_io_state(ios);
> return ERR_PTR(ret);
> }
> Index: linux-2.6/fs/exofs/namei.c
> ===================================================================
> --- linux-2.6.orig/fs/exofs/namei.c 2010-10-19 14:17:26.000000000 +1100
> +++ linux-2.6/fs/exofs/namei.c 2010-10-19 14:19:18.000000000 +1100
> @@ -153,7 +153,9 @@
>
> inode->i_ctime = CURRENT_TIME;
> inode_inc_link_count(inode);
> - atomic_inc(&inode->i_count);
> + spin_lock(&inode->i_lock);
> + inode->i_count++;

All these will change to inode_get(), right?

> + spin_unlock(&inode->i_lock);
>
> return exofs_add_nondir(dentry, inode);
> }

Thanks
Boaz


\
 
 \ /
  Last update: 2010-10-19 12:19    [W:1.260 / U:1.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site