[SCSI] zfcp: Merge FCP task management setup with regular FCP command setup
authorChristof Schmitt <christof.schmitt@de.ibm.com>
Tue, 22 Feb 2011 18:54:45 +0000 (19:54 +0100)
committerJames Bottomley <James.Bottomley@suse.de>
Fri, 25 Feb 2011 17:02:14 +0000 (12:02 -0500)
For task management commands, only LUN and flags are required. The
regular FCP setup already sets the LUN in the fcp_cmnd. All is
required for merging the function is setting up the TM flags.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/s390/scsi/zfcp_fc.h
drivers/s390/scsi/zfcp_fsf.c

index 2066f9d9ceb5fdddc228788ebf650acf25768305..5243ce44aa42db85030cec197cc0fd4656cd277a 100644 (file)
@@ -164,14 +164,21 @@ struct zfcp_fc_wka_ports {
  * zfcp_fc_scsi_to_fcp - setup FCP command with data from scsi_cmnd
  * @fcp: fcp_cmnd to setup
  * @scsi: scsi_cmnd where to get LUN, task attributes/flags and CDB
+ * @tm: task management flags to setup task management command
  */
 static inline
-void zfcp_fc_scsi_to_fcp(struct fcp_cmnd *fcp, struct scsi_cmnd *scsi)
+void zfcp_fc_scsi_to_fcp(struct fcp_cmnd *fcp, struct scsi_cmnd *scsi,
+                        u8 tm_flags)
 {
        char tag[2];
 
        int_to_scsilun(scsi->device->lun, (struct scsi_lun *) &fcp->fc_lun);
 
+       if (unlikely(tm_flags)) {
+               fcp->fc_tm_flags = tm_flags;
+               return;
+       }
+
        if (scsi_populate_tag_msg(scsi, tag)) {
                switch (tag[0]) {
                case MSG_ORDERED_TAG:
@@ -197,19 +204,6 @@ void zfcp_fc_scsi_to_fcp(struct fcp_cmnd *fcp, struct scsi_cmnd *scsi)
                fcp->fc_dl += fcp->fc_dl / scsi->device->sector_size * 8;
 }
 
-/**
- * zfcp_fc_fcp_tm - setup FCP command as task management command
- * @fcp: fcp_cmnd to setup
- * @dev: scsi_device where to send the task management command
- * @tm: task management flags to setup tm command
- */
-static inline
-void zfcp_fc_fcp_tm(struct fcp_cmnd *fcp, struct scsi_device *dev, u8 tm_flags)
-{
-       int_to_scsilun(dev->lun, (struct scsi_lun *) &fcp->fc_lun);
-       fcp->fc_tm_flags |= tm_flags;
-}
-
 /**
  * zfcp_fc_evap_fcp_rsp - evaluate FCP RSP IU and update scsi_cmnd accordingly
  * @fcp_rsp: FCP RSP IU to evaluate
index 43ee0288c0e92cb9822c4e4670c10e412c7419e9..a0e05ef6592436e361b7173982001d9c9ae6ba13 100644 (file)
@@ -2210,7 +2210,7 @@ int zfcp_fsf_fcp_cmnd(struct scsi_cmnd *scsi_cmnd)
        zfcp_fsf_set_data_dir(scsi_cmnd, &io->data_direction);
 
        fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd;
-       zfcp_fc_scsi_to_fcp(fcp_cmnd, scsi_cmnd);
+       zfcp_fc_scsi_to_fcp(fcp_cmnd, scsi_cmnd, 0);
 
        if (scsi_prot_sg_count(scsi_cmnd)) {
                zfcp_qdio_set_data_div(qdio, &req->qdio_req,
@@ -2299,7 +2299,7 @@ struct zfcp_fsf_req *zfcp_fsf_fcp_task_mgmt(struct scsi_cmnd *scmnd,
        zfcp_qdio_set_sbale_last(qdio, &req->qdio_req);
 
        fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd;
-       zfcp_fc_fcp_tm(fcp_cmnd, scmnd->device, tm_flags);
+       zfcp_fc_scsi_to_fcp(fcp_cmnd, scmnd, tm_flags);
 
        zfcp_fsf_start_timer(req, ZFCP_SCSI_ER_TIMEOUT);
        if (!zfcp_fsf_req_send(req))