From: christophe.varoqui@free.fr Date: Wed, 10 Dec 2003 08:52:04 +0000 (-0800) Subject: [PATCH] and more extras/multipath updates X-Git-Tag: 009~25 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=197a978ea3e5d68d2ca8059cede2b60f62c497b7 [PATCH] and more extras/multipath updates * configure the multipath target with round-robin path selector and conservative default for a start : yes it makes this release the first really useful one. * temporarily disable map creation for single path device due to current restrictive defaults in the kernel target. Sistina should work it out. * correct the strncmp logic in blacklist function. Tested on StorageWorks with 2.6.0-test10-udm1 : xa-s03:~# ./multipath -v 60001fe1000bdad0000903507109004b (1 0 1 1) /dev/sda op:1 /dev/sda [HSG80 ] 60001fe1000bdad000090371312100bf (1 0 1 2) /dev/sdb op:1 /dev/sdb [HSG80 ] 60001fe1000bdad000090371312100c2 (1 0 1 3) /dev/sdc op:1 /dev/sdc [HSG80 ] 60001fe1000bdad00009037131210067 (1 0 2 1) /dev/sdd op:1 /dev/sdd [HSG80 ] 60001fe1000bdad000090371312100b3 (1 0 2 2) /dev/sde op:1 /dev/sde [HSG80 ] 60001fe1000bdad00009035071090024 (1 0 2 3) /dev/sdf op:1 /dev/sdf [HSG80 ] 600508b4000156d700012000000b0000 (1 0 3 1) /dev/sdg op:1 /dev/sdg [HSV110 (C)COMPAQ] 600508b4000156c30001200000210000 (1 0 3 2) /dev/sdh op:1 /dev/sdh [HSV110 (C)COMPAQ] 600508b4000156d700012000000b0000 (1 0 6 1) /dev/sdi op:1 /dev/sdi [HSV110 (C)COMPAQ] 600508b4000156c30001200000210000 (1 0 6 2) /dev/sdj op:1 /dev/sdj [HSV110 (C)COMPAQ] 60001fe1000bdad0000903507109004b \_(1 0 1 1) /dev/sda op:1 /dev/sda [HSG80 ] 60001fe1000bdad000090371312100bf \_(1 0 1 2) /dev/sdb op:1 /dev/sdb [HSG80 ] 60001fe1000bdad000090371312100c2 \_(1 0 1 3) /dev/sdc op:1 /dev/sdc [HSG80 ] 60001fe1000bdad00009037131210067 \_(1 0 2 1) /dev/sdd op:1 /dev/sdd [HSG80 ] 60001fe1000bdad000090371312100b3 \_(1 0 2 2) /dev/sde op:1 /dev/sde [HSG80 ] 60001fe1000bdad00009035071090024 \_(1 0 2 3) /dev/sdf op:1 /dev/sdf [HSG80 ] 600508b4000156d700012000000b0000 \_(1 0 3 1) /dev/sdg op:1 /dev/sdg [HSV110 (C)COMPAQ] \_(1 0 6 1) /dev/sdi op:1 /dev/sdi [HSV110 (C)COMPAQ] 600508b4000156c30001200000210000 \_(1 0 3 2) /dev/sdh op:1 /dev/sdh [HSV110 (C)COMPAQ] \_(1 0 6 2) /dev/sdj op:1 /dev/sdj [HSV110 (C)COMPAQ] N|600508b4000156d700012000000b0000 : 0 4194304 multipath 2 2 10 round-robin 2 /dev/sdg 10 2 1 2 /dev/sdi 10 2 1 2 N|600508b4000156c30001200000210000 : 0 20971520 multipath 2 2 10 round-robin 2 /dev/sdh 10 2 1 2 /dev/sdj 10 2 1 2 xa-s03:~# dmsetup ls 600508b4000156c30001200000210000 (254, 1) 600508b4000156d700012000000b0000 (254, 0) xa-s03:~# ll /dev/mapper/ total 0 brw------- 1 root root 254, 1 Dec 9 22:57 600508b4000156c30001200000210000 brw------- 1 root root 254, 0 Dec 9 22:57 600508b4000156d700012000000b0000 crw------- 1 root root 10, 63 Jul 25 22:48 control xa-s03:~# dd if=/dev/mapper/600508b4000156c30001200000210000 of=/dev/null bs=1M count=500 500+0 records in 500+0 records out 524288000 bytes transferred in 5.662530 seconds (92589003 bytes/sec) gee, that pretty fast :) --- diff --git a/extras/multipath/main.c b/extras/multipath/main.c index e62d76325..6b1c37cd9 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -214,7 +214,7 @@ blacklist (char * dev) { }; for (i = 0; blist[i].lengh; i++) { - if (strncmp(dev, blist[i].headstr, blist[i].lengh)) + if (strncmp(dev, blist[i].headstr, blist[i].lengh) == 0) return 1; } return 0; @@ -562,6 +562,17 @@ add_map(struct env * conf, struct path * all_paths, int i, np; long size = -1; + /* defaults for multipath target */ + int dm_nr_path_args = 2; + int dm_path_test_int = 10; + char * dm_ps_name = "round-robin"; + int dm_ps_nr_args = 2; + int dm_path_failback_int = 10; + int dm_path_nr_fail = 2; + int dm_ps_prio = 1; + int dm_ps_min_io = 2; + + if (!(dmt = dm_task_create(op))) return 0; @@ -577,7 +588,14 @@ add_map(struct env * conf, struct path * all_paths, } if (np == 0) goto addout; - params_p += sprintf(params_p, "%i 32", np); + /* temporarily disable creation of single path maps */ + /* Sistina should modify the target limits */ + if (np < 2) + goto addout; + + params_p += sprintf(params_p, "%i %i %i %s %i", + np, dm_nr_path_args, dm_path_test_int, + dm_ps_name, dm_ps_nr_args); for (i=0; i<=mp[index].npaths; i++) { if (( 0 == all_paths[PINDEX(index,i)].state) || @@ -585,8 +603,10 @@ add_map(struct env * conf, struct path * all_paths, continue; if (size < 0) size = get_disk_size(conf, all_paths[PINDEX(index,0)].dev); - params_p += sprintf(params_p, " %s %i", - all_paths[PINDEX(index,i)].dev, 0); + params_p += sprintf(params_p, " %s %i %i %i %i", + all_paths[PINDEX(index,i)].dev, + dm_path_failback_int, dm_path_nr_fail, + dm_ps_prio, dm_ps_min_io); } if (size < 0) diff --git a/extras/multipath/main.h b/extras/multipath/main.h index a1de1d8d2..d6dfb1429 100644 --- a/extras/multipath/main.h +++ b/extras/multipath/main.h @@ -46,12 +46,7 @@ #define TUR_CMD_LEN 6 #define MX_ALLOC_LEN 255 #define BLKGETSIZE _IO(0x12,96) -#define DM_TARGET "striped" -/* #define DM_TARGET "multipath" -#define DM_POLL_INTERVAL 10 -#define DM_PATH_SELECTOR "latency" -*/ #define PINDEX(x,y) mp[(x)].pindex[(y)]