* [PATCH] virtio_blk: use blk_rq_map_kern
@ 2011-09-15 15:50 Christoph Hellwig
2011-09-16 6:26 ` Rusty Russell
0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2011-09-15 15:50 UTC (permalink / raw)
To: axboe, rusty; +Cc: linux-kernel
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 <hch@lst.de>
Index: linux-2.6/drivers/block/virtio_blk.c
===================================================================
--- linux-2.6.orig/drivers/block/virtio_blk.c 2011-09-14 10:49:32.571738374 -0400
+++ linux-2.6/drivers/block/virtio_blk.c 2011-09-14 10:53:54.483239920 -0400
@@ -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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] virtio_blk: use blk_rq_map_kern
2011-09-15 15:50 [PATCH] virtio_blk: use blk_rq_map_kern Christoph Hellwig
@ 2011-09-16 6:26 ` Rusty Russell
0 siblings, 0 replies; 2+ messages in thread
From: Rusty Russell @ 2011-09-16 6:26 UTC (permalink / raw)
To: Christoph Hellwig, axboe; +Cc: linux-kernel
On Thu, 15 Sep 2011 11:50:52 -0400, Christoph Hellwig <hch@infradead.org> wrote:
> 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 <hch@lst.de>
Sure, and I have nothing pending that conflicts.
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Thanks!
Rusty.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-17 3:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-15 15:50 [PATCH] virtio_blk: use blk_rq_map_kern Christoph Hellwig
2011-09-16 6:26 ` Rusty Russell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox