diff options
author | Micha³ Miros³aw <mirq-linux@rere.qmqm.pl> | 2006-10-03 04:15:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-03 11:04:15 -0400 |
commit | 28f16c2039b4eefdc09c99b12f310afb44de5536 (patch) | |
tree | 485dd0517e033d68cecafb4e7d5cb7b7bb86c63a /drivers/md | |
parent | e52b8f6dbe18c879ad2b5013f991ec9e46813043 (diff) |
[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>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-mpath.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index fb9582ae6b2d..d1dc72c0f98a 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -168,7 +168,7 @@ static void free_priority_group(struct priority_group *pg, | |||
168 | kfree(pg); | 168 | kfree(pg); |
169 | } | 169 | } |
170 | 170 | ||
171 | static struct multipath *alloc_multipath(void) | 171 | static struct multipath *alloc_multipath(struct dm_target *ti) |
172 | { | 172 | { |
173 | struct multipath *m; | 173 | struct multipath *m; |
174 | 174 | ||
@@ -185,6 +185,8 @@ static struct multipath *alloc_multipath(void) | |||
185 | kfree(m); | 185 | kfree(m); |
186 | return NULL; | 186 | return NULL; |
187 | } | 187 | } |
188 | m->ti = ti; | ||
189 | ti->private = m; | ||
188 | } | 190 | } |
189 | 191 | ||
190 | return m; | 192 | return m; |
@@ -557,8 +559,7 @@ static struct pgpath *parse_path(struct arg_set *as, struct path_selector *ps, | |||
557 | } | 559 | } |
558 | 560 | ||
559 | static struct priority_group *parse_priority_group(struct arg_set *as, | 561 | static struct priority_group *parse_priority_group(struct arg_set *as, |
560 | struct multipath *m, | 562 | struct multipath *m) |
561 | struct dm_target *ti) | ||
562 | { | 563 | { |
563 | static struct param _params[] = { | 564 | static struct param _params[] = { |
564 | {1, 1024, "invalid number of paths"}, | 565 | {1, 1024, "invalid number of paths"}, |
@@ -568,6 +569,7 @@ static struct priority_group *parse_priority_group(struct arg_set *as, | |||
568 | int r; | 569 | int r; |
569 | unsigned i, nr_selector_args, nr_params; | 570 | unsigned i, nr_selector_args, nr_params; |
570 | struct priority_group *pg; | 571 | struct priority_group *pg; |
572 | struct dm_target *ti = m->ti; | ||
571 | 573 | ||
572 | if (as->argc < 2) { | 574 | if (as->argc < 2) { |
573 | as->argc = 0; | 575 | as->argc = 0; |
@@ -624,12 +626,12 @@ static struct priority_group *parse_priority_group(struct arg_set *as, | |||
624 | return NULL; | 626 | return NULL; |
625 | } | 627 | } |
626 | 628 | ||
627 | static int parse_hw_handler(struct arg_set *as, struct multipath *m, | 629 | static int parse_hw_handler(struct arg_set *as, struct multipath *m) |
628 | struct dm_target *ti) | ||
629 | { | 630 | { |
630 | int r; | 631 | int r; |
631 | struct hw_handler_type *hwht; | 632 | struct hw_handler_type *hwht; |
632 | unsigned hw_argc; | 633 | unsigned hw_argc; |
634 | struct dm_target *ti = m->ti; | ||
633 | 635 | ||
634 | static struct param _params[] = { | 636 | static struct param _params[] = { |
635 | {0, 1024, "invalid number of hardware handler args"}, | 637 | {0, 1024, "invalid number of hardware handler args"}, |
@@ -661,11 +663,11 @@ static int parse_hw_handler(struct arg_set *as, struct multipath *m, | |||
661 | return 0; | 663 | return 0; |
662 | } | 664 | } |
663 | 665 | ||
664 | static int parse_features(struct arg_set *as, struct multipath *m, | 666 | static int parse_features(struct arg_set *as, struct multipath *m) |
665 | struct dm_target *ti) | ||
666 | { | 667 | { |
667 | int r; | 668 | int r; |
668 | unsigned argc; | 669 | unsigned argc; |
670 | struct dm_target *ti = m->ti; | ||
669 | 671 | ||
670 | static struct param _params[] = { | 672 | static struct param _params[] = { |
671 | {0, 1, "invalid number of feature args"}, | 673 | {0, 1, "invalid number of feature args"}, |
@@ -704,19 +706,17 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc, | |||
704 | as.argc = argc; | 706 | as.argc = argc; |
705 | as.argv = argv; | 707 | as.argv = argv; |
706 | 708 | ||
707 | m = alloc_multipath(); | 709 | m = alloc_multipath(ti); |
708 | if (!m) { | 710 | if (!m) { |
709 | ti->error = "can't allocate multipath"; | 711 | ti->error = "can't allocate multipath"; |
710 | return -EINVAL; | 712 | return -EINVAL; |
711 | } | 713 | } |
712 | 714 | ||
713 | m->ti = ti; | 715 | r = parse_features(&as, m); |
714 | |||
715 | r = parse_features(&as, m, ti); | ||
716 | if (r) | 716 | if (r) |
717 | goto bad; | 717 | goto bad; |
718 | 718 | ||
719 | r = parse_hw_handler(&as, m, ti); | 719 | r = parse_hw_handler(&as, m); |
720 | if (r) | 720 | if (r) |
721 | goto bad; | 721 | goto bad; |
722 | 722 | ||
@@ -732,7 +732,7 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc, | |||
732 | while (as.argc) { | 732 | while (as.argc) { |
733 | struct priority_group *pg; | 733 | struct priority_group *pg; |
734 | 734 | ||
735 | pg = parse_priority_group(&as, m, ti); | 735 | pg = parse_priority_group(&as, m); |
736 | if (!pg) { | 736 | if (!pg) { |
737 | r = -EINVAL; | 737 | r = -EINVAL; |
738 | goto bad; | 738 | goto bad; |
@@ -752,8 +752,6 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc, | |||
752 | goto bad; | 752 | goto bad; |
753 | } | 753 | } |
754 | 754 | ||
755 | ti->private = m; | ||
756 | |||
757 | return 0; | 755 | return 0; |
758 | 756 | ||
759 | bad: | 757 | bad: |