aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/sd_dif.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c
index 84be62149c6c..0cb39ff21171 100644
--- a/drivers/scsi/sd_dif.c
+++ b/drivers/scsi/sd_dif.c
@@ -375,21 +375,20 @@ int sd_dif_prepare(struct request *rq, sector_t hw_sector, unsigned int sector_s
375 unsigned int i, j; 375 unsigned int i, j;
376 u32 phys, virt; 376 u32 phys, virt;
377 377
378 /* Already remapped? */
379 if (rq->cmd_flags & REQ_INTEGRITY)
380 return 0;
381
382 sdkp = rq->bio->bi_bdev->bd_disk->private_data; 378 sdkp = rq->bio->bi_bdev->bd_disk->private_data;
383 379
384 if (sdkp->protection_type == SD_DIF_TYPE3_PROTECTION) 380 if (sdkp->protection_type == SD_DIF_TYPE3_PROTECTION)
385 return 0; 381 return 0;
386 382
387 rq->cmd_flags |= REQ_INTEGRITY;
388 phys = hw_sector & 0xffffffff; 383 phys = hw_sector & 0xffffffff;
389 384
390 __rq_for_each_bio(bio, rq) { 385 __rq_for_each_bio(bio, rq) {
391 struct bio_vec *iv; 386 struct bio_vec *iv;
392 387
388 /* Already remapped? */
389 if (bio_flagged(bio, BIO_MAPPED_INTEGRITY))
390 break;
391
393 virt = bio->bi_integrity->bip_sector & 0xffffffff; 392 virt = bio->bi_integrity->bip_sector & 0xffffffff;
394 393
395 bip_for_each_vec(iv, bio->bi_integrity, i) { 394 bip_for_each_vec(iv, bio->bi_integrity, i) {
@@ -408,6 +407,8 @@ int sd_dif_prepare(struct request *rq, sector_t hw_sector, unsigned int sector_s
408 407
409 kunmap_atomic(sdt, KM_USER0); 408 kunmap_atomic(sdt, KM_USER0);
410 } 409 }
410
411 bio->bi_flags |= BIO_MAPPED_INTEGRITY;
411 } 412 }
412 413
413 return 0; 414 return 0;