aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2010-10-15 09:49:20 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-10-15 09:49:20 -0400
commit495d2b3883682fcd1c3dee3a45e38fd00154ae25 (patch)
tree1d2f76a70fc1c5edbb39769e675b9e468a346d5e
parente817bf3f68f55e7307c3e9abe5f32d0c05c83988 (diff)
block: Make the integrity mapped property a bio flag
Previously we tracked whether the integrity metadata had been remapped using a request flag. This was fine for low-level retries. However, if an I/O was redriven by upper layers we would end up remapping again, causing the retry to fail. Deprecate the REQ_INTEGRITY flag and introduce BIO_MAPPED_INTEGRITY which enables filesystems to notify lower layers that the bio in question has already been remapped. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
-rw-r--r--drivers/scsi/sd_dif.c11
-rw-r--r--include/linux/blk_types.h3
2 files changed, 7 insertions, 7 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;
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 10a0c291b55a..d36629620a4f 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -97,6 +97,7 @@ struct bio {
97#define BIO_NULL_MAPPED 9 /* contains invalid user pages */ 97#define BIO_NULL_MAPPED 9 /* contains invalid user pages */
98#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */ 98#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */
99#define BIO_QUIET 11 /* Make BIO Quiet */ 99#define BIO_QUIET 11 /* Make BIO Quiet */
100#define BIO_MAPPED_INTEGRITY 12/* integrity metadata has been remapped */
100#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) 101#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
101 102
102/* 103/*
@@ -148,7 +149,6 @@ enum rq_flag_bits {
148 __REQ_ORDERED_COLOR, /* is before or after barrier */ 149 __REQ_ORDERED_COLOR, /* is before or after barrier */
149 __REQ_ALLOCED, /* request came from our alloc pool */ 150 __REQ_ALLOCED, /* request came from our alloc pool */
150 __REQ_COPY_USER, /* contains copies of user pages */ 151 __REQ_COPY_USER, /* contains copies of user pages */
151 __REQ_INTEGRITY, /* integrity metadata has been remapped */
152 __REQ_FLUSH, /* request for cache flush */ 152 __REQ_FLUSH, /* request for cache flush */
153 __REQ_IO_STAT, /* account I/O stat */ 153 __REQ_IO_STAT, /* account I/O stat */
154 __REQ_MIXED_MERGE, /* merge of different types, fail separately */ 154 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
@@ -190,7 +190,6 @@ enum rq_flag_bits {
190#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR) 190#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
191#define REQ_ALLOCED (1 << __REQ_ALLOCED) 191#define REQ_ALLOCED (1 << __REQ_ALLOCED)
192#define REQ_COPY_USER (1 << __REQ_COPY_USER) 192#define REQ_COPY_USER (1 << __REQ_COPY_USER)
193#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
194#define REQ_FLUSH (1 << __REQ_FLUSH) 193#define REQ_FLUSH (1 << __REQ_FLUSH)
195#define REQ_IO_STAT (1 << __REQ_IO_STAT) 194#define REQ_IO_STAT (1 << __REQ_IO_STAT)
196#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) 195#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)