diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-23 06:00:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 10:38:13 -0500 |
commit | 82d4dc5adb0055393248ad4ab8de392fac708a12 (patch) | |
tree | 9827f519dc04c76138fac0ee90d1cc34ac9af24b | |
parent | f85221dd74f2708b78a2aa54de59944e44206d0e (diff) |
[PATCH] sem2mutex: drivers/block/nbd.c
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Paul Clements <Paul.Clements@steeleye.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/block/nbd.c | 16 | ||||
-rw-r--r-- | include/linux/nbd.h | 3 |
2 files changed, 10 insertions, 9 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 6997d8e6bfb5..a9bde30dadad 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -459,9 +459,9 @@ static void do_nbd_request(request_queue_t * q) | |||
459 | req->errors = 0; | 459 | req->errors = 0; |
460 | spin_unlock_irq(q->queue_lock); | 460 | spin_unlock_irq(q->queue_lock); |
461 | 461 | ||
462 | down(&lo->tx_lock); | 462 | mutex_lock(&lo->tx_lock); |
463 | if (unlikely(!lo->sock)) { | 463 | if (unlikely(!lo->sock)) { |
464 | up(&lo->tx_lock); | 464 | mutex_unlock(&lo->tx_lock); |
465 | printk(KERN_ERR "%s: Attempted send on closed socket\n", | 465 | printk(KERN_ERR "%s: Attempted send on closed socket\n", |
466 | lo->disk->disk_name); | 466 | lo->disk->disk_name); |
467 | req->errors++; | 467 | req->errors++; |
@@ -484,7 +484,7 @@ static void do_nbd_request(request_queue_t * q) | |||
484 | } | 484 | } |
485 | 485 | ||
486 | lo->active_req = NULL; | 486 | lo->active_req = NULL; |
487 | up(&lo->tx_lock); | 487 | mutex_unlock(&lo->tx_lock); |
488 | wake_up_all(&lo->active_wq); | 488 | wake_up_all(&lo->active_wq); |
489 | 489 | ||
490 | spin_lock_irq(q->queue_lock); | 490 | spin_lock_irq(q->queue_lock); |
@@ -534,9 +534,9 @@ static int nbd_ioctl(struct inode *inode, struct file *file, | |||
534 | 534 | ||
535 | case NBD_CLEAR_SOCK: | 535 | case NBD_CLEAR_SOCK: |
536 | error = 0; | 536 | error = 0; |
537 | down(&lo->tx_lock); | 537 | mutex_lock(&lo->tx_lock); |
538 | lo->sock = NULL; | 538 | lo->sock = NULL; |
539 | up(&lo->tx_lock); | 539 | mutex_unlock(&lo->tx_lock); |
540 | file = lo->file; | 540 | file = lo->file; |
541 | lo->file = NULL; | 541 | lo->file = NULL; |
542 | nbd_clear_que(lo); | 542 | nbd_clear_que(lo); |
@@ -590,7 +590,7 @@ static int nbd_ioctl(struct inode *inode, struct file *file, | |||
590 | * FIXME: This code is duplicated from sys_shutdown, but | 590 | * FIXME: This code is duplicated from sys_shutdown, but |
591 | * there should be a more generic interface rather than | 591 | * there should be a more generic interface rather than |
592 | * calling socket ops directly here */ | 592 | * calling socket ops directly here */ |
593 | down(&lo->tx_lock); | 593 | mutex_lock(&lo->tx_lock); |
594 | if (lo->sock) { | 594 | if (lo->sock) { |
595 | printk(KERN_WARNING "%s: shutting down socket\n", | 595 | printk(KERN_WARNING "%s: shutting down socket\n", |
596 | lo->disk->disk_name); | 596 | lo->disk->disk_name); |
@@ -598,7 +598,7 @@ static int nbd_ioctl(struct inode *inode, struct file *file, | |||
598 | SEND_SHUTDOWN|RCV_SHUTDOWN); | 598 | SEND_SHUTDOWN|RCV_SHUTDOWN); |
599 | lo->sock = NULL; | 599 | lo->sock = NULL; |
600 | } | 600 | } |
601 | up(&lo->tx_lock); | 601 | mutex_unlock(&lo->tx_lock); |
602 | file = lo->file; | 602 | file = lo->file; |
603 | lo->file = NULL; | 603 | lo->file = NULL; |
604 | nbd_clear_que(lo); | 604 | nbd_clear_que(lo); |
@@ -683,7 +683,7 @@ static int __init nbd_init(void) | |||
683 | nbd_dev[i].flags = 0; | 683 | nbd_dev[i].flags = 0; |
684 | spin_lock_init(&nbd_dev[i].queue_lock); | 684 | spin_lock_init(&nbd_dev[i].queue_lock); |
685 | INIT_LIST_HEAD(&nbd_dev[i].queue_head); | 685 | INIT_LIST_HEAD(&nbd_dev[i].queue_head); |
686 | init_MUTEX(&nbd_dev[i].tx_lock); | 686 | mutex_init(&nbd_dev[i].tx_lock); |
687 | init_waitqueue_head(&nbd_dev[i].active_wq); | 687 | init_waitqueue_head(&nbd_dev[i].active_wq); |
688 | nbd_dev[i].blksize = 1024; | 688 | nbd_dev[i].blksize = 1024; |
689 | nbd_dev[i].bytesize = 0x7ffffc00ULL << 10; /* 2TB */ | 689 | nbd_dev[i].bytesize = 0x7ffffc00ULL << 10; /* 2TB */ |
diff --git a/include/linux/nbd.h b/include/linux/nbd.h index f95d51fae733..a6ce409ec6fc 100644 --- a/include/linux/nbd.h +++ b/include/linux/nbd.h | |||
@@ -38,6 +38,7 @@ enum { | |||
38 | #ifdef __KERNEL__ | 38 | #ifdef __KERNEL__ |
39 | 39 | ||
40 | #include <linux/wait.h> | 40 | #include <linux/wait.h> |
41 | #include <linux/mutex.h> | ||
41 | 42 | ||
42 | /* values for flags field */ | 43 | /* values for flags field */ |
43 | #define NBD_READ_ONLY 0x0001 | 44 | #define NBD_READ_ONLY 0x0001 |
@@ -57,7 +58,7 @@ struct nbd_device { | |||
57 | struct request *active_req; | 58 | struct request *active_req; |
58 | wait_queue_head_t active_wq; | 59 | wait_queue_head_t active_wq; |
59 | 60 | ||
60 | struct semaphore tx_lock; | 61 | struct mutex tx_lock; |
61 | struct gendisk *disk; | 62 | struct gendisk *disk; |
62 | int blksize; | 63 | int blksize; |
63 | u64 bytesize; | 64 | u64 bytesize; |