aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
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 /drivers/md/dm.c
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>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c19
1 files changed, 10 insertions, 9 deletions
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}