aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2006-03-27 04:18:20 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-27 11:45:03 -0500
commit48c9c27b8bcd2a328a06151e2d5c1170db0b701b (patch)
tree804fb1c410e0a246c92105710f1cd22a9daa8edc
parent2f889129de148b0ba2e1fbc9e9d33a4ef4c5f2cb (diff)
[PATCH] sem2mutex: drivers/md
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/md/dm-table.c11
-rw-r--r--drivers/md/dm.c19
-rw-r--r--drivers/md/kcopyd.c11
-rw-r--r--drivers/md/md.c11
4 files changed, 28 insertions, 24 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 76610a6ac01c..8f56a54cf0ce 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -14,6 +14,7 @@
14#include <linux/ctype.h> 14#include <linux/ctype.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/mutex.h>
17#include <asm/atomic.h> 18#include <asm/atomic.h>
18 19
19#define MAX_DEPTH 16 20#define MAX_DEPTH 16
@@ -770,14 +771,14 @@ int dm_table_complete(struct dm_table *t)
770 return r; 771 return r;
771} 772}
772 773
773static DECLARE_MUTEX(_event_lock); 774static DEFINE_MUTEX(_event_lock);
774void dm_table_event_callback(struct dm_table *t, 775void dm_table_event_callback(struct dm_table *t,
775 void (*fn)(void *), void *context) 776 void (*fn)(void *), void *context)
776{ 777{
777 down(&_event_lock); 778 mutex_lock(&_event_lock);
778 t->event_fn = fn; 779 t->event_fn = fn;
779 t->event_context = context; 780 t->event_context = context;
780 up(&_event_lock); 781 mutex_unlock(&_event_lock);
781} 782}
782 783
783void dm_table_event(struct dm_table *t) 784void dm_table_event(struct dm_table *t)
@@ -788,10 +789,10 @@ void dm_table_event(struct dm_table *t)
788 */ 789 */
789 BUG_ON(in_interrupt()); 790 BUG_ON(in_interrupt());
790 791
791 down(&_event_lock); 792 mutex_lock(&_event_lock);
792 if (t->event_fn) 793 if (t->event_fn)
793 t->event_fn(t->event_context); 794 t->event_fn(t->event_context);
794 up(&_event_lock); 795 mutex_unlock(&_event_lock);
795} 796}
796 797
797sector_t dm_table_get_size(struct dm_table *t) 798sector_t dm_table_get_size(struct dm_table *t)
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 973e63d530ae..4d710b7a133b 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/mutex.h>
13#include <linux/moduleparam.h> 14#include <linux/moduleparam.h>
14#include <linux/blkpg.h> 15#include <linux/blkpg.h>
15#include <linux/bio.h> 16#include <linux/bio.h>
@@ -743,14 +744,14 @@ static int dm_any_congested(void *congested_data, int bdi_bits)
743/*----------------------------------------------------------------- 744/*-----------------------------------------------------------------
744 * An IDR is used to keep track of allocated minor numbers. 745 * An IDR is used to keep track of allocated minor numbers.
745 *---------------------------------------------------------------*/ 746 *---------------------------------------------------------------*/
746static DECLARE_MUTEX(_minor_lock); 747static DEFINE_MUTEX(_minor_lock);
747static DEFINE_IDR(_minor_idr); 748static DEFINE_IDR(_minor_idr);
748 749
749static void free_minor(unsigned int minor) 750static void free_minor(unsigned int minor)
750{ 751{
751 down(&_minor_lock); 752 mutex_lock(&_minor_lock);
752 idr_remove(&_minor_idr, minor); 753 idr_remove(&_minor_idr, minor);
753 up(&_minor_lock); 754 mutex_unlock(&_minor_lock);
754} 755}
755 756
756/* 757/*
@@ -763,7 +764,7 @@ static int specific_minor(struct mapped_device *md, unsigned int minor)
763 if (minor >= (1 << MINORBITS)) 764 if (minor >= (1 << MINORBITS))
764 return -EINVAL; 765 return -EINVAL;
765 766
766 down(&_minor_lock); 767 mutex_lock(&_minor_lock);
767 768
768 if (idr_find(&_minor_idr, minor)) { 769 if (idr_find(&_minor_idr, minor)) {
769 r = -EBUSY; 770 r = -EBUSY;
@@ -788,7 +789,7 @@ static int specific_minor(struct mapped_device *md, unsigned int minor)
788 } 789 }
789 790
790out: 791out:
791 up(&_minor_lock); 792 mutex_unlock(&_minor_lock);
792 return r; 793 return r;
793} 794}
794 795
@@ -797,7 +798,7 @@ static int next_free_minor(struct mapped_device *md, unsigned int *minor)
797 int r; 798 int r;
798 unsigned int m; 799 unsigned int m;
799 800
800 down(&_minor_lock); 801 mutex_lock(&_minor_lock);
801 802
802 r = idr_pre_get(&_minor_idr, GFP_KERNEL); 803 r = idr_pre_get(&_minor_idr, GFP_KERNEL);
803 if (!r) { 804 if (!r) {
@@ -819,7 +820,7 @@ static int next_free_minor(struct mapped_device *md, unsigned int *minor)
819 *minor = m; 820 *minor = m;
820 821
821out: 822out:
822 up(&_minor_lock); 823 mutex_unlock(&_minor_lock);
823 return r; 824 return r;
824} 825}
825 826
@@ -1014,13 +1015,13 @@ static struct mapped_device *dm_find_md(dev_t dev)
1014 if (MAJOR(dev) != _major || minor >= (1 << MINORBITS)) 1015 if (MAJOR(dev) != _major || minor >= (1 << MINORBITS))
1015 return NULL; 1016 return NULL;
1016 1017
1017 down(&_minor_lock); 1018 mutex_lock(&_minor_lock);
1018 1019
1019 md = idr_find(&_minor_idr, minor); 1020 md = idr_find(&_minor_idr, minor);
1020 if (!md || (dm_disk(md)->first_minor != minor)) 1021 if (!md || (dm_disk(md)->first_minor != minor))
1021 md = NULL; 1022 md = NULL;
1022 1023
1023 up(&_minor_lock); 1024 mutex_unlock(&_minor_lock);
1024 1025
1025 return md; 1026 return md;
1026} 1027}
diff --git a/drivers/md/kcopyd.c b/drivers/md/kcopyd.c
index ed71f3f94620..72480a48d88b 100644
--- a/drivers/md/kcopyd.c
+++ b/drivers/md/kcopyd.c
@@ -22,6 +22,7 @@
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/vmalloc.h> 23#include <linux/vmalloc.h>
24#include <linux/workqueue.h> 24#include <linux/workqueue.h>
25#include <linux/mutex.h>
25 26
26#include "kcopyd.h" 27#include "kcopyd.h"
27 28
@@ -581,21 +582,21 @@ int kcopyd_cancel(struct kcopyd_job *job, int block)
581/*----------------------------------------------------------------- 582/*-----------------------------------------------------------------
582 * Unit setup 583 * Unit setup
583 *---------------------------------------------------------------*/ 584 *---------------------------------------------------------------*/
584static DECLARE_MUTEX(_client_lock); 585static DEFINE_MUTEX(_client_lock);
585static LIST_HEAD(_clients); 586static LIST_HEAD(_clients);
586 587
587static void client_add(struct kcopyd_client *kc) 588static void client_add(struct kcopyd_client *kc)
588{ 589{
589 down(&_client_lock); 590 mutex_lock(&_client_lock);
590 list_add(&kc->list, &_clients); 591 list_add(&kc->list, &_clients);
591 up(&_client_lock); 592 mutex_unlock(&_client_lock);
592} 593}
593 594
594static void client_del(struct kcopyd_client *kc) 595static void client_del(struct kcopyd_client *kc)
595{ 596{
596 down(&_client_lock); 597 mutex_lock(&_client_lock);
597 list_del(&kc->list); 598 list_del(&kc->list);
598 up(&_client_lock); 599 mutex_unlock(&_client_lock);
599} 600}
600 601
601static DEFINE_MUTEX(kcopyd_init_lock); 602static DEFINE_MUTEX(kcopyd_init_lock);
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 147efcb1e8ca..c9c9c096ad80 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -43,6 +43,7 @@
43#include <linux/buffer_head.h> /* for invalidate_bdev */ 43#include <linux/buffer_head.h> /* for invalidate_bdev */
44#include <linux/suspend.h> 44#include <linux/suspend.h>
45#include <linux/poll.h> 45#include <linux/poll.h>
46#include <linux/mutex.h>
46 47
47#include <linux/init.h> 48#include <linux/init.h>
48 49
@@ -2500,7 +2501,7 @@ int mdp_major = 0;
2500 2501
2501static struct kobject *md_probe(dev_t dev, int *part, void *data) 2502static struct kobject *md_probe(dev_t dev, int *part, void *data)
2502{ 2503{
2503 static DECLARE_MUTEX(disks_sem); 2504 static DEFINE_MUTEX(disks_mutex);
2504 mddev_t *mddev = mddev_find(dev); 2505 mddev_t *mddev = mddev_find(dev);
2505 struct gendisk *disk; 2506 struct gendisk *disk;
2506 int partitioned = (MAJOR(dev) != MD_MAJOR); 2507 int partitioned = (MAJOR(dev) != MD_MAJOR);
@@ -2510,15 +2511,15 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data)
2510 if (!mddev) 2511 if (!mddev)
2511 return NULL; 2512 return NULL;
2512 2513
2513 down(&disks_sem); 2514 mutex_lock(&disks_mutex);
2514 if (mddev->gendisk) { 2515 if (mddev->gendisk) {
2515 up(&disks_sem); 2516 mutex_unlock(&disks_mutex);
2516 mddev_put(mddev); 2517 mddev_put(mddev);
2517 return NULL; 2518 return NULL;
2518 } 2519 }
2519 disk = alloc_disk(1 << shift); 2520 disk = alloc_disk(1 << shift);
2520 if (!disk) { 2521 if (!disk) {
2521 up(&disks_sem); 2522 mutex_unlock(&disks_mutex);
2522 mddev_put(mddev); 2523 mddev_put(mddev);
2523 return NULL; 2524 return NULL;
2524 } 2525 }
@@ -2536,7 +2537,7 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data)
2536 disk->queue = mddev->queue; 2537 disk->queue = mddev->queue;
2537 add_disk(disk); 2538 add_disk(disk);
2538 mddev->gendisk = disk; 2539 mddev->gendisk = disk;
2539 up(&disks_sem); 2540 mutex_unlock(&disks_mutex);
2540 mddev->kobj.parent = &disk->kobj; 2541 mddev->kobj.parent = &disk->kobj;
2541 mddev->kobj.k_name = NULL; 2542 mddev->kobj.k_name = NULL;
2542 snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md"); 2543 snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md");