diff options
Diffstat (limited to 'fs/bio-integrity.c')
-rw-r--r-- | fs/bio-integrity.c | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c index e85c04b9f61c..a3f28f331b2b 100644 --- a/fs/bio-integrity.c +++ b/fs/bio-integrity.c | |||
@@ -70,23 +70,25 @@ static inline int use_bip_pool(unsigned int idx) | |||
70 | } | 70 | } |
71 | 71 | ||
72 | /** | 72 | /** |
73 | * bio_integrity_alloc_bioset - Allocate integrity payload and attach it to bio | 73 | * bio_integrity_alloc - Allocate integrity payload and attach it to bio |
74 | * @bio: bio to attach integrity metadata to | 74 | * @bio: bio to attach integrity metadata to |
75 | * @gfp_mask: Memory allocation mask | 75 | * @gfp_mask: Memory allocation mask |
76 | * @nr_vecs: Number of integrity metadata scatter-gather elements | 76 | * @nr_vecs: Number of integrity metadata scatter-gather elements |
77 | * @bs: bio_set to allocate from | ||
78 | * | 77 | * |
79 | * Description: This function prepares a bio for attaching integrity | 78 | * Description: This function prepares a bio for attaching integrity |
80 | * metadata. nr_vecs specifies the maximum number of pages containing | 79 | * metadata. nr_vecs specifies the maximum number of pages containing |
81 | * integrity metadata that can be attached. | 80 | * integrity metadata that can be attached. |
82 | */ | 81 | */ |
83 | struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *bio, | 82 | struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio, |
84 | gfp_t gfp_mask, | 83 | gfp_t gfp_mask, |
85 | unsigned int nr_vecs, | 84 | unsigned int nr_vecs) |
86 | struct bio_set *bs) | ||
87 | { | 85 | { |
88 | struct bio_integrity_payload *bip; | 86 | struct bio_integrity_payload *bip; |
89 | unsigned int idx = vecs_to_idx(nr_vecs); | 87 | unsigned int idx = vecs_to_idx(nr_vecs); |
88 | struct bio_set *bs = bio->bi_pool; | ||
89 | |||
90 | if (!bs) | ||
91 | bs = fs_bio_set; | ||
90 | 92 | ||
91 | BUG_ON(bio == NULL); | 93 | BUG_ON(bio == NULL); |
92 | bip = NULL; | 94 | bip = NULL; |
@@ -114,37 +116,22 @@ struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *bio, | |||
114 | 116 | ||
115 | return bip; | 117 | return bip; |
116 | } | 118 | } |
117 | EXPORT_SYMBOL(bio_integrity_alloc_bioset); | ||
118 | |||
119 | /** | ||
120 | * bio_integrity_alloc - Allocate integrity payload and attach it to bio | ||
121 | * @bio: bio to attach integrity metadata to | ||
122 | * @gfp_mask: Memory allocation mask | ||
123 | * @nr_vecs: Number of integrity metadata scatter-gather elements | ||
124 | * | ||
125 | * Description: This function prepares a bio for attaching integrity | ||
126 | * metadata. nr_vecs specifies the maximum number of pages containing | ||
127 | * integrity metadata that can be attached. | ||
128 | */ | ||
129 | struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio, | ||
130 | gfp_t gfp_mask, | ||
131 | unsigned int nr_vecs) | ||
132 | { | ||
133 | return bio_integrity_alloc_bioset(bio, gfp_mask, nr_vecs, fs_bio_set); | ||
134 | } | ||
135 | EXPORT_SYMBOL(bio_integrity_alloc); | 119 | EXPORT_SYMBOL(bio_integrity_alloc); |
136 | 120 | ||
137 | /** | 121 | /** |
138 | * bio_integrity_free - Free bio integrity payload | 122 | * bio_integrity_free - Free bio integrity payload |
139 | * @bio: bio containing bip to be freed | 123 | * @bio: bio containing bip to be freed |
140 | * @bs: bio_set this bio was allocated from | ||
141 | * | 124 | * |
142 | * Description: Used to free the integrity portion of a bio. Usually | 125 | * Description: Used to free the integrity portion of a bio. Usually |
143 | * called from bio_free(). | 126 | * called from bio_free(). |
144 | */ | 127 | */ |
145 | void bio_integrity_free(struct bio *bio, struct bio_set *bs) | 128 | void bio_integrity_free(struct bio *bio) |
146 | { | 129 | { |
147 | struct bio_integrity_payload *bip = bio->bi_integrity; | 130 | struct bio_integrity_payload *bip = bio->bi_integrity; |
131 | struct bio_set *bs = bio->bi_pool; | ||
132 | |||
133 | if (!bs) | ||
134 | bs = fs_bio_set; | ||
148 | 135 | ||
149 | BUG_ON(bip == NULL); | 136 | BUG_ON(bip == NULL); |
150 | 137 | ||
@@ -730,19 +717,18 @@ EXPORT_SYMBOL(bio_integrity_split); | |||
730 | * @bio: New bio | 717 | * @bio: New bio |
731 | * @bio_src: Original bio | 718 | * @bio_src: Original bio |
732 | * @gfp_mask: Memory allocation mask | 719 | * @gfp_mask: Memory allocation mask |
733 | * @bs: bio_set to allocate bip from | ||
734 | * | 720 | * |
735 | * Description: Called to allocate a bip when cloning a bio | 721 | * Description: Called to allocate a bip when cloning a bio |
736 | */ | 722 | */ |
737 | int bio_integrity_clone(struct bio *bio, struct bio *bio_src, | 723 | int bio_integrity_clone(struct bio *bio, struct bio *bio_src, |
738 | gfp_t gfp_mask, struct bio_set *bs) | 724 | gfp_t gfp_mask) |
739 | { | 725 | { |
740 | struct bio_integrity_payload *bip_src = bio_src->bi_integrity; | 726 | struct bio_integrity_payload *bip_src = bio_src->bi_integrity; |
741 | struct bio_integrity_payload *bip; | 727 | struct bio_integrity_payload *bip; |
742 | 728 | ||
743 | BUG_ON(bip_src == NULL); | 729 | BUG_ON(bip_src == NULL); |
744 | 730 | ||
745 | bip = bio_integrity_alloc_bioset(bio, gfp_mask, bip_src->bip_vcnt, bs); | 731 | bip = bio_integrity_alloc(bio, gfp_mask, bip_src->bip_vcnt); |
746 | 732 | ||
747 | if (bip == NULL) | 733 | if (bip == NULL) |
748 | return -EIO; | 734 | return -EIO; |