RE: [PATCH 3/5] scsi: add support for COMPARE_AND_WRITE

Elliott, Robert (Server Storage)
2014-12-18T00:23:58Z

I haven't reviewed the whole patch, but noticed one thing:

> -----Original Message-----
> From: linux-scsi-owner@vger.kernel.org [mailto:linux-scsi-
> owner@vger.kernel.org] On Behalf Of michaelc@cs.wisc.edu
> Sent: Thursday, 16 October, 2014 12:37 AM
...
> @@ -635,6 +646,54 @@ static void sd_prot_op(struct scsi_cmnd *scmd,
> unsigned int dif)
> scsi_set_prot_type(scmd, dif);
> }
>
> +static void sd_config_cmp_and_write(struct scsi_disk *sdkp)
> +{
> + if (sdkp->max_cmp_and_write_blocks > sdkp->max_xfer_blocks) {
> + /* Invalid settings returned. Do not try to support for now
> */
> + blk_queue_max_cmp_and_write_sectors(sdkp->disk->queue, 0);
> + return;
> + }
> +
> + /*
> + * mult by 2, because the block layer wants the total number of
> + * sectors that will be put in bios and transferred.
> + */
> + blk_queue_max_cmp_and_write_sectors(sdkp->disk->queue,
> + 2 * sdkp->max_cmp_and_write_blocks *
> + (sdkp->device->sector_size >> 9));
> +}
> +
> +/**
> + * sd_setup_cmp_and_write_cmnd - compare and write data
> + * @cmd: scsi_cmnd to prepare
> + **/
> +static int sd_setup_cmd_and_write_cmd(struct scsi_cmnd *cmd)

I suspect you intended to use
setup_cmp_and_write
rather than
setup_cmd_and_write
for that function name, to match
sd_config_cmp_and_write

...
> @@ -1134,6 +1193,8 @@ static int sd_init_command(struct scsi_cmnd *cmd)
> return sd_setup_write_same_cmnd(cmd);
> else if (rq->cmd_flags & REQ_FLUSH)
> return sd_setup_flush_cmnd(cmd);
> + else if (rq->cmd_flags & REQ_CMP_AND_WRITE)
> + return sd_setup_cmd_and_write_cmd(cmd);
> else
> return sd_setup_read_write_cmnd(cmd);
> }

---
Rob Elliott HP Server Storage