Re: [PATCH 3/9] block: store a block_device pointer in struct bio

Keith Busch
2020-12-03T20:54:34Z

On Tue, Dec 01, 2020 at 05:54:18PM +0100, Christoph Hellwig wrote:
> diff --git a/block/blk.h b/block/blk.h
> index 98f0b1ae264120..64dc8e5a3f44cb 100644
> --- a/block/blk.h
> +++ b/block/blk.h
> @@ -99,8 +99,8 @@ static inline void blk_rq_bio_prep(struct request *rq, struct bio *bio,
> rq->bio = rq->biotail = bio;
> rq->ioprio = bio_prio(bio);
>
> - if (bio->bi_disk)
> - rq->rq_disk = bio->bi_disk;
> + if (bio->bi_bdev)
> + rq->rq_disk = bio->bi_bdev->bd_disk;
> }

Just fyi, this function has been relocated to include/linux/blk-mq.h