: Add SPC-3 PERSISTENT_RESERVE_* Infrastrcture
PATCH 1/7 : Add SPC-3 PERSISTENT_RESERVE_* Infrastrcture
Quoted 1 line
From
c95cbb3437d09c5211a2ea3380526ff2f2541e69Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <[email protected]>
Date: Mon, 26 Jan 2009 00:28:54 -0800
Subject: [PATCH 1/7] [Target_Core_Mod]: Add SPC-3 PERSISTENT_RESERVE_* Infrastrcture
This patch adds additional structure members to t10_reservation_template_t and adds t10_pr_registration_s and (placeholder) t10_pr_reservation_t structure defines to Target_Core_Mod.
Tjos patch makes non-execption submission for se_cmd_t->emulate_cdb() function pointer to queue generically in __transport_execute_tasks().
This patch also renames iscsi_send_check_condition_and_sense -> transport_send_check_condition_and_sense() and updates transport_generic_request_failure() to handle new exceptions.
--- drivers/lio-core/target_core_base.h | 39 +++++++++++++-- drivers/lio-core/target_core_transport.c | 75 ++++++++++++++++++++++------- drivers/lio-core/target_core_transport.h | 14 ++++-- 3 files changed, 100 insertions(+), 28 deletions(-)
drivers/lio-core/target_core_base.h +34 -5
@@ -217,7 +217,10 @@#define DEV_STATUS_THR_TAKE_OFFLINE 3#define DEV_STATUS_THR_SHUTDOWN 4 -/* iscsi_send_check_condition_and_sense() */ +/* se_dev_entry_t->deve_flags */ +#define DEF_PR_REGISTERED 0x01 + +/* transport_send_check_condition_and_sense() */ #define NON_EXISTENT_LUN 0x1#define UNSUPPORTED_SCSI_OPCODE 0x2#define INCORRECT_AMOUNT_OF_DATA 0x3
@@ -226,9 +229,10 @@#define SNACK_REJECTED 0x6#define SECTOR_COUNT_TOO_MANY 0x7#define INVALID_CDB_FIELD 0x8 -#define LOGICAL_UNIT_COMMUNICATION_FAILURE 0x9 -#define UNKNOWN_MODE_PAGE 0xa -#define WRITE_PROTECTED 0xb +#define INVALID_PARAMETER_LIST 0x9 +#define LOGICAL_UNIT_COMMUNICATION_FAILURE 0xa +#define UNKNOWN_MODE_PAGE 0xb +#define WRITE_PROTECTED 0xc typedef struct se_obj_s { atomic_t obj_access_count;
@@ -264,7 +268,12 @@ typedef enum {struct se_cmd_s ; typedef struct t10_reservation_template_s { + int pr_all_tg_pt; /* Reservation effects all target ports */ + u32 pr_generation; t10_reservations_index_t res_type; + spinlock_t registration_lock; + struct se_node_acl_s *pr_res_holder; /* Reservation holder when pr_all_tg_pt=1 */ + struct list_head registration_list; int (*t10_reservation_check)(struct se_cmd_s *); int (*t10_reserve)(struct se_cmd_s *); int (*t10_release)(struct se_cmd_s *);
@@ -273,6 +282,21 @@ typedef struct t10_reservation_template_s {int (*t10_pr_clear)(struct se_cmd_s *); }____cacheline_aligned t10_reservation_template_t; +typedef struct t10_pr_registration_s { +int pr_reg_all_tg_pt;/* Reservation effects all target ports */ +int pr_res_type; +int pr_res_scope; +u32 pr_res_generation; +u64 pr_res_key; +struct se_node_acl_s *pr_reg_nacl; +struct se_dev_entry_s *pr_reg_deve; +struct list_head pr_reg_list; +}t10_pr_registration_t ; + +typedef struct t10_pr_reservation_s { + +}t10_pr_reservation_t ; + typedef struct se_queue_req_s { int state; void *queue_se_obj_ptr;
@@ -522,6 +546,7 @@ typedef struct se_lun_acl_s { typedef struct se_dev_entry_s { u32 lun_flags; u32 deve_cmds; + u32 deve_flags; u32 mapped_lun; u32 average_bytes; u32 last_byte_count;
@@ -602,7 +627,8 @@ typedef struct se_device_s {spinlock_t dev_status_lock;spinlock_t dev_status_thr_lock;spinlock_t se_port_lock; -struct se_node_acl_s *dev_reserved_node_acl; +struct se_node_acl_s *dev_reserved_node_acl;/* Used for legacy SPC-2 reservationsa */ +struct t10_pr_registration_s *dev_pr_res_holder;/* Used for SPC-3 Persistent Reservations */ struct list_head dev_sep_list;struct timer_list dev_status_timer;struct task_struct *process_thread;/* Pointer to descriptor for processing thread */
@@ -623,6 +649,7 @@ typedef struct se_device_s { }____cacheline_aligned se_device_t;#define SE_DEV (cmd) ((se_device_t *)(cmd)->se_lun->se_dev) +#define SU_DEV (dev) ((se_subsystem_dev_t *)(dev)->se_sub_dev)#define ISCSI_DEV (cmd) SE_DEV(cmd)#define DEV_ATTRIB (dev) (&(dev)->se_sub_dev->se_dev_attrib)#define DEV_T10_WWN (dev) (&(dev)->se_sub_dev->t10_wwn)
@@ -662,6 +689,7 @@ typedef struct se_lun_s {int lun_type;int lun_status;u32 lun_access; +u32 lun_flags;u32 unpacked_lun;spinlock_t lun_acl_lock;spinlock_t lun_cmd_lock;
@@ -671,6 +699,7 @@ typedef struct se_lun_s {se_lun_acl_t *lun_acl_head;se_lun_acl_t *lun_acl_tail;se_device_t *se_dev; +struct t10_pr_registration_s *lun_pr_res_holder;/* Used for SPC-3 Persistent Reservations */ void *lun_type_ptr;struct config_group lun_group;struct se_obj_lun_type_s *lun_obj_api;
drivers/lio-core/target_core_transport.c +57 -18
199 lines not on this page · raw message
drivers/lio-core/target_core_transport.h +9 -5
@@ -46,10 +46,12 @@#define PYX_TRANSPORT_REQ_TOO_MANY_SECTORS -3#define PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES -4#define PYX_TRANSPORT_INVALID_CDB_FIELD -5 -#define PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE -6 -#define PYX_TRANSPORT_UNKNOWN_MODE_PAGE -7 -#define PYX_TRANSPORT_WRITE_PROTECTED -8 -#define PYX_TRANSPORT_TASK_TIMEOUT -9 +#define PYX_TRANSPORT_INVALID_PARAMETER_LIST -6 +#define PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE -7 +#define PYX_TRANSPORT_UNKNOWN_MODE_PAGE -8 +#define PYX_TRANSPORT_WRITE_PROTECTED -9 +#define PYX_TRANSPORT_TASK_TIMEOUT -10 +#define PYX_TRANSPORT_RESERVATION_CONFLICT -11#ifndef SAM_STAT_RESERVATION_CONFLICT #define SAM_STAT_RESERVATION_CONFLICT 0x18
@@ -89,6 +91,8 @@#define DF_PERSISTENT_CLAIMED_BLOCKDEV 0x00000020#define DF_DISABLE_STATUS_THREAD 0x00000040#define DF_READ_ONLY 0x00000080 +#define DF_SPC3_PERSISTENT_RESERVE 0x00000100 +#define DF_SPC2_RESERVATIONS 0x00000200/* se_dev_attrib_t sanity values */ #define DA_TASK_TIMEOUT_MAX 600/* 10 Minutes, see transport_get_default_task_timeout() */
@@ -189,7 +193,7 @@ extern void transport_release_fe_cmd (se_cmd_t *);extern int transport_generic_remove (se_cmd_t *,int ,int );extern int transport_lun_wait_for_tasks (se_cmd_t *,se_lun_t *);extern void transport_clear_lun_from_sessions (se_lun_t *); -extern int iscsi_send_check_condition_and_sense (se_cmd_t *,__u8 ,int ); +extern int transport_send_check_condition_and_sense (se_cmd_t *,__u8 ,int );extern void transport_release_cmd_to_pool (se_cmd_t *);extern void transport_generic_free_cmd (se_cmd_t *,int ,int ,int );extern void transport_generic_wait_for_cmds (se_cmd_t *,int );
Signature · 1 line
1.5.4.1