linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Max Gurtovoy <maxg@mellanox.com>
Cc: linux-block@vger.kernel.org, axboe@kernel.dk,
	martin.petersen@oracle.com, linux-nvme@lists.infradead.org,
	keith.busch@intel.com, hch@lst.de, sagi@grimberg.me,
	shlomin@mellanox.com, israelr@mellanox.com
Subject: Re: [PATCH v2 1/1] block: centralize PI remapping logic to the block layer
Date: Wed, 4 Sep 2019 19:51:42 +0200	[thread overview]
Message-ID: <20190904175142.GA21990@lst.de> (raw)
In-Reply-To: <1567614452-26251-1-git-send-email-maxg@mellanox.com>

On Wed, Sep 04, 2019 at 07:27:32PM +0300, Max Gurtovoy wrote:
> @@ -1405,6 +1406,11 @@ bool blk_update_request(struct request *req, blk_status_t error,
>  	if (!req->bio)
>  		return false;
>  
> +	if (blk_integrity_rq(req) && req_op(req) == REQ_OP_READ &&
> +	    error == BLK_STS_OK)
> +		t10_pi_complete(req,
> +			nr_bytes >> blk_integrity_interval_shift(req->q));

I think it would be nicer to just pass nr_bytes to t10_pi_complete and 
do the calculation internally.  That keeps the caller a littler cleaner.

> -void t10_pi_prepare(struct request *rq, u8 protection_type)
> +void t10_pi_prepare(struct request *rq)
>  {
> +	u8 protection_type = rq->rq_disk->protection_type;

The protection_type variable is only used once, so we might as well
remove it.

> +void t10_pi_complete(struct request *rq, unsigned int intervals)
>  {
> +	u8 protection_type = rq->rq_disk->protection_type;

Same here.

> +static void nvme_set_disk_prot_type(struct nvme_ns *ns, struct gendisk *disk)
> +{
> +	switch (ns->pi_type) {
> +	case NVME_NS_DPS_PI_TYPE1:
> +		disk->protection_type = T10_PI_TYPE1_PROTECTION;
> +		break;
> +	case NVME_NS_DPS_PI_TYPE2:
> +		disk->protection_type = T10_PI_TYPE2_PROTECTION;
> +		break;
> +	case NVME_NS_DPS_PI_TYPE3:
> +		disk->protection_type = T10_PI_TYPE3_PROTECTION;
> +		break;
> +	default:
> +		disk->protection_type = T10_PI_TYPE0_PROTECTION;
> +		break;
> +	}
> +}

We just passed the value in direttly before, so I think we can keep
it that way.  In fact it might make sense to just remove the
NVME_NS_DPS_PI_TYPE* values entirely (in a separate patch).

But I think we should remove the pi_type field in struct nvme_ns here,
just like in sd.

  reply	other threads:[~2019-09-04 17:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04 16:27 [PATCH v2 1/1] block: centralize PI remapping logic to the block layer Max Gurtovoy
2019-09-04 17:51 ` Christoph Hellwig [this message]
2019-09-04 19:43 ` Keith Busch

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=20190904175142.GA21990@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=israelr@mellanox.com \
    --cc=keith.busch@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=martin.petersen@oracle.com \
    --cc=maxg@mellanox.com \
    --cc=sagi@grimberg.me \
    --cc=shlomin@mellanox.com \
    /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).