linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / 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	[thread overview]
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	other threads:[~2020-03-27  9:27 UTC|newest]

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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).