Commit 495d2b3883682fcd1c3dee3a45e38fd00154ae25
Committed by
Jens Axboe
1 parent
e817bf3f68
Exists in
master
and in
39 other branches
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>
Showing 2 changed files with 7 additions and 7 deletions Side-by-side Diff
drivers/scsi/sd_dif.c
... | ... | @@ -375,21 +375,20 @@ |
375 | 375 | unsigned int i, j; |
376 | 376 | u32 phys, virt; |
377 | 377 | |
378 | - /* Already remapped? */ | |
379 | - if (rq->cmd_flags & REQ_INTEGRITY) | |
380 | - return 0; | |
381 | - | |
382 | 378 | sdkp = rq->bio->bi_bdev->bd_disk->private_data; |
383 | 379 | |
384 | 380 | if (sdkp->protection_type == SD_DIF_TYPE3_PROTECTION) |
385 | 381 | return 0; |
386 | 382 | |
387 | - rq->cmd_flags |= REQ_INTEGRITY; | |
388 | 383 | phys = hw_sector & 0xffffffff; |
389 | 384 | |
390 | 385 | __rq_for_each_bio(bio, rq) { |
391 | 386 | struct bio_vec *iv; |
392 | 387 | |
388 | + /* Already remapped? */ | |
389 | + if (bio_flagged(bio, BIO_MAPPED_INTEGRITY)) | |
390 | + break; | |
391 | + | |
393 | 392 | virt = bio->bi_integrity->bip_sector & 0xffffffff; |
394 | 393 | |
395 | 394 | bip_for_each_vec(iv, bio->bi_integrity, i) { |
... | ... | @@ -408,6 +407,8 @@ |
408 | 407 | |
409 | 408 | kunmap_atomic(sdt, KM_USER0); |
410 | 409 | } |
410 | + | |
411 | + bio->bi_flags |= BIO_MAPPED_INTEGRITY; | |
411 | 412 | } |
412 | 413 | |
413 | 414 | return 0; |
include/linux/blk_types.h
... | ... | @@ -97,6 +97,7 @@ |
97 | 97 | #define BIO_NULL_MAPPED 9 /* contains invalid user pages */ |
98 | 98 | #define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */ |
99 | 99 | #define BIO_QUIET 11 /* Make BIO Quiet */ |
100 | +#define BIO_MAPPED_INTEGRITY 12/* integrity metadata has been remapped */ | |
100 | 101 | #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) |
101 | 102 | |
102 | 103 | /* |
... | ... | @@ -148,7 +149,6 @@ |
148 | 149 | __REQ_ORDERED_COLOR, /* is before or after barrier */ |
149 | 150 | __REQ_ALLOCED, /* request came from our alloc pool */ |
150 | 151 | __REQ_COPY_USER, /* contains copies of user pages */ |
151 | - __REQ_INTEGRITY, /* integrity metadata has been remapped */ | |
152 | 152 | __REQ_FLUSH, /* request for cache flush */ |
153 | 153 | __REQ_IO_STAT, /* account I/O stat */ |
154 | 154 | __REQ_MIXED_MERGE, /* merge of different types, fail separately */ |
... | ... | @@ -190,7 +190,6 @@ |
190 | 190 | #define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR) |
191 | 191 | #define REQ_ALLOCED (1 << __REQ_ALLOCED) |
192 | 192 | #define REQ_COPY_USER (1 << __REQ_COPY_USER) |
193 | -#define REQ_INTEGRITY (1 << __REQ_INTEGRITY) | |
194 | 193 | #define REQ_FLUSH (1 << __REQ_FLUSH) |
195 | 194 | #define REQ_IO_STAT (1 << __REQ_IO_STAT) |
196 | 195 | #define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) |