Re: [PATCH 2/2] target: Move task tag into struct se_cmd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/03/15 04:00, Nicholas A. Bellinger wrote:
> On Tue, 2015-04-14 at 13:26 +0200, Bart Van Assche wrote:
>> Simplify target core and target drivers by storing the task tag
>> a.k.a. command identifier inside struct se_cmd.
>>
>> Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx>
>> Cc: Christoph Hellwig <hch@xxxxxx>
>> Cc: Andy Grover <agrover@xxxxxxxxxx>
>> Cc: Sagi Grimberg <sagig@xxxxxxxxxxxx>
>> Cc: <qla2xxx-upstream@xxxxxxxxxx>
>> Cc: Felipe Balbi <balbi@xxxxxx>
>> Cc: Michael S. Tsirkin <mst@xxxxxxxxxx>
>> Cc: Juergen Gross <jgross@xxxxxxxx>
>> ---
>>   Documentation/target/tcm_mod_builder.py      |  8 -----
>>   drivers/infiniband/ulp/srpt/ib_srpt.c        | 35 +++++++------------
>>   drivers/infiniband/ulp/srpt/ib_srpt.h        |  1 -
>>   drivers/scsi/qla2xxx/qla_target.c            | 52 ++++++++++++----------------
>>   drivers/scsi/qla2xxx/qla_target.h            |  1 -
>>   drivers/scsi/qla2xxx/tcm_qla2xxx.c           | 11 ------
>>   drivers/target/iscsi/iscsi_target.c          |  1 +
>>   drivers/target/iscsi/iscsi_target_configfs.c |  9 -----
>>   drivers/target/loopback/tcm_loop.c           | 10 +-----
>>   drivers/target/sbp/sbp_target.c              | 12 ++-----
>>   drivers/target/target_core_configfs.c        |  4 ---
>>   drivers/target/target_core_tmr.c             |  6 ++--
>>   drivers/target/target_core_transport.c       | 33 +++++++++---------
>>   drivers/target/target_core_xcopy.c           |  7 +---
>>   drivers/target/tcm_fc/tcm_fc.h               |  1 -
>>   drivers/target/tcm_fc/tfc_cmd.c              | 10 +-----
>>   drivers/target/tcm_fc/tfc_conf.c             |  1 -
>>   drivers/usb/gadget/legacy/tcm_usb_gadget.c   | 36 +++++++------------
>>   drivers/usb/gadget/legacy/tcm_usb_gadget.h   |  1 -
>>   drivers/vhost/scsi.c                         |  7 +---
>>   drivers/xen/xen-scsiback.c                   | 10 +-----
>>   include/target/target_core_base.h            |  1 +
>>   include/target/target_core_fabric.h          |  1 -
>>   23 files changed, 76 insertions(+), 182 deletions(-)
>>
> 
> Applied to target-pending/for-next with a bit of patch fuzz due to other
> upstream changes.

Hello Nic,

Would it be possible to squash the patch below onto what is already in
your for-next branch ? The patch below addresses Christoph's review
comments.

Thanks,

Bart.

Subject: [PATCH] target: Address task tag review comments

Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx>
---
 drivers/target/iscsi/iscsi_target.c        |  1 +
 drivers/usb/gadget/legacy/tcm_usb_gadget.c | 25 +++++++++++++------------
 drivers/usb/gadget/legacy/tcm_usb_gadget.h |  1 +
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 65f5425..b2d46ef 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -1007,6 +1007,7 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
 	if (cmd->sense_reason)
 		goto attach_cmd;
 
+	/* only used for printks or comparing with ->ref_task_tag */
 	cmd->se_cmd.tag = (__force u32)cmd->init_task_tag;
 	cmd->sense_reason = target_setup_cmd_from_cdb(&cmd->se_cmd, hdr->cdb);
 	if (cmd->sense_reason) {
diff --git a/drivers/usb/gadget/legacy/tcm_usb_gadget.c b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
index 0a7ac13..16b9a16 100644
--- a/drivers/usb/gadget/legacy/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
@@ -559,7 +559,7 @@ static void uasp_prepare_status(struct usbg_cmd *cmd)
 
 	cmd->state = UASP_QUEUE_COMMAND;
 	iu->iu_id = IU_ID_STATUS;
-	iu->tag = cpu_to_be16(se_cmd->tag);
+	iu->tag = cpu_to_be16(cmd->tag);
 
 	/*
 	 * iu->status_qual = cpu_to_be16(STATUS QUALIFIER SAM-4. Where R U?);
@@ -629,7 +629,7 @@ static int uasp_send_status_response(struct usbg_cmd *cmd)
 	struct uas_stream *stream = cmd->stream;
 	struct sense_iu *iu = &cmd->sense_iu;
 
-	iu->tag = cpu_to_be16(cmd->se_cmd.tag);
+	iu->tag = cpu_to_be16(cmd->tag);
 	stream->req_status->complete = uasp_status_data_cmpl;
 	stream->req_status->context = cmd;
 	cmd->fu = fu;
@@ -646,7 +646,7 @@ static int uasp_send_read_response(struct usbg_cmd *cmd)
 
 	cmd->fu = fu;
 
-	iu->tag = cpu_to_be16(cmd->se_cmd.tag);
+	iu->tag = cpu_to_be16(cmd->tag);
 	if (fu->flags & USBG_USE_STREAMS) {
 
 		ret = uasp_prepare_r_request(cmd);
@@ -662,7 +662,7 @@ static int uasp_send_read_response(struct usbg_cmd *cmd)
 	} else {
 
 		iu->iu_id = IU_ID_READ_READY;
-		iu->tag = cpu_to_be16(cmd->se_cmd.tag);
+		iu->tag = cpu_to_be16(cmd->tag);
 
 		stream->req_status->complete = uasp_status_data_cmpl;
 		stream->req_status->context = cmd;
@@ -691,7 +691,7 @@ static int uasp_send_write_request(struct usbg_cmd *cmd)
 	init_completion(&cmd->write_complete);
 	cmd->fu = fu;
 
-	iu->tag = cpu_to_be16(se_cmd->tag);
+	iu->tag = cpu_to_be16(cmd->tag);
 
 	if (fu->flags & USBG_USE_STREAMS) {
 
@@ -705,7 +705,7 @@ static int uasp_send_write_request(struct usbg_cmd *cmd)
 	} else {
 
 		iu->iu_id = IU_ID_WRITE_READY;
-		iu->tag = cpu_to_be16(se_cmd->tag);
+		iu->tag = cpu_to_be16(cmd->tag);
 
 		stream->req_status->complete = uasp_status_data_cmpl;
 		stream->req_status->context = cmd;
@@ -1064,7 +1064,6 @@ static void usbg_cmd_work(struct work_struct *work)
 		goto out;
 	}
 
-	se_cmd->tag = 0;
 	if (target_submit_cmd(se_cmd, tv_nexus->tvn_se_sess,
 			cmd->cmd_buf, cmd->sense_iu.sense, cmd->unpacked_lun,
 			0, cmd->prio_attr, dir, TARGET_SCF_UNKNOWN_SIZE) < 0)
@@ -1098,7 +1097,6 @@ static int usbg_submit_command(struct f_uas *fu,
 	if (!cmd)
 		return -ENOMEM;
 
-	se_cmd = &cmd->se_cmd;
 	cmd->fu = fu;
 
 	/* XXX until I figure out why I can't free in on complete */
@@ -1112,14 +1110,15 @@ static int usbg_submit_command(struct f_uas *fu,
 
 	memcpy(cmd->cmd_buf, cmd_iu->cdb, cmd_len);
 
-	se_cmd->tag = be16_to_cpup(&cmd_iu->tag);
+	cmd->tag = be16_to_cpup(&cmd_iu->tag);
+	cmd->se_cmd.tag = cmd->tag;
 	if (fu->flags & USBG_USE_STREAMS) {
-		if (se_cmd->tag > UASP_SS_EP_COMP_NUM_STREAMS)
+		if (cmd->tag > UASP_SS_EP_COMP_NUM_STREAMS)
 			goto err;
-		if (!se_cmd->tag)
+		if (!cmd->tag)
 			cmd->stream = &fu->stream[0];
 		else
-			cmd->stream = &fu->stream[se_cmd->tag - 1];
+			cmd->stream = &fu->stream[cmd->tag - 1];
 	} else {
 		cmd->stream = &fu->stream[0];
 	}
@@ -1148,6 +1147,7 @@ static int usbg_submit_command(struct f_uas *fu,
 		break;
 	}
 
+	se_cmd = &cmd->se_cmd;
 	cmd->unpacked_lun = scsilun_to_int(&cmd_iu->lun);
 
 	INIT_WORK(&cmd->work, usbg_cmd_work);
@@ -1245,6 +1245,7 @@ static int bot_submit_command(struct f_uas *fu,
 	cmd->unpacked_lun = cbw->Lun;
 	cmd->is_read = cbw->Flags & US_BULK_FLAG_IN ? 1 : 0;
 	cmd->data_len = le32_to_cpu(cbw->DataTransferLength);
+	cmd->se_cmd.tag = le32_to_cpu(cmd->bot_tag);
 
 	INIT_WORK(&cmd->work, bot_cmd_work);
 	ret = queue_work(tpg->workqueue, &cmd->work);
diff --git a/drivers/usb/gadget/legacy/tcm_usb_gadget.h b/drivers/usb/gadget/legacy/tcm_usb_gadget.h
index 4a001f2..4c1c22a 100644
--- a/drivers/usb/gadget/legacy/tcm_usb_gadget.h
+++ b/drivers/usb/gadget/legacy/tcm_usb_gadget.h
@@ -73,6 +73,7 @@ struct usbg_cmd {
 	struct kref ref;
 
 	/* UAS only */
+	u16 tag;
 	u16 prio_attr;
 	struct sense_iu sense_iu;
 	enum uas_state state;
-- 
2.1.4


--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux