Linux-SCSI Archive on lore.kernel.org
 help / color / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: David Disseldorp <ddiss@suse.de>
Cc: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org,
	martin.petersen@oracle.com, bvanassche@acm.org
Subject: Re: [PATCH v2 5/5] scsi: target: use the stack for XCOPY passthrough cmds
Date: Fri, 27 Mar 2020 02:27:27 -0700
Message-ID: <20200327092727.GB7952@infradead.org> (raw)
In-Reply-To: <20200326221505.5303-6-ddiss@suse.de>

On Thu, Mar 26, 2020 at 11:15:05PM +0100, David Disseldorp wrote:
> Reads and writes in the XCOPY loop are synchronous, so needn't be
> heap allocated / freed with each loop.
> 
> Signed-off-by: David Disseldorp <ddiss@suse.de>

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

But a few cleanup opportunities if you don't mind a respin:

> -	rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, src_dev, &cdb[0],
> +	rc = target_xcopy_setup_pt_cmd(&xpt_cmd, xop, src_dev, &cdb[0],
>  				remote_port);
>  	if (rc < 0) {
> -		ec_cmd->scsi_status = xpt_cmd->se_cmd.scsi_status;
> +		ec_cmd->scsi_status = se_cmd->scsi_status;
>  		transport_generic_free_cmd(se_cmd, 0);
>  		return rc;
>  	}
> @@ -603,13 +598,14 @@ static int target_xcopy_read_source(
>  	pr_debug("XCOPY-READ: Saved xop->xop_data_sg: %p, num: %u for READ"
>  		" memory\n", xop->xop_data_sg, xop->xop_data_nents);
>  
> -	rc = target_xcopy_issue_pt_cmd(xpt_cmd);
> +	rc = target_xcopy_issue_pt_cmd(&xpt_cmd);
>  	if (rc < 0) {
> -		ec_cmd->scsi_status = xpt_cmd->se_cmd.scsi_status;
> +		ec_cmd->scsi_status = se_cmd->scsi_status;
>  		transport_generic_free_cmd(se_cmd, 0);
>  		return rc;
>  	}
>  
> +	transport_generic_free_cmd(se_cmd, 0);
>  	return 0;

I think this should use a common label to free the command.  Same
for the write side.

>  		if (rc < 0) {
> -			transport_generic_free_cmd(&xop->src_pt_cmd->se_cmd, 0);
>  			goto out;
>  		}

No need for the braces now.

      reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26 22:15 [PATCH v2 0/5] scsi: target: David Disseldorp
2020-03-26 22:15 ` [PATCH v2 1/5] scsi: target: use #def for xcopy descriptor len David Disseldorp
2020-03-26 22:15 ` [PATCH v2 2/5] scsi: target: drop xcopy DISK BLOCK LENGTH debug David Disseldorp
2020-03-26 22:15 ` [PATCH v2 3/5] scsi: target: avoid per-loop XCOPY buffer allocations David Disseldorp
2020-03-27  9:24   ` Christoph Hellwig
2020-03-26 22:15 ` [PATCH v2 4/5] scsi: target: increase XCOPY I/O size David Disseldorp
2020-03-26 22:15 ` [PATCH v2 5/5] scsi: target: use the stack for XCOPY passthrough cmds David Disseldorp
2020-03-27  9:27   ` Christoph Hellwig [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200327092727.GB7952@infradead.org \
    --to=hch@infradead.org \
    --cc=bvanassche@acm.org \
    --cc=ddiss@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-SCSI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-scsi/0 linux-scsi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-scsi linux-scsi/ https://lore.kernel.org/linux-scsi \
		linux-scsi@vger.kernel.org
	public-inbox-index linux-scsi

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-scsi


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git