: Make legacy RESERVE_* and RELEASE_* use se_cmd_t->transport_emulate_cdb()
Subsystems (2)
PATCH 2/3 : Make legacy RESERVE_* and RELEASE_* use se_cmd_t->transport_emulate_cdb()
From: Nicholas Bellinger <[email protected]>
This patch changes RESERVE_* and RELEASE_* handling in transport_generic_cmd_sequencer() to setup se_cmd_t->transport_emulate_cdb() for processing the legacy SPC-2 reservations and >= SPC-3 compatible reservation handling (CRH=1) logic in target_core_pr.c:core_scsi2_emulate_crh().
This patch also removes the now unused ->t10_reserve() and ->t10_release() function pointers from target_core_base.h:t10_reservation_template_t.
Signed-off-by Nicholas A. Bellinger <[email protected]>
--- drivers/target/target_core_transport.c | 25 +++++++++++++++---------- include/target/target_core_base.h | 2 -- 2 files changed, 15 insertions(+), 12 deletions(-)
drivers/target/target_core_transport.c +15 -10
@@ -5563,14 +5563,17 @@ static int transport_generic_cmd_sequencer( cmd->transport_allocate_resources = &transport_generic_allocate_none;transport_get_maps (cmd); - - ret =T10_RES (su_dev)->t10_reserve (cmd); -if (ret !=0 ) { -if (ret >0 ) -return 5 ;/* RESERVATION_CONFILIT */ -else -return 7 ;/* ILLEGAL_REQUEST */ - } +/* +* Setup the legacy emulated handler for SPC-2 and +* >= SPC-3 compatible reservation handling (CRH=1) +* Otherwise, we assume the underlying SCSI logic is +* is running in SPC_PASSTHROUGH, and wants reservations +* emulation disabled. +*/ + cmd->transport_emulate_cdb = + (T10_RES (su_dev)->res_type != +SPC_PASSTHROUGH ) ? + &core_scsi2_emulate_crh :NULL ; ret =3 ;break ;case RELEASE :
@@ -5588,8 +5591,10 @@ static int transport_generic_cmd_sequencer( cmd->transport_allocate_resources = &transport_generic_allocate_none;transport_get_maps (cmd); - -T10_RES (su_dev)->t10_release (cmd); + cmd->transport_emulate_cdb = + (T10_RES (su_dev)->res_type != +SPC_PASSTHROUGH ) ? + &core_scsi2_emulate_crh :NULL ; ret =3 ;break ;case ALLOW_MEDIUM_REMOVAL :
include/target/target_core_base.h +0 -2
@@ -379,8 +379,6 @@ typedef struct t10_reservation_template_s {struct list_head registration_list;struct list_head aptpl_reg_list;int (*t10_reservation_check)(struct se_cmd_s *,u32 *); -int (*t10_reserve)(struct se_cmd_s *); -int (*t10_release)(struct se_cmd_s *);int (*t10_seq_non_holder)(struct se_cmd_s *,unsigned char *,u32 );int (*t10_pr_register)(struct se_cmd_s *);int (*t10_pr_clear)(struct se_cmd_s *);
Signature · 1 line
1.5.6.5