Skip to content

Commit

Permalink
__bio_clone: don't calculate hw/phys segment counts
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jens Axboe committed Jan 28, 2008
1 parent 482eb68 commit 5d84070
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fs/bio.c
Original file line number Diff line number Diff line change
@@ -248,20 +248,20 @@ inline int bio_hw_segments(struct request_queue *q, struct bio *bio)
*/
void __bio_clone(struct bio *bio, struct bio *bio_src)
{
struct request_queue *q = bdev_get_queue(bio_src->bi_bdev);

memcpy(bio->bi_io_vec, bio_src->bi_io_vec,
bio_src->bi_max_vecs * sizeof(struct bio_vec));

/*
* most users will be overriding ->bi_bdev with a new target,
* so we don't set nor calculate new physical/hw segment counts here
*/
bio->bi_sector = bio_src->bi_sector;
bio->bi_bdev = bio_src->bi_bdev;
bio->bi_flags |= 1 << BIO_CLONED;
bio->bi_rw = bio_src->bi_rw;
bio->bi_vcnt = bio_src->bi_vcnt;
bio->bi_size = bio_src->bi_size;
bio->bi_idx = bio_src->bi_idx;
bio_phys_segments(q, bio);
bio_hw_segments(q, bio);
}

/**

0 comments on commit 5d84070

Please sign in to comment.