diff options
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 44 |
1 files changed, 3 insertions, 41 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 308e87b417e0..95c88012a3b9 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -155,32 +155,17 @@ static int start_readonly; | |||
155 | * like bio_clone, but with a local bio set | 155 | * like bio_clone, but with a local bio set |
156 | */ | 156 | */ |
157 | 157 | ||
158 | static void mddev_bio_destructor(struct bio *bio) | ||
159 | { | ||
160 | struct mddev *mddev, **mddevp; | ||
161 | |||
162 | mddevp = (void*)bio; | ||
163 | mddev = mddevp[-1]; | ||
164 | |||
165 | bio_free(bio, mddev->bio_set); | ||
166 | } | ||
167 | |||
168 | struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, | 158 | struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, |
169 | struct mddev *mddev) | 159 | struct mddev *mddev) |
170 | { | 160 | { |
171 | struct bio *b; | 161 | struct bio *b; |
172 | struct mddev **mddevp; | ||
173 | 162 | ||
174 | if (!mddev || !mddev->bio_set) | 163 | if (!mddev || !mddev->bio_set) |
175 | return bio_alloc(gfp_mask, nr_iovecs); | 164 | return bio_alloc(gfp_mask, nr_iovecs); |
176 | 165 | ||
177 | b = bio_alloc_bioset(gfp_mask, nr_iovecs, | 166 | b = bio_alloc_bioset(gfp_mask, nr_iovecs, mddev->bio_set); |
178 | mddev->bio_set); | ||
179 | if (!b) | 167 | if (!b) |
180 | return NULL; | 168 | return NULL; |
181 | mddevp = (void*)b; | ||
182 | mddevp[-1] = mddev; | ||
183 | b->bi_destructor = mddev_bio_destructor; | ||
184 | return b; | 169 | return b; |
185 | } | 170 | } |
186 | EXPORT_SYMBOL_GPL(bio_alloc_mddev); | 171 | EXPORT_SYMBOL_GPL(bio_alloc_mddev); |
@@ -188,32 +173,10 @@ EXPORT_SYMBOL_GPL(bio_alloc_mddev); | |||
188 | struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask, | 173 | struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask, |
189 | struct mddev *mddev) | 174 | struct mddev *mddev) |
190 | { | 175 | { |
191 | struct bio *b; | ||
192 | struct mddev **mddevp; | ||
193 | |||
194 | if (!mddev || !mddev->bio_set) | 176 | if (!mddev || !mddev->bio_set) |
195 | return bio_clone(bio, gfp_mask); | 177 | return bio_clone(bio, gfp_mask); |
196 | 178 | ||
197 | b = bio_alloc_bioset(gfp_mask, bio->bi_max_vecs, | 179 | return bio_clone_bioset(bio, gfp_mask, mddev->bio_set); |
198 | mddev->bio_set); | ||
199 | if (!b) | ||
200 | return NULL; | ||
201 | mddevp = (void*)b; | ||
202 | mddevp[-1] = mddev; | ||
203 | b->bi_destructor = mddev_bio_destructor; | ||
204 | __bio_clone(b, bio); | ||
205 | if (bio_integrity(bio)) { | ||
206 | int ret; | ||
207 | |||
208 | ret = bio_integrity_clone(b, bio, gfp_mask, mddev->bio_set); | ||
209 | |||
210 | if (ret < 0) { | ||
211 | bio_put(b); | ||
212 | return NULL; | ||
213 | } | ||
214 | } | ||
215 | |||
216 | return b; | ||
217 | } | 180 | } |
218 | EXPORT_SYMBOL_GPL(bio_clone_mddev); | 181 | EXPORT_SYMBOL_GPL(bio_clone_mddev); |
219 | 182 | ||
@@ -5006,8 +4969,7 @@ int md_run(struct mddev *mddev) | |||
5006 | } | 4969 | } |
5007 | 4970 | ||
5008 | if (mddev->bio_set == NULL) | 4971 | if (mddev->bio_set == NULL) |
5009 | mddev->bio_set = bioset_create(BIO_POOL_SIZE, | 4972 | mddev->bio_set = bioset_create(BIO_POOL_SIZE, 0); |
5010 | sizeof(struct mddev *)); | ||
5011 | 4973 | ||
5012 | spin_lock(&pers_lock); | 4974 | spin_lock(&pers_lock); |
5013 | pers = find_pers(mddev->level, mddev->clevel); | 4975 | pers = find_pers(mddev->level, mddev->clevel); |