aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2014-09-26 19:20:04 -0400
committerJens Axboe <axboe@fb.com>2014-09-27 11:14:54 -0400
commitb1f01388574c9329922f760fc2a7335c2d14b08b (patch)
treee7c3715508c780745026678266c9e7718fa0be32
parent3aec2f41a8baeb70aa77556a4e4dcec7d9d70b4d (diff)
block: Relocate bio integrity flags
Move flags affecting the integrity code out of the bio bi_flags and into the block integrity payload. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--block/bio-integrity.c4
-rw-r--r--drivers/scsi/sd_dif.c4
-rw-r--r--include/linux/bio.h9
-rw-r--r--include/linux/blk_types.h6
4 files changed, 14 insertions, 9 deletions
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index e64733bb29b6..26aa901b961f 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -100,7 +100,7 @@ void bio_integrity_free(struct bio *bio)
100 struct bio_integrity_payload *bip = bio_integrity(bio); 100 struct bio_integrity_payload *bip = bio_integrity(bio);
101 struct bio_set *bs = bio->bi_pool; 101 struct bio_set *bs = bio->bi_pool;
102 102
103 if (bip->bip_owns_buf) 103 if (bip->bip_flags & BIP_BLOCK_INTEGRITY)
104 kfree(page_address(bip->bip_vec->bv_page) + 104 kfree(page_address(bip->bip_vec->bv_page) +
105 bip->bip_vec->bv_offset); 105 bip->bip_vec->bv_offset);
106 106
@@ -293,7 +293,7 @@ int bio_integrity_prep(struct bio *bio)
293 return -EIO; 293 return -EIO;
294 } 294 }
295 295
296 bip->bip_owns_buf = 1; 296 bip->bip_flags |= BIP_BLOCK_INTEGRITY;
297 bip->bip_iter.bi_size = len; 297 bip->bip_iter.bi_size = len;
298 bip_set_seed(bip, bio->bi_iter.bi_sector); 298 bip_set_seed(bip, bio->bi_iter.bi_sector);
299 299
diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c
index 1e971c6f8c2b..4ce636fdc15f 100644
--- a/drivers/scsi/sd_dif.c
+++ b/drivers/scsi/sd_dif.c
@@ -326,7 +326,7 @@ void sd_dif_prepare(struct request *rq, sector_t hw_sector,
326 unsigned int j; 326 unsigned int j;
327 327
328 /* Already remapped? */ 328 /* Already remapped? */
329 if (bio_flagged(bio, BIO_MAPPED_INTEGRITY)) 329 if (bip->bip_flags & BIP_MAPPED_INTEGRITY)
330 break; 330 break;
331 331
332 virt = bip_get_seed(bip) & 0xffffffff; 332 virt = bip_get_seed(bip) & 0xffffffff;
@@ -347,7 +347,7 @@ void sd_dif_prepare(struct request *rq, sector_t hw_sector,
347 kunmap_atomic(sdt); 347 kunmap_atomic(sdt);
348 } 348 }
349 349
350 bio->bi_flags |= (1 << BIO_MAPPED_INTEGRITY); 350 bip->bip_flags |= BIP_MAPPED_INTEGRITY;
351 } 351 }
352} 352}
353 353
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 3fd36660fd10..b508cf69206d 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -315,7 +315,7 @@ struct bio_integrity_payload {
315 unsigned short bip_slab; /* slab the bip came from */ 315 unsigned short bip_slab; /* slab the bip came from */
316 unsigned short bip_vcnt; /* # of integrity bio_vecs */ 316 unsigned short bip_vcnt; /* # of integrity bio_vecs */
317 unsigned short bip_max_vcnt; /* integrity bio_vec slots */ 317 unsigned short bip_max_vcnt; /* integrity bio_vec slots */
318 unsigned bip_owns_buf:1; /* should free bip_buf */ 318 unsigned short bip_flags; /* control flags */
319 319
320 struct work_struct bip_work; /* I/O completion */ 320 struct work_struct bip_work; /* I/O completion */
321 321
@@ -323,6 +323,13 @@ struct bio_integrity_payload {
323 struct bio_vec bip_inline_vecs[0];/* embedded bvec array */ 323 struct bio_vec bip_inline_vecs[0];/* embedded bvec array */
324}; 324};
325 325
326enum bip_flags {
327 BIP_BLOCK_INTEGRITY = 1 << 0, /* block layer owns integrity data */
328 BIP_MAPPED_INTEGRITY = 1 << 1, /* ref tag has been remapped */
329 BIP_CTRL_NOCHECK = 1 << 2, /* disable HBA integrity checking */
330 BIP_DISK_NOCHECK = 1 << 3, /* disable disk integrity checking */
331};
332
326static inline sector_t bip_get_seed(struct bio_integrity_payload *bip) 333static inline sector_t bip_get_seed(struct bio_integrity_payload *bip)
327{ 334{
328 return bip->bip_iter.bi_sector; 335 return bip->bip_iter.bi_sector;
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 6a5d2f2de1b9..38bc008e4503 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -120,10 +120,8 @@ struct bio {
120#define BIO_USER_MAPPED 6 /* contains user pages */ 120#define BIO_USER_MAPPED 6 /* contains user pages */
121#define BIO_EOPNOTSUPP 7 /* not supported */ 121#define BIO_EOPNOTSUPP 7 /* not supported */
122#define BIO_NULL_MAPPED 8 /* contains invalid user pages */ 122#define BIO_NULL_MAPPED 8 /* contains invalid user pages */
123#define BIO_FS_INTEGRITY 9 /* fs owns integrity data, not block layer */ 123#define BIO_QUIET 9 /* Make BIO Quiet */
124#define BIO_QUIET 10 /* Make BIO Quiet */ 124#define BIO_SNAP_STABLE 10 /* bio data must be snapshotted during write */
125#define BIO_MAPPED_INTEGRITY 11/* integrity metadata has been remapped */
126#define BIO_SNAP_STABLE 12 /* bio data must be snapshotted during write */
127 125
128/* 126/*
129 * Flags starting here get preserved by bio_reset() - this includes 127 * Flags starting here get preserved by bio_reset() - this includes