[patch 01/14] fs: icache begin inode_lock lock breaking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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);


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


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux