diff options
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 561a65f82e26..752119068d66 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -183,46 +183,6 @@ struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask, | |||
183 | } | 183 | } |
184 | EXPORT_SYMBOL_GPL(bio_clone_mddev); | 184 | EXPORT_SYMBOL_GPL(bio_clone_mddev); |
185 | 185 | ||
186 | void md_trim_bio(struct bio *bio, int offset, int size) | ||
187 | { | ||
188 | /* 'bio' is a cloned bio which we need to trim to match | ||
189 | * the given offset and size. | ||
190 | * This requires adjusting bi_sector, bi_size, and bi_io_vec | ||
191 | */ | ||
192 | int i; | ||
193 | struct bio_vec *bvec; | ||
194 | int sofar = 0; | ||
195 | |||
196 | size <<= 9; | ||
197 | if (offset == 0 && size == bio->bi_size) | ||
198 | return; | ||
199 | |||
200 | clear_bit(BIO_SEG_VALID, &bio->bi_flags); | ||
201 | |||
202 | bio_advance(bio, offset << 9); | ||
203 | |||
204 | bio->bi_size = size; | ||
205 | |||
206 | /* avoid any complications with bi_idx being non-zero*/ | ||
207 | if (bio->bi_idx) { | ||
208 | memmove(bio->bi_io_vec, bio->bi_io_vec+bio->bi_idx, | ||
209 | (bio->bi_vcnt - bio->bi_idx) * sizeof(struct bio_vec)); | ||
210 | bio->bi_vcnt -= bio->bi_idx; | ||
211 | bio->bi_idx = 0; | ||
212 | } | ||
213 | /* Make sure vcnt and last bv are not too big */ | ||
214 | bio_for_each_segment(bvec, bio, i) { | ||
215 | if (sofar + bvec->bv_len > size) | ||
216 | bvec->bv_len = size - sofar; | ||
217 | if (bvec->bv_len == 0) { | ||
218 | bio->bi_vcnt = i; | ||
219 | break; | ||
220 | } | ||
221 | sofar += bvec->bv_len; | ||
222 | } | ||
223 | } | ||
224 | EXPORT_SYMBOL_GPL(md_trim_bio); | ||
225 | |||
226 | /* | 186 | /* |
227 | * We have a system wide 'event count' that is incremented | 187 | * We have a system wide 'event count' that is incremented |
228 | * on any 'interesting' event, and readers of /proc/mdstat | 188 | * on any 'interesting' event, and readers of /proc/mdstat |