Add queue size to status info. --- diff/drivers/md/dm-mpath.c 2004-10-29 22:00:26.000000000 +0100 +++ source/drivers/md/dm-mpath.c 2004-10-29 21:59:43.000000000 +0100 @@ -68,6 +68,7 @@ struct work_struct process_queued_ios; struct bio_list queued_ios; + unsigned queue_size; struct work_struct trigger_event; @@ -241,7 +242,8 @@ m->current_path = path; } -static int map_io(struct multipath *m, struct bio *bio, struct mpath_io *mpio) +static int map_io(struct multipath *m, struct bio *bio, struct mpath_io *mpio, + unsigned was_queued) { unsigned long flags; struct path *path; @@ -259,18 +261,20 @@ if ((path && m->queue_io) || (!path && m->queue_if_no_path)) must_queue = 1; - spin_unlock_irqrestore(&m->lock, flags); + if (was_queued && !must_queue) + m->queue_size--; if (must_queue) { /* queue for the daemon to resubmit */ - spin_lock_irqsave(&m->lock, flags); bio_list_add(&m->queued_ios, bio); if (m->pg_init_required || !m->queue_io) schedule_work(&m->process_queued_ios); - spin_unlock_irqrestore(&m->lock, flags); + } + spin_unlock_irqrestore(&m->lock, flags); + + if (must_queue) return 0; /* Queued */ - } if (!path) return -EIO; @@ -316,7 +320,7 @@ info = dm_get_mapinfo(bio); mpio = info->ptr; - r = map_io(m, bio, mpio); + r = map_io(m, bio, mpio, 1); if (r < 0) bio_endio(bio, bio->bi_size, r); else if (r == 1) @@ -676,7 +680,7 @@ map_context->ptr = mpio; bio->bi_rw |= (1 << BIO_RW_FAILFAST); - r = map_io(m, bio, mpio); + r = map_io(m, bio, mpio, 0); if (r < 0) mempool_free(mpio, m->mpio_pool); @@ -900,6 +904,7 @@ /* * Info string has the following format: + * num_multipath_feature_args [multipath_feature_args]* * 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]* ]+ ]+ * @@ -921,14 +926,14 @@ 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); - } + spin_lock_irqsave(&m->lock, flags); + if (type == STATUSTYPE_INFO) + DMEMIT("1 %u ", m->queue_size); + else 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);