Subject: linux-next: manual merge of the target-updates tree with the tree

From: Stephen Rothwell <[email-masked]>
Date: Fri, 23 May 2014 19:07:13 +1000

Hi Nicholas,

Today's linux-next merge of the target-updates tree got a conflict in
drivers/scsi/virtio_scsi.c between commit b54197c43db8 ("virtio_scsi:
use cmd_size") from the scsi tree and commit 4baaa7d589e2
("virtio-scsi: Enable DIF/DIX modes in SCSI host LLD") from the
target-updates tree.

I fixed it up (I think - see below) and can carry the fix as necessary
(no action is required).

-- 
Cheers,
Stephen Rothwell                    [email-masked]

diff --cc drivers/scsi/virtio_scsi.c
index d4727b339474,cc634b0e8f04..000000000000
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@@ -456,9 -537,10 +497,10 @@@ static int virtscsi_queuecommand(struc
  				 struct virtio_scsi_vq *req_vq,
  				 struct scsi_cmnd *sc)
  {
 -	struct virtio_scsi_cmd *cmd;
 -	int ret, req_size;
 -
++	int req_size;
  	struct Scsi_Host *shost = virtio_scsi_host(vscsi->vdev);
 +	struct virtio_scsi_cmd *cmd = scsi_cmd_priv(sc);
 +
  	BUG_ON(scsi_sg_count(sc) > shost->sg_tablesize);
  
  	/* TODO: check feature bit and fail if unsupported?  */
@@@ -467,27 -549,34 +509,25 @@@
  	dev_dbg(&sc->device->sdev_gendev,
  		"cmd %p CDB: %#02x\n", sc, sc->cmnd[0]);
  
 -	ret = SCSI_MLQUEUE_HOST_BUSY;
 -	cmd = mempool_alloc(virtscsi_cmd_pool, GFP_ATOMIC);
 -	if (!cmd)
 -		goto out;
 -
  	memset(cmd, 0, sizeof(*cmd));
  	cmd->sc = sc;
- 	cmd->req.cmd = (struct virtio_scsi_cmd_req){
- 		.lun[0] = 1,
- 		.lun[1] = sc->device->id,
- 		.lun[2] = (sc->device->lun >> 8) | 0x40,
- 		.lun[3] = sc->device->lun & 0xff,
- 		.tag = (unsigned long)sc,
- 		.task_attr = VIRTIO_SCSI_S_SIMPLE,
- 		.prio = 0,
- 		.crn = 0,
- 	};
  
  	BUG_ON(sc->cmd_len > VIRTIO_SCSI_CDB_SIZE);
- 	memcpy(cmd->req.cmd.cdb, sc->cmnd, sc->cmd_len);
  
- 	if (virtscsi_kick_cmd(req_vq, cmd,
- 			      sizeof cmd->req.cmd, sizeof cmd->resp.cmd,
+ 	if (virtio_has_feature(vscsi->vdev, VIRTIO_SCSI_F_T10_PI)) {
+ 		virtio_scsi_init_hdr_pi(&cmd->req.cmd_pi, sc);
+ 		memcpy(cmd->req.cmd_pi.cdb, sc->cmnd, sc->cmd_len);
+ 		req_size = sizeof(cmd->req.cmd_pi);
+ 	} else {
+ 		virtio_scsi_init_hdr(&cmd->req.cmd, sc);
+ 		memcpy(cmd->req.cmd.cdb, sc->cmnd, sc->cmd_len);
+ 		req_size = sizeof(cmd->req.cmd);
+ 	}
+ 
+ 	if (virtscsi_kick_cmd(req_vq, cmd, req_size, sizeof(cmd->resp.cmd),
 -			      GFP_ATOMIC) == 0)
 -		ret = 0;
 -	else
 -		mempool_free(cmd, virtscsi_cmd_pool);
 -
 -out:
 -	return ret;
 +			      GFP_ATOMIC) != 0)
 +		return SCSI_MLQUEUE_HOST_BUSY;
 +	return 0;
  }
  
  static int virtscsi_queuecommand_single(struct Scsi_Host *sh,