aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2014-09-26 19:20:01 -0400
committerJens Axboe <axboe@fb.com>2014-09-27 11:14:51 -0400
commit1859308853b19c4daf4afaab910d3d52ac1ec2ff (patch)
tree3b5a3ffcb96d88320cb609883f436b33b094ac58 /include/linux
parent5a2aa873059fec8b6385071d9c0802893a9b2f41 (diff)
block: Clean up the code used to generate and verify integrity metadata
Instead of the "operate" parameter we pass in a seed value and a pointer to a function that can be used to process the integrity metadata. The generation function is changed to have a return value to fit into this scheme. 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>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bio.h12
-rw-r--r--include/linux/blkdev.h9
2 files changed, 16 insertions, 5 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 448d8c052cb7..3fd36660fd10 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -322,6 +322,18 @@ struct bio_integrity_payload {
322 struct bio_vec *bip_vec; 322 struct bio_vec *bip_vec;
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
326static inline sector_t bip_get_seed(struct bio_integrity_payload *bip)
327{
328 return bip->bip_iter.bi_sector;
329}
330
331static inline void bip_set_seed(struct bio_integrity_payload *bip,
332 sector_t seed)
333{
334 bip->bip_iter.bi_sector = seed;
335}
336
325#endif /* CONFIG_BLK_DEV_INTEGRITY */ 337#endif /* CONFIG_BLK_DEV_INTEGRITY */
326 338
327extern void bio_trim(struct bio *bio, int offset, int size); 339extern void bio_trim(struct bio *bio, int offset, int size);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d364c42dbf17..24c1e055b8a7 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1461,7 +1461,7 @@ static inline uint64_t rq_io_start_time_ns(struct request *req)
1461#define INTEGRITY_FLAG_READ 2 /* verify data integrity on read */ 1461#define INTEGRITY_FLAG_READ 2 /* verify data integrity on read */
1462#define INTEGRITY_FLAG_WRITE 4 /* generate data integrity on write */ 1462#define INTEGRITY_FLAG_WRITE 4 /* generate data integrity on write */
1463 1463
1464struct blk_integrity_exchg { 1464struct blk_integrity_iter {
1465 void *prot_buf; 1465 void *prot_buf;
1466 void *data_buf; 1466 void *data_buf;
1467 sector_t seed; 1467 sector_t seed;
@@ -1470,12 +1470,11 @@ struct blk_integrity_exchg {
1470 const char *disk_name; 1470 const char *disk_name;
1471}; 1471};
1472 1472
1473typedef void (integrity_gen_fn) (struct blk_integrity_exchg *); 1473typedef int (integrity_processing_fn) (struct blk_integrity_iter *);
1474typedef int (integrity_vrfy_fn) (struct blk_integrity_exchg *);
1475 1474
1476struct blk_integrity { 1475struct blk_integrity {
1477 integrity_gen_fn *generate_fn; 1476 integrity_processing_fn *generate_fn;
1478 integrity_vrfy_fn *verify_fn; 1477 integrity_processing_fn *verify_fn;
1479 1478
1480 unsigned short flags; 1479 unsigned short flags;
1481 unsigned short tuple_size; 1480 unsigned short tuple_size;