[PATCHv2] NVMe: write_long SCSI to NVMe translation implementation

Matthew Wilcox willy at linux.intel.com
Tue Mar 17 05:59:14 PDT 2015


On Tue, Mar 17, 2015 at 05:34:40PM +0530, Sunad Bhandary wrote:
> Hi Keith,
> 
> Any comments/updates on this ?
> 
>  	id_ctrl = mem;
>  	v_sup = id_ctrl->vwc;
> +	(id_ctrl->oncs & NVME_CTRL_ONCS_WRITE_UNCORRECTABLE) ?
> +				(wrt_uncor = 0x01) : (wrt_uncor = 0);

This is a weird way of writing it.  Either do it like this:

	if (id_ctrl->oncs & NVME_CTRL_ONCS_WRITE_UNCORRECTABLE)
		wrt_uncor = 0x01;
	else
		wrt_uncor = 0;

Or this:

	wrt_uncor = (id_ctrl->oncs & NVME_CTRL_ONCS_WRITE_UNCORRECTABLE) ? 1 : 0;

(and what's with the 'hex for one, decimal for the other' decision you
made there?)

> @@ -3001,6 +3059,10 @@ static int nvme_scsi_translate(struct nvme_ns *ns,
> struct sg_io_hdr *hdr)
>  	case UNMAP:
>  		retcode = nvme_trans_unmap(ns, hdr, cmd);
>  		break;
> +	case WRITE_LONG:
> +	case SERVICE_ACTION_OUT_16:
> +		retcode = nvme_trans_write_long(ns, hdr, cmd);
> +		break;

Umm ... SAO16 can be used for more commands than just Write Long 16.  You need
to check the Service Action in addition to the opcode.




More information about the Linux-nvme mailing list