Skip to contentSkip to conversation

sem2mutex: HPFS

PATCH New Ingo Molnar 1 participant 1 message Jan 14, 2006 Hpfs filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sem2mutex: HPFS

From: Ingo Molnar <[email protected]>

semaphore to mutex conversion.

the conversion was generated via scripts, and the result was validated automatically via a script as well.

build tested.

----

 fs/hpfs/hpfs_fn.h |    5 ++--
 fs/hpfs/inode.c   |   10 ++++-----
 fs/hpfs/namei.c   |   60 +++++++++++++++++++++++++++---------------------------
 fs/hpfs/super.c   |    4 +--
 4 files changed, 40 insertions(+), 39 deletions(-)
fs/hpfs/hpfs_fn.h +3 -2
Index: linux/fs/hpfs/hpfs_fn.h
===================================================================
@@ -9,6 +9,7 @@
 //#define DBG
 //#define DEBUG_LOCKS
 
+#include <linux/mutex.h>
 #include <linux/pagemap.h>
 #include <linux/buffer_head.h>
 #include <linux/hpfs_fs.h>
@@ -57,8 +58,8 @@ struct hpfs_inode_info {
 	unsigned i_ea_uid : 1;	/* file's uid is stored in ea */
 	unsigned i_ea_gid : 1;	/* file's gid is stored in ea */
 	unsigned i_dirty : 1;
-	struct semaphore i_sem;
-	struct semaphore i_parent;
+	struct mutex i_mutex;
+	struct mutex i_parent_mutex;
 	loff_t **i_rddir_off;
 	struct inode vfs_inode;
 };
fs/hpfs/inode.c +5 -5
Index: linux/fs/hpfs/inode.c
===================================================================
@@ -186,9 +186,9 @@ void hpfs_write_inode(struct inode *i)
 		kfree(hpfs_inode->i_rddir_off);
 		hpfs_inode->i_rddir_off = NULL;
 	}
-	down(&hpfs_inode->i_parent);
+	mutex_lock(&hpfs_inode->i_parent_mutex);
 	if (!i->i_nlink) {
-		up(&hpfs_inode->i_parent);
+		mutex_unlock(&hpfs_inode->i_parent_mutex);
 		return;
 	}
 	parent = iget_locked(i->i_sb, hpfs_inode->i_parent_dir);
@@ -199,14 +199,14 @@ void hpfs_write_inode(struct inode *i)
 			hpfs_read_inode(parent);
 			unlock_new_inode(parent);
 		}
-		down(&hpfs_inode->i_sem);
+		mutex_lock(&hpfs_inode->i_mutex);
 		hpfs_write_inode_nolock(i);
-		up(&hpfs_inode->i_sem);
+		mutex_unlock(&hpfs_inode->i_mutex);
 		iput(parent);
 	} else {
 		mark_inode_dirty(i);
 	}
-	up(&hpfs_inode->i_parent);
+	mutex_unlock(&hpfs_inode->i_parent_mutex);
 }
 
 void hpfs_write_inode_nolock(struct inode *i)
fs/hpfs/namei.c +30 -30

167 lines not on this page · raw message

fs/hpfs/super.c +2 -2
Index: linux/fs/hpfs/super.c
===================================================================
@@ -181,8 +181,8 @@ static void init_once(void * foo, kmem_c
 
 	if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
 	    SLAB_CTOR_CONSTRUCTOR) {
-		init_MUTEX(&ei->i_sem);
-		init_MUTEX(&ei->i_parent);
+		mutex_init(&ei->i_mutex);
+		mutex_init(&ei->i_parent_mutex);
 		inode_init_once(&ei->vfs_inode);
 	}
 }