public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] blk-integrity: add rq_integrity_payload_size helper
       [not found] <CGME20230412052133epcms2p4d52e78b4fc1bc6ac1cc9d399a0378fce@epcms2p4>
@ 2023-04-12  5:21 ` Jinyoung CHOI
  2023-04-12  5:41   ` Chaitanya Kulkarni
  2023-04-12  6:53   ` hch
  0 siblings, 2 replies; 5+ messages in thread
From: Jinyoung CHOI @ 2023-04-12  5:21 UTC (permalink / raw)
  To: kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me,
	chaitanya.kulkarni@wdc.com, linux-nvme@lists.infradead.org,
	linux-kernel@vger.kernel.org

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)
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] blk-integrity: add rq_integrity_payload_size helper
  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
  2023-04-12  5:42     ` Chaitanya Kulkarni
  2023-04-12  6:53   ` hch
  1 sibling, 1 reply; 5+ messages in thread
From: Chaitanya Kulkarni @ 2023-04-12  5:41 UTC (permalink / raw)
  To: j-young.choi@samsung.com, kbusch@kernel.org, axboe@fb.com,
	hch@lst.de, sagi@grimberg.me, chaitanya.kulkarni@wdc.com,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] blk-integrity: add rq_integrity_payload_size helper
  2023-04-12  5:41   ` Chaitanya Kulkarni
@ 2023-04-12  5:42     ` Chaitanya Kulkarni
  2023-04-12  8:55       ` Jinyoung CHOI
  0 siblings, 1 reply; 5+ messages in thread
From: Chaitanya Kulkarni @ 2023-04-12  5:42 UTC (permalink / raw)
  To: j-young.choi@samsung.com, kbusch@kernel.org, axboe@fb.com,
	hch@lst.de, sagi@grimberg.me, chaitanya.kulkarni@wdc.com,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org


>> +
>> +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
>
>

disregard my comment, I think this is correct looking at the next patch...

-ck



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] blk-integrity: add rq_integrity_payload_size helper
  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
@ 2023-04-12  6:53   ` hch
  1 sibling, 0 replies; 5+ messages in thread
From: hch @ 2023-04-12  6:53 UTC (permalink / raw)
  To: Jinyoung CHOI
  Cc: kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me,
	chaitanya.kulkarni@wdc.com, linux-nvme@lists.infradead.org,
	linux-kernel@vger.kernel.org

> +	if (WARN_ON_ONCE(queue_max_integrity_segments(rq->q) > 1))
> +		return 0;

This should work for multiple segments as well.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE:(2) [PATCH 1/2] blk-integrity: add rq_integrity_payload_size helper
  2023-04-12  5:42     ` Chaitanya Kulkarni
@ 2023-04-12  8:55       ` Jinyoung CHOI
  0 siblings, 0 replies; 5+ messages in thread
From: Jinyoung CHOI @ 2023-04-12  8:55 UTC (permalink / raw)
  To: Chaitanya Kulkarni, kbusch@kernel.org, axboe@fb.com, hch@lst.de,
	sagi@grimberg.me, linux-nvme@lists.infradead.org,
	linux-kernel@vger.kernel.org

>>> +
>>> +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
>>
>>
>
> disregard my comment, I think this is correct looking at the next patch...
>
> -ck

OK Thanks for your review :)
I sent it to the wrong email address. (result from get_maintainer.pl)
I will update your email address for cc.

Kind Regards,
Jinyoung.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-12  8:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
2023-04-12  5:42     ` Chaitanya Kulkarni
2023-04-12  8:55       ` Jinyoung CHOI
2023-04-12  6:53   ` hch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox