diff mbox series

[v2,04/14] block: fix not to apply bip information in blk_rq_bio_prep()

Message ID 20230510085111epcms2p7022e97fd97c1a32c59f935d72f8dda94@epcms2p7 (mailing list archive)
State New, archived
Headers show
Series Change the integrity configuration method in block | expand

Commit Message

Jinyoung Choi May 10, 2023, 8:51 a.m. UTC
When a request is initialized through the bio, bio's integrity
information is not reflected in the request. It seems to be missing
when the codes associated with 'nr_integrity_segment' were added.

the lld such as scsi does not refer to this variable. It uses
integrity's bevc to calculate the number of segments for sg-list. So
there seems to be no problem related to this.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Martin K. Petersen <martin.petersen@oracle.com>

Fixes: 13f05c8d8e98 ("block/scsi: Provide a limit on the number of integrity segments")
Signed-off-by: Jinyoung Choi <j-young.choi@samsung.com>
---
 include/linux/blk-mq.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Christoph Hellwig May 12, 2023, 1:47 p.m. UTC | #1
> +#if defined(CONFIG_BLK_DEV_INTEGRITY)

The normal style is to use #ifdef.

> +	if (bio_integrity(bio))
> +		rq->nr_integrity_segments = bio_integrity(bio)->bip_vcnt;
> +#endif
> >

Don't we need to walk the iter here, as it might already have been
advanced?  Although it seems nothing in the integrity code follows
that model right now, so I'm not quite sure how it's even working with
clones at the moment.
diff mbox series

Patch

diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 1dacb2c81fdd..9310c94577c7 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -961,6 +961,11 @@  static inline void blk_rq_bio_prep(struct request *rq, struct bio *bio,
 	rq->__data_len = bio->bi_iter.bi_size;
 	rq->bio = rq->biotail = bio;
 	rq->ioprio = bio_prio(bio);
+
+#if defined(CONFIG_BLK_DEV_INTEGRITY)
+	if (bio_integrity(bio))
+		rq->nr_integrity_segments = bio_integrity(bio)->bip_vcnt;
+#endif
 }
 
 void blk_mq_hctx_set_fq_lock_class(struct blk_mq_hw_ctx *hctx,