diff mbox series

[PATCHv3,03/10] scsi: use request helper to get integrity segments

Message ID 20240904152605.4055570-4-kbusch@meta.com
State Superseded
Headers show
Series block integrity merging and counting | expand

Commit Message

Keith Busch Sept. 4, 2024, 3:25 p.m. UTC
From: Keith Busch <kbusch@kernel.org>

The request tracks the integrity segments already, so no need to recount
the segements again.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 drivers/scsi/scsi_lib.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Christoph Hellwig Sept. 10, 2024, 3:32 p.m. UTC | #1
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 3958a6d14bf45..dc1a1644cbc0c 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1175,8 +1175,7 @@ blk_status_t scsi_alloc_sgtables(struct scsi_cmnd *cmd)
>  			goto out_free_sgtables;
>  		}
>  
> -		ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio);
> -
> +		ivecs = blk_rq_integrity_segments(rq);

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

although I'd be tempted to just remove the BUG_ON below (or move
it into blk_rq_map_integrity_sg) and the ivecs variable entirely.
Keith Busch Sept. 10, 2024, 11:02 p.m. UTC | #2
On Tue, Sep 10, 2024 at 05:32:17PM +0200, Christoph Hellwig wrote:
> 
> although I'd be tempted to just remove the BUG_ON below (or move
> it into blk_rq_map_integrity_sg) and the ivecs variable entirely.

Right, I actually have more follow up's doing that. We just need to
change blk_rq_map_integrity_sg() first to take a request instead of a
request_queue + bio. I thought I might be getting carried away with the
"cleanups" though, so was saving that for later. I can definitely add
that into the series now though.
Christoph Hellwig Sept. 11, 2024, 8:06 a.m. UTC | #3
On Tue, Sep 10, 2024 at 05:02:18PM -0600, Keith Busch wrote:
> Right, I actually have more follow up's doing that. We just need to
> change blk_rq_map_integrity_sg() first to take a request instead of a
> request_queue + bio. I thought I might be getting carried away with the
> "cleanups" though, so was saving that for later. I can definitely add
> that into the series now though.

Well, it seems like the metadata code really needs a lot more attention
:(

And it seems like we really need the io_uring passthrough support to
be able to fully exercise it.
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 3958a6d14bf45..dc1a1644cbc0c 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1175,8 +1175,7 @@  blk_status_t scsi_alloc_sgtables(struct scsi_cmnd *cmd)
 			goto out_free_sgtables;
 		}
 
-		ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio);
-
+		ivecs = blk_rq_integrity_segments(rq);
 		if (sg_alloc_table_chained(&prot_sdb->table, ivecs,
 				prot_sdb->table.sgl,
 				SCSI_INLINE_PROT_SG_CNT)) {