From 87bfa8708bf4c528e780f8f661f67476e0130d44 Mon Sep 17 00:00:00 2001 From: Mikulas Patocka Date: Tue, 2 Aug 2011 12:32:06 +0100 Subject: [PATCH] --- yaml --- r: 262206 b: refs/heads/master c: ba2e19b0f4ccd6920fe175a86521ff18ede260cb h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/md/dm-ioctl.c | 41 ++++++++++++++++++++++--------------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/[refs] b/[refs] index fcbd48c3d479..6e3e37b4233b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0ddf9644cc26e74ed671525e61a17bdbebf18da6 +refs/heads/master: ba2e19b0f4ccd6920fe175a86521ff18ede260cb diff --git a/trunk/drivers/md/dm-ioctl.c b/trunk/drivers/md/dm-ioctl.c index 99d38a6925a4..4c350914f4a0 100644 --- a/trunk/drivers/md/dm-ioctl.c +++ b/trunk/drivers/md/dm-ioctl.c @@ -128,6 +128,24 @@ static struct hash_cell *__get_uuid_cell(const char *str) return NULL; } +static struct hash_cell *__get_dev_cell(uint64_t dev) +{ + struct mapped_device *md; + struct hash_cell *hc; + + md = dm_get_md(huge_decode_dev(dev)); + if (!md) + return NULL; + + hc = dm_get_mdptr(md); + if (!hc) { + dm_put(md); + return NULL; + } + + return hc; +} + /*----------------------------------------------------------------- * Inserting, removing and renaming a device. *---------------------------------------------------------------*/ @@ -718,34 +736,23 @@ static int dev_create(struct dm_ioctl *param, size_t param_size) */ static struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param) { - struct mapped_device *md; struct hash_cell *hc = NULL; if (*param->uuid) { hc = __get_uuid_cell(param->uuid); if (!hc) return NULL; - goto fill_params; - } - - if (*param->name) { + } else if (*param->name) { hc = __get_name_cell(param->name); if (!hc) return NULL; - goto fill_params; - } - - md = dm_get_md(huge_decode_dev(param->dev)); - if (!md) - return NULL; - - hc = dm_get_mdptr(md); - if (!hc) { - dm_put(md); + } else if (param->dev) { + hc = __get_dev_cell(param->dev); + if (!hc) + return NULL; + } else return NULL; - } -fill_params: /* * Sneakily write in both the name and the uuid * while we have the cell.