public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: "j-young.choi@samsung.com" <j-young.choi@samsung.com>,
	"kbusch@kernel.org" <kbusch@kernel.org>,
	"axboe@fb.com" <axboe@fb.com>, "hch@lst.de" <hch@lst.de>,
	"sagi@grimberg.me" <sagi@grimberg.me>,
	"chaitanya.kulkarni@wdc.com" <chaitanya.kulkarni@wdc.com>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] blk-integrity: add rq_integrity_payload_size helper
Date: Wed, 12 Apr 2023 05:41:11 +0000	[thread overview]
Message-ID: <91df2b07-02a2-d034-bd8b-a67c13ca085a@nvidia.com> (raw)
In-Reply-To: <20230412052133epcms2p4d52e78b4fc1bc6ac1cc9d399a0378fce@epcms2p4>

On 4/11/23 22:21, Jinyoung CHOI wrote:
> This provides a nice shortcut to get the size of the integrity data
> for the driver like NVMe that only support a single integrity segment.
>
> Signed-off-by: Jinyoung Choi <j-young.choi@samsung.com>
> ---
>   include/linux/blk-integrity.h | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h
> index 378b2459efe2..abf1923f4aa5 100644
> --- a/include/linux/blk-integrity.h
> +++ b/include/linux/blk-integrity.h
> @@ -114,6 +114,13 @@ static inline struct bio_vec *rq_integrity_vec(struct request *rq)
>   		return NULL;
>   	return rq->bio->bi_integrity->bip_vec;
>   }
> +
> +static inline unsigned int rq_integrity_payload_size(struct request *rq)
> +{
> +	if (WARN_ON_ONCE(queue_max_integrity_segments(rq->q) > 1))
> +		return 0;
> +	return rq->bio->bi_integrity->bip_iter.bi_size;
> +}
>   #else /* CONFIG_BLK_DEV_INTEGRITY */
>   static inline int blk_rq_count_integrity_sg(struct request_queue *q,
>   					    struct bio *b)

from the comments that I got in the past, you should only be adding
a helper in the patch that is actually using it.

-ck



  reply	other threads:[~2023-04-12  5:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230412052133epcms2p4d52e78b4fc1bc6ac1cc9d399a0378fce@epcms2p4>
2023-04-12  5:21 ` [PATCH 1/2] blk-integrity: add rq_integrity_payload_size helper Jinyoung CHOI
2023-04-12  5:41   ` Chaitanya Kulkarni [this message]
2023-04-12  5:42     ` Chaitanya Kulkarni
2023-04-12  8:55       ` Jinyoung CHOI
2023-04-12  6:53   ` hch

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=91df2b07-02a2-d034-bd8b-a67c13ca085a@nvidia.com \
    --to=chaitanyak@nvidia.com \
    --cc=axboe@fb.com \
    --cc=chaitanya.kulkarni@wdc.com \
    --cc=hch@lst.de \
    --cc=j-young.choi@samsung.com \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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