diff options
-rw-r--r-- | block/blk-integrity.c | 8 | ||||
-rw-r--r-- | fs/bio-integrity.c | 29 |
2 files changed, 25 insertions, 12 deletions
diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 65f23ef38bbe..4ffa3814f6a9 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c | |||
@@ -178,8 +178,9 @@ static ssize_t integrity_attr_show(struct kobject *kobj, struct attribute *attr, | |||
178 | return entry->show(bi, page); | 178 | return entry->show(bi, page); |
179 | } | 179 | } |
180 | 180 | ||
181 | static ssize_t integrity_attr_store(struct kobject *kobj, struct attribute *attr, | 181 | static ssize_t integrity_attr_store(struct kobject *kobj, |
182 | const char *page, size_t count) | 182 | struct attribute *attr, const char *page, |
183 | size_t count) | ||
183 | { | 184 | { |
184 | struct blk_integrity *bi = | 185 | struct blk_integrity *bi = |
185 | container_of(kobj, struct blk_integrity, kobj); | 186 | container_of(kobj, struct blk_integrity, kobj); |
@@ -326,7 +327,8 @@ int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template) | |||
326 | BUG_ON(template == NULL); | 327 | BUG_ON(template == NULL); |
327 | 328 | ||
328 | if (disk->integrity == NULL) { | 329 | if (disk->integrity == NULL) { |
329 | bi = kmem_cache_alloc(integrity_cachep, GFP_KERNEL | __GFP_ZERO); | 330 | bi = kmem_cache_alloc(integrity_cachep, |
331 | GFP_KERNEL | __GFP_ZERO); | ||
330 | if (!bi) | 332 | if (!bi) |
331 | return -1; | 333 | return -1; |
332 | 334 | ||
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c index 31b08878913d..63e2ee63058d 100644 --- a/fs/bio-integrity.c +++ b/fs/bio-integrity.c | |||
@@ -39,7 +39,10 @@ static struct workqueue_struct *kintegrityd_wq; | |||
39 | * metadata. nr_vecs specifies the maximum number of pages containing | 39 | * metadata. nr_vecs specifies the maximum number of pages containing |
40 | * integrity metadata that can be attached. | 40 | * integrity metadata that can be attached. |
41 | */ | 41 | */ |
42 | struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *bio, gfp_t gfp_mask, unsigned int nr_vecs, struct bio_set *bs) | 42 | struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *bio, |
43 | gfp_t gfp_mask, | ||
44 | unsigned int nr_vecs, | ||
45 | struct bio_set *bs) | ||
43 | { | 46 | { |
44 | struct bio_integrity_payload *bip; | 47 | struct bio_integrity_payload *bip; |
45 | struct bio_vec *iv; | 48 | struct bio_vec *iv; |
@@ -81,7 +84,9 @@ EXPORT_SYMBOL(bio_integrity_alloc_bioset); | |||
81 | * metadata. nr_vecs specifies the maximum number of pages containing | 84 | * metadata. nr_vecs specifies the maximum number of pages containing |
82 | * integrity metadata that can be attached. | 85 | * integrity metadata that can be attached. |
83 | */ | 86 | */ |
84 | struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio, gfp_t gfp_mask, unsigned int nr_vecs) | 87 | struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio, |
88 | gfp_t gfp_mask, | ||
89 | unsigned int nr_vecs) | ||
85 | { | 90 | { |
86 | return bio_integrity_alloc_bioset(bio, gfp_mask, nr_vecs, fs_bio_set); | 91 | return bio_integrity_alloc_bioset(bio, gfp_mask, nr_vecs, fs_bio_set); |
87 | } | 92 | } |
@@ -174,7 +179,8 @@ EXPORT_SYMBOL(bio_integrity_enabled); | |||
174 | * sector size of the storage device. Convert the block layer sectors | 179 | * sector size of the storage device. Convert the block layer sectors |
175 | * to physical sectors. | 180 | * to physical sectors. |
176 | */ | 181 | */ |
177 | static inline unsigned int bio_integrity_hw_sectors(struct blk_integrity *bi, unsigned int sectors) | 182 | static inline unsigned int bio_integrity_hw_sectors(struct blk_integrity *bi, |
183 | unsigned int sectors) | ||
178 | { | 184 | { |
179 | /* At this point there are only 512b or 4096b DIF/EPP devices */ | 185 | /* At this point there are only 512b or 4096b DIF/EPP devices */ |
180 | if (bi->sector_size == 4096) | 186 | if (bi->sector_size == 4096) |
@@ -212,7 +218,8 @@ int bio_integrity_tag(struct bio *bio, void *tag_buf, unsigned int len, int set) | |||
212 | if (bi->tag_size == 0) | 218 | if (bi->tag_size == 0) |
213 | return -1; | 219 | return -1; |
214 | 220 | ||
215 | nr_sectors = bio_integrity_hw_sectors(bi, DIV_ROUND_UP(len, bi->tag_size)); | 221 | nr_sectors = bio_integrity_hw_sectors(bi, |
222 | DIV_ROUND_UP(len, bi->tag_size)); | ||
216 | 223 | ||
217 | if (nr_sectors * bi->tuple_size > bip->bip_size) { | 224 | if (nr_sectors * bi->tuple_size > bip->bip_size) { |
218 | printk(KERN_ERR "%s: tag too big for bio: %u > %u\n", | 225 | printk(KERN_ERR "%s: tag too big for bio: %u > %u\n", |
@@ -456,7 +463,7 @@ static int bio_integrity_verify(struct bio *bio) | |||
456 | */ | 463 | */ |
457 | static void bio_integrity_verify_fn(struct work_struct *work) | 464 | static void bio_integrity_verify_fn(struct work_struct *work) |
458 | { | 465 | { |
459 | struct bio_integrity_payload *bip = | 466 | struct bio_integrity_payload *bip = |
460 | container_of(work, struct bio_integrity_payload, bip_work); | 467 | container_of(work, struct bio_integrity_payload, bip_work); |
461 | struct bio *bio = bip->bip_bio; | 468 | struct bio *bio = bip->bip_bio; |
462 | int error = bip->bip_error; | 469 | int error = bip->bip_error; |
@@ -502,7 +509,8 @@ EXPORT_SYMBOL(bio_integrity_endio); | |||
502 | * @bip: Integrity vector to advance | 509 | * @bip: Integrity vector to advance |
503 | * @skip: Number of bytes to advance it | 510 | * @skip: Number of bytes to advance it |
504 | */ | 511 | */ |
505 | void bio_integrity_mark_head(struct bio_integrity_payload *bip, unsigned int skip) | 512 | void bio_integrity_mark_head(struct bio_integrity_payload *bip, |
513 | unsigned int skip) | ||
506 | { | 514 | { |
507 | struct bio_vec *iv; | 515 | struct bio_vec *iv; |
508 | unsigned int i; | 516 | unsigned int i; |
@@ -527,7 +535,8 @@ void bio_integrity_mark_head(struct bio_integrity_payload *bip, unsigned int ski | |||
527 | * @bip: Integrity vector to truncate | 535 | * @bip: Integrity vector to truncate |
528 | * @len: New length of integrity vector | 536 | * @len: New length of integrity vector |
529 | */ | 537 | */ |
530 | void bio_integrity_mark_tail(struct bio_integrity_payload *bip, unsigned int len) | 538 | void bio_integrity_mark_tail(struct bio_integrity_payload *bip, |
539 | unsigned int len) | ||
531 | { | 540 | { |
532 | struct bio_vec *iv; | 541 | struct bio_vec *iv; |
533 | unsigned int i; | 542 | unsigned int i; |
@@ -579,7 +588,8 @@ EXPORT_SYMBOL(bio_integrity_advance); | |||
579 | * and the length will be truncated corresponding to 'len' data | 588 | * and the length will be truncated corresponding to 'len' data |
580 | * sectors. | 589 | * sectors. |
581 | */ | 590 | */ |
582 | void bio_integrity_trim(struct bio *bio, unsigned int offset, unsigned int sectors) | 591 | void bio_integrity_trim(struct bio *bio, unsigned int offset, |
592 | unsigned int sectors) | ||
583 | { | 593 | { |
584 | struct bio_integrity_payload *bip = bio->bi_integrity; | 594 | struct bio_integrity_payload *bip = bio->bi_integrity; |
585 | struct blk_integrity *bi = bdev_get_integrity(bio->bi_bdev); | 595 | struct blk_integrity *bi = bdev_get_integrity(bio->bi_bdev); |
@@ -648,7 +658,8 @@ EXPORT_SYMBOL(bio_integrity_split); | |||
648 | * | 658 | * |
649 | * Description: Called to allocate a bip when cloning a bio | 659 | * Description: Called to allocate a bip when cloning a bio |
650 | */ | 660 | */ |
651 | int bio_integrity_clone(struct bio *bio, struct bio *bio_src, struct bio_set *bs) | 661 | int bio_integrity_clone(struct bio *bio, struct bio *bio_src, |
662 | struct bio_set *bs) | ||
652 | { | 663 | { |
653 | struct bio_integrity_payload *bip_src = bio_src->bi_integrity; | 664 | struct bio_integrity_payload *bip_src = bio_src->bi_integrity; |
654 | struct bio_integrity_payload *bip; | 665 | struct bio_integrity_payload *bip; |