aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorFrederik Deweerdt <frederik.deweerdt@gmail.com>2008-04-24 17:10:59 -0400
committerAlasdair G Kergon <agk@redhat.com>2008-04-25 08:27:02 -0400
commitcf13ab8e02d452e2236d0b5fda9972b3b7f503cb (patch)
tree135509aa2852deebba7b4a81cdafc2a2ee2e358f /drivers/md/dm.c
parent4fdfe401e9d7e30029972d568c667234c0c1d828 (diff)
dm: remove md argument from specific_minor
The small patch below: - Removes the unused md argument from both specific_minor() and next_free_minor() - Folds kmalloc + memset(0) into a single kzalloc call in alloc_dev() This has been compile tested on x86. Signed-off-by: Frederik Deweerdt <frederik.deweerdt@gmail.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 11f4ffedd646..372369b1cc20 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -924,7 +924,7 @@ static void free_minor(int minor)
924/* 924/*
925 * See if the device with a specific minor # is free. 925 * See if the device with a specific minor # is free.
926 */ 926 */
927static int specific_minor(struct mapped_device *md, int minor) 927static int specific_minor(int minor)
928{ 928{
929 int r, m; 929 int r, m;
930 930
@@ -957,7 +957,7 @@ out:
957 return r; 957 return r;
958} 958}
959 959
960static int next_free_minor(struct mapped_device *md, int *minor) 960static int next_free_minor(int *minor)
961{ 961{
962 int r, m; 962 int r, m;
963 963
@@ -968,9 +968,8 @@ static int next_free_minor(struct mapped_device *md, int *minor)
968 spin_lock(&_minor_lock); 968 spin_lock(&_minor_lock);
969 969
970 r = idr_get_new(&_minor_idr, MINOR_ALLOCED, &m); 970 r = idr_get_new(&_minor_idr, MINOR_ALLOCED, &m);
971 if (r) { 971 if (r)
972 goto out; 972 goto out;
973 }
974 973
975 if (m >= (1 << MINORBITS)) { 974 if (m >= (1 << MINORBITS)) {
976 idr_remove(&_minor_idr, m); 975 idr_remove(&_minor_idr, m);
@@ -993,7 +992,7 @@ static struct block_device_operations dm_blk_dops;
993static struct mapped_device *alloc_dev(int minor) 992static struct mapped_device *alloc_dev(int minor)
994{ 993{
995 int r; 994 int r;
996 struct mapped_device *md = kmalloc(sizeof(*md), GFP_KERNEL); 995 struct mapped_device *md = kzalloc(sizeof(*md), GFP_KERNEL);
997 void *old_md; 996 void *old_md;
998 997
999 if (!md) { 998 if (!md) {
@@ -1006,13 +1005,12 @@ static struct mapped_device *alloc_dev(int minor)
1006 1005
1007 /* get a minor number for the dev */ 1006 /* get a minor number for the dev */
1008 if (minor == DM_ANY_MINOR) 1007 if (minor == DM_ANY_MINOR)
1009 r = next_free_minor(md, &minor); 1008 r = next_free_minor(&minor);
1010 else 1009 else
1011 r = specific_minor(md, minor); 1010 r = specific_minor(minor);
1012 if (r < 0) 1011 if (r < 0)
1013 goto bad_minor; 1012 goto bad_minor;
1014 1013
1015 memset(md, 0, sizeof(*md));
1016 init_rwsem(&md->io_lock); 1014 init_rwsem(&md->io_lock);
1017 mutex_init(&md->suspend_lock); 1015 mutex_init(&md->suspend_lock);
1018 spin_lock_init(&md->pushback_lock); 1016 spin_lock_init(&md->pushback_lock);