linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 15/30] smbfs: Convert server->sem to mutex
       [not found] <20100907124636.880953480@linutronix.de>
@ 2010-09-07 14:32 ` Thomas Gleixner
  2010-09-10 12:46   ` Jeff Layton
  2010-09-07 14:32 ` [patch 16/30] hpfs: Convert sbi->hpfs_creation_de " Thomas Gleixner
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 6+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:32 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Al Viro, linux-fsdevel

[-- Attachment #1: smbfs-sema-to-mutex.patch --]
[-- Type: text/plain, Size: 1729 bytes --]

server->sem is used as mutex so make it a mutex.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org

---
 fs/smbfs/inode.c          |    2 +-
 include/linux/smb_fs_sb.h |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

Index: linux-2.6/fs/smbfs/inode.c
===================================================================
--- linux-2.6.orig/fs/smbfs/inode.c
+++ linux-2.6/fs/smbfs/inode.c
@@ -536,7 +536,7 @@ static int smb_fill_super(struct super_b
 	server->mnt = NULL;
 	server->sock_file = NULL;
 	init_waitqueue_head(&server->conn_wq);
-	init_MUTEX(&server->sem);
+	mutex_init(&server->mutex);
 	INIT_LIST_HEAD(&server->entry);
 	INIT_LIST_HEAD(&server->xmitq);
 	INIT_LIST_HEAD(&server->recvq);
Index: linux-2.6/include/linux/smb_fs_sb.h
===================================================================
--- linux-2.6.orig/include/linux/smb_fs_sb.h
+++ linux-2.6/include/linux/smb_fs_sb.h
@@ -58,7 +58,7 @@ struct smb_sb_info {
 	struct smb_conn_opt opt;
 	wait_queue_head_t conn_wq;
 	int conn_complete;
-	struct semaphore sem;
+	struct mutex mutex;
 
 	unsigned char      header[SMB_HEADER_LEN + 20*2 + 2];
 	u32                header_len;
@@ -82,19 +82,19 @@ struct smb_sb_info {
 static inline int
 smb_lock_server_interruptible(struct smb_sb_info *server)
 {
-	return down_interruptible(&(server->sem));
+	return mutex_lock_interruptible(&server->mutex);
 }
 
 static inline void
 smb_lock_server(struct smb_sb_info *server)
 {
-	down(&(server->sem));
+	mutex_lock(&server->mutex);
 }
 
 static inline void
 smb_unlock_server(struct smb_sb_info *server)
 {
-	up(&(server->sem));
+	mutex_unlock(&server->mutex);
 }
 
 #endif



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch 16/30] hpfs: Convert sbi->hpfs_creation_de to mutex
       [not found] <20100907124636.880953480@linutronix.de>
  2010-09-07 14:32 ` [patch 15/30] smbfs: Convert server->sem to mutex Thomas Gleixner
@ 2010-09-07 14:32 ` Thomas Gleixner
  2010-09-07 14:33 ` [patch 17/30] hpfsplus: Convert tree_lock " Thomas Gleixner
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:32 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Al Viro, linux-fsdevel

[-- Attachment #1: hpfs-sema-to-mutex.patch --]
[-- Type: text/plain, Size: 2040 bytes --]

sbi->hpfs_creation_de is used as mutex so make it a mutex.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org

---
 fs/hpfs/buffer.c  |    4 ++--
 fs/hpfs/hpfs_fn.h |    2 +-
 fs/hpfs/super.c   |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6/fs/hpfs/buffer.c
===================================================================
--- linux-2.6.orig/fs/hpfs/buffer.c
+++ linux-2.6/fs/hpfs/buffer.c
@@ -14,7 +14,7 @@ void hpfs_lock_creation(struct super_blo
 #ifdef DEBUG_LOCKS
 	printk("lock creation\n");
 #endif
-	down(&hpfs_sb(s)->hpfs_creation_de);
+	mutex_lock(&hpfs_sb(s)->hpfs_creation_de);
 }
 
 void hpfs_unlock_creation(struct super_block *s)
@@ -22,7 +22,7 @@ void hpfs_unlock_creation(struct super_b
 #ifdef DEBUG_LOCKS
 	printk("unlock creation\n");
 #endif
-	up(&hpfs_sb(s)->hpfs_creation_de);
+	mutex_unlock(&hpfs_sb(s)->hpfs_creation_de);
 }
 
 /* Map a sector into a buffer and return pointers to it and to the buffer. */
Index: linux-2.6/fs/hpfs/hpfs_fn.h
===================================================================
--- linux-2.6.orig/fs/hpfs/hpfs_fn.h
+++ linux-2.6/fs/hpfs/hpfs_fn.h
@@ -87,7 +87,7 @@ struct hpfs_sb_info {
 	unsigned *sb_bmp_dir;		/* main bitmap directory */
 	unsigned sb_c_bitmap;		/* current bitmap */
 	unsigned sb_max_fwd_alloc;	/* max forwad allocation */
-	struct semaphore hpfs_creation_de; /* when creating dirents, nobody else
+	struct mutex hpfs_creation_de;	/* when creating dirents, nobody else
 					   can alloc blocks */
 	/*unsigned sb_mounting : 1;*/
 	int sb_timeshift;
Index: linux-2.6/fs/hpfs/super.c
===================================================================
--- linux-2.6.orig/fs/hpfs/super.c
+++ linux-2.6/fs/hpfs/super.c
@@ -487,7 +487,7 @@ static int hpfs_fill_super(struct super_
 	sbi->sb_bmp_dir = NULL;
 	sbi->sb_cp_table = NULL;
 
-	init_MUTEX(&sbi->hpfs_creation_de);
+	mutex_init(&sbi->hpfs_creation_de);
 
 	uid = current_uid();
 	gid = current_gid();

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch 17/30] hpfsplus: Convert tree_lock to mutex
       [not found] <20100907124636.880953480@linutronix.de>
  2010-09-07 14:32 ` [patch 15/30] smbfs: Convert server->sem to mutex Thomas Gleixner
  2010-09-07 14:32 ` [patch 16/30] hpfs: Convert sbi->hpfs_creation_de " Thomas Gleixner
@ 2010-09-07 14:33 ` Thomas Gleixner
  2010-09-07 14:33 ` [patch 18/30] hfs: " Thomas Gleixner
  2010-09-07 14:33 ` [patch 19/30] affs: use sema_init instead of init_MUTEX Thomas Gleixner
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Al Viro, linux-fsdevel

[-- Attachment #1: hpfs-plus-sema-to-mutex.patch --]
[-- Type: text/plain, Size: 1901 bytes --]

tree_lock is used as mutex so make it a mutex.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org

---
 fs/hfsplus/bfind.c      |    4 ++--
 fs/hfsplus/btree.c      |    2 +-
 fs/hfsplus/hfsplus_fs.h |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6/fs/hfsplus/bfind.c
===================================================================
--- linux-2.6.orig/fs/hfsplus/bfind.c
+++ linux-2.6/fs/hfsplus/bfind.c
@@ -23,7 +23,7 @@ int hfs_find_init(struct hfs_btree *tree
 	fd->search_key = ptr;
 	fd->key = ptr + tree->max_key_len + 2;
 	dprint(DBG_BNODE_REFS, "find_init: %d (%p)\n", tree->cnid, __builtin_return_address(0));
-	down(&tree->tree_lock);
+	mutex_lock(&tree->tree_lock);
 	return 0;
 }
 
@@ -32,7 +32,7 @@ void hfs_find_exit(struct hfs_find_data 
 	hfs_bnode_put(fd->bnode);
 	kfree(fd->search_key);
 	dprint(DBG_BNODE_REFS, "find_exit: %d (%p)\n", fd->tree->cnid, __builtin_return_address(0));
-	up(&fd->tree->tree_lock);
+	mutex_unlock(&fd->tree->tree_lock);
 	fd->tree = NULL;
 }
 
Index: linux-2.6/fs/hfsplus/btree.c
===================================================================
--- linux-2.6.orig/fs/hfsplus/btree.c
+++ linux-2.6/fs/hfsplus/btree.c
@@ -30,7 +30,7 @@ struct hfs_btree *hfs_btree_open(struct 
 	if (!tree)
 		return NULL;
 
-	init_MUTEX(&tree->tree_lock);
+	mutex_init(&tree->tree_lock);
 	spin_lock_init(&tree->hash_lock);
 	tree->sb = sb;
 	tree->cnid = id;
Index: linux-2.6/fs/hfsplus/hfsplus_fs.h
===================================================================
--- linux-2.6.orig/fs/hfsplus/hfsplus_fs.h
+++ linux-2.6/fs/hfsplus/hfsplus_fs.h
@@ -62,7 +62,7 @@ struct hfs_btree {
 	unsigned int depth;
 
 	//unsigned int map1_size, map_size;
-	struct semaphore tree_lock;
+	struct mutex tree_lock;
 
 	unsigned int pages_per_bnode;
 	spinlock_t hash_lock;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch 18/30] hfs: Convert tree_lock to mutex
       [not found] <20100907124636.880953480@linutronix.de>
                   ` (2 preceding siblings ...)
  2010-09-07 14:33 ` [patch 17/30] hpfsplus: Convert tree_lock " Thomas Gleixner
@ 2010-09-07 14:33 ` Thomas Gleixner
  2010-09-07 14:33 ` [patch 19/30] affs: use sema_init instead of init_MUTEX Thomas Gleixner
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Al Viro, linux-fsdevel

[-- Attachment #1: hfs-sema-to-mutex.patch --]
[-- Type: text/plain, Size: 1845 bytes --]

tree_lock is used as mutex so make it a mutex.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org

---
 fs/hfs/bfind.c |    4 ++--
 fs/hfs/btree.c |    2 +-
 fs/hfs/btree.h |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6/fs/hfs/bfind.c
===================================================================
--- linux-2.6.orig/fs/hfs/bfind.c
+++ linux-2.6/fs/hfs/bfind.c
@@ -23,7 +23,7 @@ int hfs_find_init(struct hfs_btree *tree
 	fd->search_key = ptr;
 	fd->key = ptr + tree->max_key_len + 2;
 	dprint(DBG_BNODE_REFS, "find_init: %d (%p)\n", tree->cnid, __builtin_return_address(0));
-	down(&tree->tree_lock);
+	mutex_lock(&tree->tree_lock);
 	return 0;
 }
 
@@ -32,7 +32,7 @@ void hfs_find_exit(struct hfs_find_data 
 	hfs_bnode_put(fd->bnode);
 	kfree(fd->search_key);
 	dprint(DBG_BNODE_REFS, "find_exit: %d (%p)\n", fd->tree->cnid, __builtin_return_address(0));
-	up(&fd->tree->tree_lock);
+	mutex_unlock(&fd->tree->tree_lock);
 	fd->tree = NULL;
 }
 
Index: linux-2.6/fs/hfs/btree.c
===================================================================
--- linux-2.6.orig/fs/hfs/btree.c
+++ linux-2.6/fs/hfs/btree.c
@@ -27,7 +27,7 @@ struct hfs_btree *hfs_btree_open(struct 
 	if (!tree)
 		return NULL;
 
-	init_MUTEX(&tree->tree_lock);
+	mutex_init(&tree->tree_lock);
 	spin_lock_init(&tree->hash_lock);
 	/* Set the correct compare function */
 	tree->sb = sb;
Index: linux-2.6/fs/hfs/btree.h
===================================================================
--- linux-2.6.orig/fs/hfs/btree.h
+++ linux-2.6/fs/hfs/btree.h
@@ -33,7 +33,7 @@ struct hfs_btree {
 	unsigned int depth;
 
 	//unsigned int map1_size, map_size;
-	struct semaphore tree_lock;
+	struct mutex tree_lock;
 
 	unsigned int pages_per_bnode;
 	spinlock_t hash_lock;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch 19/30] affs: use sema_init instead of init_MUTEX
       [not found] <20100907124636.880953480@linutronix.de>
                   ` (3 preceding siblings ...)
  2010-09-07 14:33 ` [patch 18/30] hfs: " Thomas Gleixner
@ 2010-09-07 14:33 ` Thomas Gleixner
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Al Viro, linux-fsdevel

[-- Attachment #1: afs-sema.patch --]
[-- Type: text/plain, Size: 730 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org

---
 fs/affs/super.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/fs/affs/super.c
===================================================================
--- linux-2.6.orig/fs/affs/super.c
+++ linux-2.6/fs/affs/super.c
@@ -109,8 +109,8 @@ static void init_once(void *foo)
 {
 	struct affs_inode_info *ei = (struct affs_inode_info *) foo;
 
-	init_MUTEX(&ei->i_link_lock);
-	init_MUTEX(&ei->i_ext_lock);
+	sema_init(&ei->i_link_lock, 1);
+	sema_init(&ei->i_ext_lock, 1);
 	inode_init_once(&ei->vfs_inode);
 }
 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch 15/30] smbfs: Convert server->sem to mutex
  2010-09-07 14:32 ` [patch 15/30] smbfs: Convert server->sem to mutex Thomas Gleixner
@ 2010-09-10 12:46   ` Jeff Layton
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Layton @ 2010-09-10 12:46 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra,
	Christoph Hellwig, Al Viro, linux-fsdevel

On Tue, 07 Sep 2010 14:32:52 -0000
Thomas Gleixner <tglx@linutronix.de> wrote:

> server->sem is used as mutex so make it a mutex.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: linux-fsdevel@vger.kernel.org
> 
> ---
>  fs/smbfs/inode.c          |    2 +-
>  include/linux/smb_fs_sb.h |    8 ++++----
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> Index: linux-2.6/fs/smbfs/inode.c
> ===================================================================
> --- linux-2.6.orig/fs/smbfs/inode.c
> +++ linux-2.6/fs/smbfs/inode.c
> @@ -536,7 +536,7 @@ static int smb_fill_super(struct super_b
>  	server->mnt = NULL;
>  	server->sock_file = NULL;
>  	init_waitqueue_head(&server->conn_wq);
> -	init_MUTEX(&server->sem);
> +	mutex_init(&server->mutex);
>  	INIT_LIST_HEAD(&server->entry);
>  	INIT_LIST_HEAD(&server->xmitq);
>  	INIT_LIST_HEAD(&server->recvq);
> Index: linux-2.6/include/linux/smb_fs_sb.h
> ===================================================================
> --- linux-2.6.orig/include/linux/smb_fs_sb.h
> +++ linux-2.6/include/linux/smb_fs_sb.h
> @@ -58,7 +58,7 @@ struct smb_sb_info {
>  	struct smb_conn_opt opt;
>  	wait_queue_head_t conn_wq;
>  	int conn_complete;
> -	struct semaphore sem;
> +	struct mutex mutex;
>  
>  	unsigned char      header[SMB_HEADER_LEN + 20*2 + 2];
>  	u32                header_len;
> @@ -82,19 +82,19 @@ struct smb_sb_info {
>  static inline int
>  smb_lock_server_interruptible(struct smb_sb_info *server)
>  {
> -	return down_interruptible(&(server->sem));
> +	return mutex_lock_interruptible(&server->mutex);
>  }
>  
>  static inline void
>  smb_lock_server(struct smb_sb_info *server)
>  {
> -	down(&(server->sem));
> +	mutex_lock(&server->mutex);
>  }
>  
>  static inline void
>  smb_unlock_server(struct smb_sb_info *server)
>  {
> -	up(&(server->sem));
> +	mutex_unlock(&server->mutex);
>  }
>  
>  #endif
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


Seems harmless...

Acked-by: Jeff Layton <jlayton@redhat.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-09-10 12:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20100907124636.880953480@linutronix.de>
2010-09-07 14:32 ` [patch 15/30] smbfs: Convert server->sem to mutex Thomas Gleixner
2010-09-10 12:46   ` Jeff Layton
2010-09-07 14:32 ` [patch 16/30] hpfs: Convert sbi->hpfs_creation_de " Thomas Gleixner
2010-09-07 14:33 ` [patch 17/30] hpfsplus: Convert tree_lock " Thomas Gleixner
2010-09-07 14:33 ` [patch 18/30] hfs: " Thomas Gleixner
2010-09-07 14:33 ` [patch 19/30] affs: use sema_init instead of init_MUTEX Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).