virtio_blk: use blk_rq_map_kern
Subsystems (3)
PATCH 1/1 virtio_blk: use blk_rq_map_kern
Use blk_rq_map_kern instead of opencoding it for the serial sysfs attribute.
[Rusty, any chance to get this in through the block tree? I have some
other bits in that area pending for it]
Signed-off-by Christoph Hellwig <[email protected]>
drivers/block/virtio_blk.c +7 -11
@@ -203,24 +203,20 @@ static int virtblk_get_id(struct gendisk {struct virtio_blk *vblk = disk->private_data;struct request *req; -struct bio *bio;int err; - bio =bio_map_kern (vblk->disk->queue, id_str,VIRTIO_BLK_ID_BYTES , -GFP_KERNEL ); -if (IS_ERR (bio)) -return PTR_ERR (bio); + req =blk_get_request (vblk->disk->queue,READ ,GFP_KERNEL ); - req =blk_make_request (vblk->disk->queue, bio,GFP_KERNEL ); -if (IS_ERR (req)) { -bio_put (bio); -return PTR_ERR (req); - } + err =blk_rq_map_kern (vblk->disk->queue, req, id_str, +VIRTIO_BLK_ID_BYTES ,GFP_KERNEL ); +if (err) + goto put_request; req->cmd_type =REQ_TYPE_SPECIAL ; err =blk_execute_rq (vblk->disk->queue, vblk->disk, req, false); -blk_put_request (req); +put_request: +blk_put_request (req);return err; }
Quoted 6 lines · Christoph Hellwig
Use
blk_rq_map_kerninstead of opencoding it for the serial sysfs attribute.[Rusty, any chance to get this in through the block tree? I have some
other bits in that area pending for it]Signed-off-by Christoph Hellwig <[email protected]>
Sure, and I have nothing pending that conflicts.
Acked-by Rusty Russell <[email protected]>
Thanks!
Rusty.