Drop the 's' and add queue_if_no_path to table output. --- diff/drivers/md/dm-mpath.c 2004-10-29 21:18:08.000000000 +0100 +++ source/drivers/md/dm-mpath.c 2004-10-29 21:30:35.000000000 +0100 @@ -21,6 +21,8 @@ #include #include +#define MESG_STR(x) x, sizeof(x) + /* Path properties */ struct path { struct list_head list; @@ -55,7 +57,7 @@ struct list_head priority_groups; unsigned pg_init_required; /* pg_init needs calling? */ unsigned queue_io; /* Must we queue all I/O? */ - unsigned queue_if_no_paths; /* Queue I/O if last path fails? */ + unsigned queue_if_no_path; /* Queue I/O if last path fails? */ spinlock_t lock; unsigned nr_valid_paths; @@ -254,7 +256,7 @@ path = m->current_path; - if ((path && m->queue_io) || (!path && m->queue_if_no_paths)) + if ((path && m->queue_io) || (!path && m->queue_if_no_path)) must_queue = 1; spin_unlock_irqrestore(&m->lock, flags); @@ -278,6 +280,19 @@ return 1; /* Mapped successfully */ } +static int queue_if_no_path(struct multipath *m, unsigned queue_if_no_path) +{ + unsigned long flags; + + spin_lock_irqsave(&m->lock, flags); + m->queue_if_no_path = queue_if_no_path; + if (!m->queue_if_no_path) + schedule_work(&m->process_queued_ios); + spin_unlock_irqrestore(&m->lock, flags); + + return 0; +} + /*----------------------------------------------------------------- * The multipath daemon is responsible for resubmitting queued ios. *---------------------------------------------------------------*/ @@ -326,7 +341,7 @@ path = m->current_path; - if ((path && m->queue_io) || (!path && m->queue_if_no_paths)) + if ((path && m->queue_io) || (!path && m->queue_if_no_path)) must_queue = 1; init_required = m->pg_init_required; @@ -356,9 +371,10 @@ /*----------------------------------------------------------------- * Constructor/argument parsing: + * []* * [hw_handler []*] - * [ - * [ []* ]+ ]+ + * [ + * [ []* ]+ ]+ *---------------------------------------------------------------*/ struct param { unsigned min; @@ -524,8 +540,8 @@ return NULL; } -int parse_hw_handler(struct arg_set *as, struct multipath *m, - struct dm_target *ti) +static int parse_hw_handler(struct arg_set *as, struct multipath *m, + struct dm_target *ti) { int r; struct hw_handler_type *hwht; @@ -561,6 +577,31 @@ return 0; } +static int parse_features(struct arg_set *as, struct multipath *m, + struct dm_target *ti) +{ + int r; + unsigned argc; + + static struct param _params[] = { + {0, 1, ESTR("invalid number of feature args")}, + }; + + r = read_param(_params, shift(as), &argc, &ti->error); + if (r) + return -EINVAL; + + if (!argc) + return 0; + + if (!strnicmp(shift(as), MESG_STR("queue_if_no_path"))) + return queue_if_no_path(m, 1); + else { + ti->error = "Unrecognised multipath feature request"; + return -EINVAL; + } +} + static int multipath_ctr(struct dm_target *ti, unsigned int argc, char **argv) { @@ -582,6 +623,10 @@ return -EINVAL; } + r = parse_features(&as, m, ti); + if (r) + goto bad; + r = parse_hw_handler(&as, m, ti); if (r) goto bad; @@ -858,8 +903,9 @@ * num_handler_status_args [handler_status_args]* * num_groups [A|D|E num_paths num_selector_args [path_dev A|F fail_count [selector_args]* ]+ ]+ * - * num_handler_args hw_handler [hw_handler_args]* * Table string has the following format (identical to the constructor string): + * num_feature_args [features_args]* + * num_handler_args hw_handler [hw_handler_args]* * num_groups [priority selector-name num_paths num_selector_args [path_dev [selector_args]* ]+ ]+ */ static int multipath_status(struct dm_target *ti, status_type_t type, @@ -874,6 +920,16 @@ char buffer[32]; char state; + /* Features */ + if (type == STATUSTYPE_TABLE) { + spin_lock_irqsave(&m->lock, flags); + if (m->queue_if_no_path) + DMEMIT("1 queue_if_no_path "); + else + DMEMIT("0 "); + spin_unlock_irqrestore(&m->lock, flags); + } + if (hwh->type && hwh->type->status) sz += hwh->type->status(hwh, type, result + sz, maxlen - sz); else if (!hwh->type || type == STATUSTYPE_INFO) @@ -929,21 +985,6 @@ return 0; } -static int queue_if_no_paths(struct multipath *m, unsigned queue_if_no_paths) -{ - unsigned long flags; - - spin_lock_irqsave(&m->lock, flags); - m->queue_if_no_paths = queue_if_no_paths; - if (!m->queue_if_no_paths) - schedule_work(&m->process_queued_ios); - spin_unlock_irqrestore(&m->lock, flags); - - return 0; -} - -#define MESG_STR(x) x, sizeof(x) - static int multipath_message(struct dm_target *ti, unsigned argc, char **argv) { int r; @@ -952,10 +993,10 @@ action_fn action; if (argc == 1) { - if (!strnicmp(argv[0], MESG_STR("queue_if_no_paths"))) - return queue_if_no_paths(m, 1); - else if (!strnicmp(argv[0], MESG_STR("fail_if_no_paths"))) - return queue_if_no_paths(m, 0); + if (!strnicmp(argv[0], MESG_STR("queue_if_no_path"))) + return queue_if_no_path(m, 1); + else if (!strnicmp(argv[0], MESG_STR("fail_if_no_path"))) + return queue_if_no_path(m, 0); } if (argc != 2) @@ -991,8 +1032,6 @@ return -EINVAL; } -#undef MESG_STR - /*----------------------------------------------------------------- * Module setup *---------------------------------------------------------------*/