Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02f3939e authored by Shaohua Li's avatar Shaohua Li Committed by Jens Axboe
Browse files

block: makes bio_split support bio without data



discard bio hasn't data attached. We hit a BUG_ON with such bio. This makes
bio_split works for such bio.

Signed-off-by: default avatarShaohua Li <shli@fusionio.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 232f1b51
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -1475,7 +1475,7 @@ struct bio_pair *bio_split(struct bio *bi, int first_sectors)
	trace_block_split(bdev_get_queue(bi->bi_bdev), bi,
				bi->bi_sector + first_sectors);

	BUG_ON(bi->bi_vcnt != 1);
	BUG_ON(bi->bi_vcnt != 1 && bi->bi_vcnt != 0);
	BUG_ON(bi->bi_idx != 0);
	atomic_set(&bp->cnt, 3);
	bp->error = 0;
@@ -1485,6 +1485,7 @@ struct bio_pair *bio_split(struct bio *bi, int first_sectors)
	bp->bio2.bi_size -= first_sectors << 9;
	bp->bio1.bi_size = first_sectors << 9;

	if (bi->bi_vcnt != 0) {
		bp->bv1 = bi->bi_io_vec[0];
		bp->bv2 = bi->bi_io_vec[0];

@@ -1499,6 +1500,7 @@ struct bio_pair *bio_split(struct bio *bi, int first_sectors)

		bp->bio1.bi_max_vecs = 1;
		bp->bio2.bi_max_vecs = 1;
	}

	bp->bio1.bi_end_io = bio_pair_end_1;
	bp->bio2.bi_end_io = bio_pair_end_2;