lkml.org 
[lkml]   [2010]   [Oct]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 01/14] fs: icache begin inode_lock lock breaking
Mark the occasion by open-coding the atomic_dec_and_lock from inode
refcounting, and replace it with an open coded equivalent. This is in
preparation for breaking the inode_lock into multiple locks (dec_and_lock can
only handle one lock at a time).

Signed-off-by: Nick Piggin <npiggin@kernel.dk>
---
fs/inode.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

Index: linux-2.6/fs/inode.c
===================================================================
--- linux-2.6.orig/fs/inode.c 2010-10-21 23:49:56.000000000 +1100
+++ linux-2.6/fs/inode.c 2010-10-21 23:50:49.000000000 +1100
@@ -26,6 +26,16 @@
#include <linux/posix_acl.h>

/*
+ * Icache locking
+ *
+ * Usage:
+ * inode_lock protects:
+ * everything
+ *
+ * Ordering:
+ * inode_lock
+ */
+/*
* This is needed for the following functions:
* - inode_has_buffers
* - invalidate_inode_buffers
@@ -1259,8 +1269,14 @@ void iput(struct inode *inode)
if (inode) {
BUG_ON(inode->i_state & I_CLEAR);

- if (atomic_dec_and_lock(&inode->i_count, &inode_lock))
+ /* open-code atomic_dec_and_lock */
+ if (atomic_add_unless(&inode->i_count, -1, 1))
+ return;
+ spin_lock(&inode_lock);
+ if (atomic_dec_and_test(&inode->i_count))
iput_final(inode);
+ else
+ spin_unlock(&inode_lock);
}
}
EXPORT_SYMBOL(iput);



\
 
 \ /
  Last update: 2010-10-21 15:25    [W:0.412 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site