Add documents/comments for dm-queue-length. Signed-off-by: Kiyoshi Ueda Signed-off-by: Jun'ichi Nomura --- Documentation/device-mapper/dm-queue-length.txt | 39 ++++++++++++++++++++++++ drivers/md/dm-queue-length.c | 12 +++++-- 2 files changed, 48 insertions(+), 3 deletions(-) Index: 2.6.30-rc5/Documentation/device-mapper/dm-queue-length.txt =================================================================== --- /dev/null +++ 2.6.30-rc5/Documentation/device-mapper/dm-queue-length.txt @@ -0,0 +1,39 @@ +dm-queue-length +=============== + +dm-queue-length is a path selector module for device-mapper targets, +which selects a path having the least number of in-flight I/Os. +The path selector name is 'queue-length'. + +Table parameters for each path: [] + : The number of I/Os to dispatch using the selected + path before switching to the next path. + If not given, internal default is used. To check + the default value, see the activated table. + +Status for each path: + : 'A' if the path is active, 'F' if the path is failed. + : The number of path failures. + : The number of in-flight I/Os on the path. + + +Algorithm +========= + +dm-queue-length increments/decrements 'in-flight' when an I/O is +dispatched/completed respectively. +dm-queue-length selects a path having minimum 'in-flight'. + + +Examples +======== +In case that 2 paths (sda and sdb) are used with repeat_count == 128. + +# echo "0 10 multipath 0 0 1 1 queue-length 0 2 1 8:0 128 8:16 128" \ + dmsetup create test +# +# dmsetup table +test: 0 10 multipath 0 0 1 1 queue-length 0 2 1 8:0 128 8:16 128 +# +# dmsetup status +test: 0 10 multipath 2 0 0 0 1 1 E 0 2 1 8:0 A 0 0 8:16 A 0 0 Index: 2.6.30-rc5/drivers/md/dm-queue-length.c =================================================================== --- 2.6.30-rc5.orig/drivers/md/dm-queue-length.c +++ 2.6.30-rc5/drivers/md/dm-queue-length.c @@ -35,7 +35,7 @@ struct path_info { struct list_head list; struct dm_path *path; unsigned repeat_count; - atomic_t qlen; + atomic_t qlen; /* the number of in-flight I/Os */ }; static struct selector *alloc_selector(void) @@ -113,13 +113,16 @@ static int ql_add_path(struct path_selec struct path_info *pi; unsigned repeat_count = QL_MIN_IO; - /* Parse the arguments */ + /* + * Arguments: [] + * : The number of I/Os before switching path. + * If not given, default (QL_MIN_IO) is used. + */ if (argc > 1) { *error = "queue-length ps: incorrect number of arguments"; return -EINVAL; } - /* First path argument is number of I/Os before switching path. */ if ((argc == 1) && (sscanf(argv[0], "%u", &repeat_count) != 1)) { *error = "queue-length ps: invalid repeat count"; return -EINVAL; @@ -161,6 +164,9 @@ static int ql_reinstate_path(struct path return 0; } +/* + * Select a path having the minimum number of in-flight I/Os + */ static struct dm_path *ql_select_path(struct path_selector *ps, unsigned *repeat_count, size_t nr_bytes) {