diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2008-01-25 06:44:44 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-01-28 04:04:46 -0500 |
commit | 5d84070ee0a433620c57e85dac7f82faaec5fbb3 (patch) | |
tree | 9a07548504683bcde2b262b9e2d675cbe7cea2b7 /fs | |
parent | 482eb689169948e9f4966fbae6be4d6bc0bfa818 (diff) |
__bio_clone: don't calculate hw/phys segment counts
If the users sets a new ->bi_bdev on the bio after __bio_clone() has
returned it, the "segment counts valid" flag still remains even though
it may be different with the new target. So don't calculate segment
counts in __bio_clone().
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bio.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -248,11 +248,13 @@ inline int bio_hw_segments(struct request_queue *q, struct bio *bio) | |||
248 | */ | 248 | */ |
249 | void __bio_clone(struct bio *bio, struct bio *bio_src) | 249 | void __bio_clone(struct bio *bio, struct bio *bio_src) |
250 | { | 250 | { |
251 | struct request_queue *q = bdev_get_queue(bio_src->bi_bdev); | ||
252 | |||
253 | memcpy(bio->bi_io_vec, bio_src->bi_io_vec, | 251 | memcpy(bio->bi_io_vec, bio_src->bi_io_vec, |
254 | bio_src->bi_max_vecs * sizeof(struct bio_vec)); | 252 | bio_src->bi_max_vecs * sizeof(struct bio_vec)); |
255 | 253 | ||
254 | /* | ||
255 | * most users will be overriding ->bi_bdev with a new target, | ||
256 | * so we don't set nor calculate new physical/hw segment counts here | ||
257 | */ | ||
256 | bio->bi_sector = bio_src->bi_sector; | 258 | bio->bi_sector = bio_src->bi_sector; |
257 | bio->bi_bdev = bio_src->bi_bdev; | 259 | bio->bi_bdev = bio_src->bi_bdev; |
258 | bio->bi_flags |= 1 << BIO_CLONED; | 260 | bio->bi_flags |= 1 << BIO_CLONED; |
@@ -260,8 +262,6 @@ void __bio_clone(struct bio *bio, struct bio *bio_src) | |||
260 | bio->bi_vcnt = bio_src->bi_vcnt; | 262 | bio->bi_vcnt = bio_src->bi_vcnt; |
261 | bio->bi_size = bio_src->bi_size; | 263 | bio->bi_size = bio_src->bi_size; |
262 | bio->bi_idx = bio_src->bi_idx; | 264 | bio->bi_idx = bio_src->bi_idx; |
263 | bio_phys_segments(q, bio); | ||
264 | bio_hw_segments(q, bio); | ||
265 | } | 265 | } |
266 | 266 | ||
267 | /** | 267 | /** |