mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
[PATCH] dm mpath: tidy ctr
After initialising m->ti, there's no need to pass it in subsequent calls to static functions used for parsing parameters. Signed-off-by: Micha³ Miros³aw <mirq-linux@rere.qmqm.pl> Signed-off-by: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
e52b8f6dbe
commit
28f16c2039
@ -168,7 +168,7 @@ static void free_priority_group(struct priority_group *pg,
|
|||||||
kfree(pg);
|
kfree(pg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct multipath *alloc_multipath(void)
|
static struct multipath *alloc_multipath(struct dm_target *ti)
|
||||||
{
|
{
|
||||||
struct multipath *m;
|
struct multipath *m;
|
||||||
|
|
||||||
@ -185,6 +185,8 @@ static struct multipath *alloc_multipath(void)
|
|||||||
kfree(m);
|
kfree(m);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
m->ti = ti;
|
||||||
|
ti->private = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
@ -557,8 +559,7 @@ static struct pgpath *parse_path(struct arg_set *as, struct path_selector *ps,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct priority_group *parse_priority_group(struct arg_set *as,
|
static struct priority_group *parse_priority_group(struct arg_set *as,
|
||||||
struct multipath *m,
|
struct multipath *m)
|
||||||
struct dm_target *ti)
|
|
||||||
{
|
{
|
||||||
static struct param _params[] = {
|
static struct param _params[] = {
|
||||||
{1, 1024, "invalid number of paths"},
|
{1, 1024, "invalid number of paths"},
|
||||||
@ -568,6 +569,7 @@ static struct priority_group *parse_priority_group(struct arg_set *as,
|
|||||||
int r;
|
int r;
|
||||||
unsigned i, nr_selector_args, nr_params;
|
unsigned i, nr_selector_args, nr_params;
|
||||||
struct priority_group *pg;
|
struct priority_group *pg;
|
||||||
|
struct dm_target *ti = m->ti;
|
||||||
|
|
||||||
if (as->argc < 2) {
|
if (as->argc < 2) {
|
||||||
as->argc = 0;
|
as->argc = 0;
|
||||||
@ -624,12 +626,12 @@ static struct priority_group *parse_priority_group(struct arg_set *as,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_hw_handler(struct arg_set *as, struct multipath *m,
|
static int parse_hw_handler(struct arg_set *as, struct multipath *m)
|
||||||
struct dm_target *ti)
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
struct hw_handler_type *hwht;
|
struct hw_handler_type *hwht;
|
||||||
unsigned hw_argc;
|
unsigned hw_argc;
|
||||||
|
struct dm_target *ti = m->ti;
|
||||||
|
|
||||||
static struct param _params[] = {
|
static struct param _params[] = {
|
||||||
{0, 1024, "invalid number of hardware handler args"},
|
{0, 1024, "invalid number of hardware handler args"},
|
||||||
@ -661,11 +663,11 @@ static int parse_hw_handler(struct arg_set *as, struct multipath *m,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_features(struct arg_set *as, struct multipath *m,
|
static int parse_features(struct arg_set *as, struct multipath *m)
|
||||||
struct dm_target *ti)
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
unsigned argc;
|
unsigned argc;
|
||||||
|
struct dm_target *ti = m->ti;
|
||||||
|
|
||||||
static struct param _params[] = {
|
static struct param _params[] = {
|
||||||
{0, 1, "invalid number of feature args"},
|
{0, 1, "invalid number of feature args"},
|
||||||
@ -704,19 +706,17 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc,
|
|||||||
as.argc = argc;
|
as.argc = argc;
|
||||||
as.argv = argv;
|
as.argv = argv;
|
||||||
|
|
||||||
m = alloc_multipath();
|
m = alloc_multipath(ti);
|
||||||
if (!m) {
|
if (!m) {
|
||||||
ti->error = "can't allocate multipath";
|
ti->error = "can't allocate multipath";
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
m->ti = ti;
|
r = parse_features(&as, m);
|
||||||
|
|
||||||
r = parse_features(&as, m, ti);
|
|
||||||
if (r)
|
if (r)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
||||||
r = parse_hw_handler(&as, m, ti);
|
r = parse_hw_handler(&as, m);
|
||||||
if (r)
|
if (r)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
||||||
@ -732,7 +732,7 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc,
|
|||||||
while (as.argc) {
|
while (as.argc) {
|
||||||
struct priority_group *pg;
|
struct priority_group *pg;
|
||||||
|
|
||||||
pg = parse_priority_group(&as, m, ti);
|
pg = parse_priority_group(&as, m);
|
||||||
if (!pg) {
|
if (!pg) {
|
||||||
r = -EINVAL;
|
r = -EINVAL;
|
||||||
goto bad;
|
goto bad;
|
||||||
@ -752,8 +752,6 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc,
|
|||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
ti->private = m;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
bad:
|
bad:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user