All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: Christoph Hellwig <hch@lst.de>,
	James Bottomley <JBottomley@Parallels.com>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH 3/4] scsi: reintroduce scsi_driver.init_command
Date: Mon, 31 Mar 2014 08:08:45 +0200	[thread overview]
Message-ID: <20140331060845.GA13184@lst.de> (raw)
In-Reply-To: <1396244704.22255.46.camel@haakon3.risingtidesystems.com>

On Sun, Mar 30, 2014 at 10:45:04PM -0700, Nicholas A. Bellinger wrote:
> >  int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req)
> >  {
> > -	struct scsi_cmnd *cmd;
> > -	int ret = scsi_prep_state_check(sdev, req);
> > -
> > -	if (ret != BLKPREP_OK)
> > -		return ret;
> > -
> > -	cmd = scsi_get_cmd_from_req(sdev, req);
> > -	if (unlikely(!cmd))
> > -		return BLKPREP_DEFER;
> > +	struct scsi_cmnd *cmd = req->special;
> >  
> 
> Mmm, I thought that req->special was only holding a pointer to a
> pre-allocated scsi_cmnd during mq operation, no..?

For the mq case the block layer sets up req->special.  For the old case
scsi_get_cmd_from_req sets up req->special the first it is called, and
leaves it in there until the command is done.

> > +	ret = scsi_prep_state_check(sdev, req);
> > +	if (ret != BLKPREP_OK)
> > +		goto out;
> > +
> > +	cmd = scsi_get_cmd_from_req(sdev, req);
> > +	if (unlikely(!cmd)) {
> > +		ret = BLKPREP_DEFER;
> > +		goto out;
> > +	}
> > +


>From here the req->special pointer may or may not be set depending on mq
operation, no..?

a) there is no blk-mq support yet in James tree (+ these patches)
b) even in my scsi-mq tree this code path won't be called for the mq case
c) after scsi_get_cmd_from_req returns req->special will always be set up
   to point to the scsi_cmnd:

static struct scsi_cmnd *scsi_get_cmd_from_req(struct scsi_device *sdev,
		struct request *req)
{
	struct scsi_cmnd *cmd;

	if (!req->special) {
		...

		req->special = cmd;
	} else {
		cmd = req->special;
	}

        /* pull a tag out of the request if we have one */
	cmd->tag = req->tag;
	cmd->request = req;

	cmd->cmnd = req->cmd;   
	cmd->prot_op = SCSI_PROT_NORMAL;

	return cmd;
}

> >  	}
> >  	ret = scsi_setup_fs_cmnd(sdp, rq);
> >  	if (ret != BLKPREP_OK)
> 
> And this currently assumes req->special is always set when calling
> scsi_setup_fs_cmnd()

That is the case both before and after this patch.


  reply	other threads:[~2014-03-31  6:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27 16:14 misc scsi midlayer updates Christoph Hellwig
2014-03-27 16:14 ` [PATCH 1/4] scsi: explicitly release bidi buffers Christoph Hellwig
2014-03-31  5:58   ` Mike Christie
2014-03-31  6:10     ` Christoph Hellwig
2014-03-27 16:14 ` [PATCH 2/4] scsi: remove scsi_end_request Christoph Hellwig
2014-03-31  5:26   ` Nicholas A. Bellinger
2014-03-27 16:14 ` [PATCH 3/4] scsi: reintroduce scsi_driver.init_command Christoph Hellwig
2014-03-31  5:45   ` Nicholas A. Bellinger
2014-03-31  6:08     ` Christoph Hellwig [this message]
2014-03-31  6:20       ` Nicholas A. Bellinger
2014-03-31  6:56   ` Mike Christie
2014-03-31  8:09     ` Christoph Hellwig
2014-03-31 19:00   ` [PATCH 3/4 v2] " Christoph Hellwig
2014-03-27 16:14 ` [PATCH 4/4] scsi: handle command allocation failure in scsi_reset_provider Christoph Hellwig
2014-03-31  5:45   ` Nicholas A. Bellinger
2014-03-30 15:33 ` misc scsi midlayer updates Boaz Harrosh
2014-03-31  6:20   ` Christoph Hellwig
2014-03-31 21:55 ` Mike Christie
  -- strict thread matches above, loose matches on Subject: below --
2014-03-31 10:45 [PATCH 3/4] scsi: reintroduce scsi_driver.init_command Christoph Hellwig
2014-05-01 14:51 scsi midlayer updates for 3.15 (resend) Christoph Hellwig
2014-05-01 14:51 ` [PATCH 3/4] scsi: reintroduce scsi_driver.init_command Christoph Hellwig
2014-05-08  7:11   ` Hannes Reinecke

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=20140331060845.GA13184@lst.de \
    --to=hch@lst.de \
    --cc=JBottomley@Parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nab@linux-iscsi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.