[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110915155051.GA29694@infradead.org>
Date: Thu, 15 Sep 2011 11:50:52 -0400
From: Christoph Hellwig <hch@...radead.org>
To: axboe@...nel.dk, rusty@...tcorp.com.au
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] 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 <hch@....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;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists