public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: axboe@kernel.dk, rusty@rustcorp.com.au
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] virtio_blk: use blk_rq_map_kern
Date: Thu, 15 Sep 2011 11:50:52 -0400	[thread overview]
Message-ID: <20110915155051.GA29694@infradead.org> (raw)

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;
 }
 

             reply	other threads:[~2011-09-15 15:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-15 15:50 Christoph Hellwig [this message]
2011-09-16  6:26 ` [PATCH] virtio_blk: use blk_rq_map_kern Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110915155051.GA29694@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox