mirror of
https://github.com/systemd/systemd.git
synced 2024-11-04 13:51:24 +03:00
197a978ea3
* 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 :)
121 lines
2.7 KiB
C
121 lines
2.7 KiB
C
/*
|
|
* Soft: Description here...
|
|
*
|
|
* Version: $Id: main.h,v 0.0.1 2003/09/18 15:13:38 cvaroqui Exp $
|
|
*
|
|
* Author: Copyright (C) 2003 Christophe Varoqui
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
* See the GNU General Public License for more details.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version
|
|
* 2 of the License, or (at your option) any later version.
|
|
*/
|
|
|
|
#ifndef _MAIN_H
|
|
#define _MAIN_H
|
|
|
|
/* local includes */
|
|
#include "sg_include.h"
|
|
|
|
/* exerpt from "sg_err.h" */
|
|
#define SCSI_CHECK_CONDITION 0x2
|
|
#define SCSI_COMMAND_TERMINATED 0x22
|
|
#define SG_ERR_DRIVER_SENSE 0x08
|
|
|
|
/* exerpt from "scsi.h" */
|
|
#define RECOVERED_ERROR 0x01
|
|
#define SCSI_IOCTL_GET_IDLUN 0x5382
|
|
#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
|
|
|
|
/* global defs */
|
|
#define WWID_SIZE 33
|
|
#define MAX_DEVS 128
|
|
#define MAX_MP MAX_DEVS / 2
|
|
#define MAX_MP_PATHS MAX_DEVS / 4
|
|
#define FILE_NAME_SIZE 256
|
|
#define INQUIRY_CMDLEN 6
|
|
#define INQUIRY_CMD 0x12
|
|
#define SENSE_BUFF_LEN 32
|
|
#define DEF_TIMEOUT 60000
|
|
#define EBUFF_SZ 256
|
|
#define TUR_CMD_LEN 6
|
|
#define MX_ALLOC_LEN 255
|
|
#define BLKGETSIZE _IO(0x12,96)
|
|
#define DM_TARGET "multipath"
|
|
|
|
#define PINDEX(x,y) mp[(x)].pindex[(y)]
|
|
|
|
/* global types */
|
|
struct scsi_idlun {
|
|
int dev_id;
|
|
int host_unique_id;
|
|
int host_no;
|
|
};
|
|
|
|
struct sg_id {
|
|
int host_no;
|
|
int channel;
|
|
int scsi_id;
|
|
int lun;
|
|
int scsi_type;
|
|
short h_cmd_per_lun;
|
|
short d_queue_depth;
|
|
int unused1;
|
|
int unused2;
|
|
};
|
|
|
|
struct scsi_dev {
|
|
char dev[FILE_NAME_SIZE];
|
|
struct scsi_idlun scsi_id;
|
|
int host_no;
|
|
};
|
|
|
|
struct path {
|
|
char dev[FILE_NAME_SIZE];
|
|
char sg_dev[FILE_NAME_SIZE];
|
|
struct scsi_idlun scsi_id;
|
|
struct sg_id sg_id;
|
|
int state;
|
|
char wwid[WWID_SIZE];
|
|
char vendor_id[8];
|
|
char product_id[16];
|
|
char rev[4];
|
|
};
|
|
|
|
struct multipath {
|
|
char wwid[WWID_SIZE];
|
|
int npaths;
|
|
int pindex[MAX_MP_PATHS];
|
|
};
|
|
|
|
struct env {
|
|
int max_devs;
|
|
int verbose;
|
|
int quiet;
|
|
int dry_run;
|
|
int with_sysfs;
|
|
char sysfs_path[FILE_NAME_SIZE];
|
|
};
|
|
|
|
/* Build version */
|
|
#define PROG "multipath"
|
|
|
|
#define VERSION_CODE 0x000009
|
|
#define DATE_CODE 0x0C0503
|
|
|
|
#define MULTIPATH_VERSION(version) \
|
|
(version >> 16) & 0xFF, \
|
|
(version >> 8) & 0xFF, \
|
|
version & 0xFF
|
|
|
|
#define VERSION_STRING PROG" v%d.%d.%d (%.2d/%.2d, 20%.2d)\n", \
|
|
MULTIPATH_VERSION(VERSION_CODE), \
|
|
MULTIPATH_VERSION(DATE_CODE)
|
|
|
|
#endif
|