Add implicit ALUA support (merged r3446, r3451, r3457 and r3513 from the trunk).

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.1.0.x@3634 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2011-06-27 16:16:03 +00:00
parent d0cce4dd52
commit 2d400c4102
26 changed files with 2103 additions and 1 deletions
+68
View File
@@ -5,6 +5,7 @@
* Copyright (C) 2004 - 2005 Leonid Stoljar
* Copyright (C) 2007 - 2010 ID7 Ltd.
* Copyright (C) 2010 - 2011 SCST Ltd.
* Copyright (C) 2010 - 2011 Bart Van Assche <bvanassche@acm.org>.
*
* Main SCSI target mid-level include file.
*
@@ -2589,6 +2590,65 @@ struct scst_acn {
struct kobj_attribute *acn_attr;
};
/**
* struct scst_dev_group - A group of SCST devices (struct scst_device).
*
* Each device is member of zero or one device groups. With each device group
* there are zero or more target groups associated.
*/
struct scst_dev_group {
char *name;
struct list_head entry;
struct list_head dev_list;
struct list_head tg_list;
struct kobject kobj;
struct kobject *dev_kobj;
struct kobject *tg_kobj;
};
/**
* struct scst_dg_dev - A node in scst_dev_group.dev_list.
*/
struct scst_dg_dev {
struct list_head entry;
struct scst_device *dev;
};
/**
* struct scst_target_group - A group of SCSI targets (struct scst_tgt).
*
* Such a group is either a primary target port group or a secondary
* port group. See also SPC-4 for more information.
*/
struct scst_target_group {
struct scst_dev_group *dg;
char *name;
uint16_t group_id;
enum scst_tg_state state;
bool preferred;
struct list_head entry;
struct list_head tgt_list;
struct kobject kobj;
};
/**
* struct scst_tg_tgt - A node in scst_target_group.tgt_list.
*
* Such a node can either represent a local storage target (struct scst_tgt)
* or a storage target on another system running SCST. In the former case tgt
* != NULL and rel_tgt_id is ignored. In the latter case tgt == NULL and
* rel_tgt_id is relevant.
*/
struct scst_tg_tgt {
struct list_head entry;
struct scst_target_group *tg;
struct kobject kobj;
struct scst_tgt *tgt;
char *name;
uint16_t rel_tgt_id;
};
/*
* Used to store per-session UNIT ATTENTIONs
*/
@@ -2869,6 +2929,11 @@ static inline void scst_sess_set_tgt_priv(struct scst_session *sess,
sess->tgt_priv = val;
}
uint16_t scst_lookup_tg_id(struct scst_device *dev, struct scst_tgt *tgt);
bool scst_impl_alua_configured(struct scst_device *dev);
int scst_tg_get_group_info(void **buf, uint32_t *response_length,
struct scst_device *dev, uint8_t data_format);
/**
* Returns TRUE if cmd is being executed in atomic context.
*
@@ -4113,6 +4178,9 @@ struct scst_sysfs_work_item {
struct scst_tgt *tgt_r;
unsigned long rel_tgt_id;
};
struct {
struct kobject *kobj;
};
};
int work_res;
char *res_buf;
+48
View File
@@ -266,6 +266,7 @@ enum scst_cdb_flags {
#define scst_sense_reservation_preempted UNIT_ATTENTION, 0x2A, 0x03
#define scst_sense_reservation_released UNIT_ATTENTION, 0x2A, 0x04
#define scst_sense_registrations_preempted UNIT_ATTENTION, 0x2A, 0x05
#define scst_sense_asym_access_state_changed UNIT_ATTENTION, 0x2A, 0x06
#define scst_sense_reported_luns_data_changed UNIT_ATTENTION, 0x3F, 0xE
#define scst_sense_inquery_data_changed UNIT_ATTENTION, 0x3F, 0x3
@@ -368,6 +369,14 @@ enum scst_cdb_flags {
#define SCST_INQ_NORMACA_BIT 0x20
/*************************************************************
** TPGS field in byte 5 of the INQUIRY response (SPC-4).
*************************************************************/
enum {
SCST_INQ_TPGS_MODE_IMPLICIT = 0x10,
SCST_INQ_TPGS_MODE_EXPLICIT = 0x20,
};
/*************************************************************
** Byte 2 in RESERVE_10 CDB
*************************************************************/
@@ -402,6 +411,45 @@ enum scst_cdb_flags {
#define SCSI_TRANSPORTID_PROTOCOLID_ISCSI 5
#define SCSI_TRANSPORTID_PROTOCOLID_SAS 6
/**
* enum scst_tg_state - SCSI target port group asymmetric access state.
*
* See also the documentation of the REPORT TARGET PORT GROUPS command in SPC-4.
*/
enum scst_tg_state {
SCST_TG_STATE_OPTIMIZED = 0x0,
SCST_TG_STATE_NONOPTIMIZED = 0x1,
SCST_TG_STATE_STANDBY = 0x2,
SCST_TG_STATE_UNAVAILABLE = 0x3,
SCST_TG_STATE_LBA_DEPENDENT = 0x4,
SCST_TG_STATE_OFFLINE = 0xe,
SCST_TG_STATE_TRANSITIONING = 0xf,
};
/**
* Target port group preferred bit.
*
* See also the documentation of the REPORT TARGET PORT GROUPS command in SPC-4.
*/
enum {
SCST_TG_PREFERRED = 0x80,
};
/**
* enum scst_tg_sup - Supported SCSI target port group states.
*
* See also the documentation of the REPORT TARGET PORT GROUPS command in SPC-4.
*/
enum scst_tg_sup {
SCST_TG_SUP_OPTIMIZED = 0x01,
SCST_TG_SUP_NONOPTIMIZED = 0x02,
SCST_TG_SUP_STANDBY = 0x04,
SCST_TG_SUP_UNAVAILABLE = 0x08,
SCST_TG_SUP_LBA_DEPENDENT = 0x10,
SCST_TG_SUP_OFFLINE = 0x40,
SCST_TG_SUP_TRANSITION = 0x80,
};
/*************************************************************
** Misc SCSI constants
*************************************************************/