lkml.org 
[lkml]   [2010]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 01/10] smbfs: Convert server->sem to mutex
The semaphore server->sem is used as mutex. Rename it to server->mutex
and convert it to a real mutex.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Jeff Layton <jlayton@redhat.com>
Cc: Steve French <sfrench@us.ibm.com>

---
fs/smbfs/inode.c | 2 +-
include/linux/smb_fs_sb.h | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
Index: linux-2.6-tip/fs/smbfs/inode.c
===================================================================
--- linux-2.6-tip.orig/fs/smbfs/inode.c
+++ linux-2.6-tip/fs/smbfs/inode.c
@@ -530,7 +530,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-tip/include/linux/smb_fs_sb.h
===================================================================
--- linux-2.6-tip.orig/include/linux/smb_fs_sb.h
+++ linux-2.6-tip/include/linux/smb_fs_sb.h
@@ -57,7 +57,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;
@@ -79,19 +79,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



\
 
 \ /
  Last update: 2010-01-29 21:43    [W:0.214 / U:0.384 seconds]
©2003-2014 Jasper Spaans. hosted at Digital Ocean