Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

blk-map: provide the bdev to bio if one exists

We can now safely provide a block device when extracting user pages for
driver and user passthrough commands. Set the bdev so the caller doesn't
have to do that later. This has an additional benefit of being able to
extract P2P pages in the passthrough path.

Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Keith Busch and committed by
Jens Axboe
d0d1d522 d57447ff

+3 -7
+3 -2
block/blk-map.c
··· 253 253 static struct bio *blk_rq_map_bio_alloc(struct request *rq, 254 254 unsigned int nr_vecs, gfp_t gfp_mask) 255 255 { 256 + struct block_device *bdev = rq->q->disk ? rq->q->disk->part0 : NULL; 256 257 struct bio *bio; 257 258 258 259 if (rq->cmd_flags & REQ_ALLOC_CACHE && (nr_vecs <= BIO_INLINE_VECS)) { 259 - bio = bio_alloc_bioset(NULL, nr_vecs, rq->cmd_flags, gfp_mask, 260 + bio = bio_alloc_bioset(bdev, nr_vecs, rq->cmd_flags, gfp_mask, 260 261 &fs_bio_set); 261 262 if (!bio) 262 263 return NULL; ··· 265 264 bio = bio_kmalloc(nr_vecs, gfp_mask); 266 265 if (!bio) 267 266 return NULL; 268 - bio_init_inline(bio, NULL, nr_vecs, req_op(rq)); 267 + bio_init_inline(bio, bdev, nr_vecs, req_op(rq)); 269 268 } 270 269 return bio; 271 270 }
-5
drivers/nvme/host/ioctl.c
··· 142 142 ret = blk_rq_map_user_io(req, NULL, nvme_to_user_ptr(ubuffer), 143 143 bufflen, GFP_KERNEL, flags & NVME_IOCTL_VEC, 0, 144 144 0, rq_data_dir(req)); 145 - 146 145 if (ret) 147 146 return ret; 148 - 149 - bio = req->bio; 150 - if (bdev) 151 - bio_set_dev(bio, bdev); 152 147 153 148 if (has_metadata) { 154 149 ret = blk_rq_integrity_map_user(req, meta_buffer, meta_len);