From: Jes.Sorensen@redhat.com
To: anthony@codemonkey.ws
Cc: Jes Sorensen <Jes.Sorensen@redhat.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 4/4] Cleanup: virtio-blk.c: Be more consistent using BDRV_SECTOR_SIZE instead
Date: Thu, 27 May 2010 16:20:33 +0200 [thread overview]
Message-ID: <1274970033-24093-5-git-send-email-Jes.Sorensen@redhat.com> (raw)
In-Reply-To: <1274970033-24093-1-git-send-email-Jes.Sorensen@redhat.com>
From: Jes Sorensen <Jes.Sorensen@redhat.com>
Clean up virtio-blk.c to be more consistent using BDRV_SECTOR_SIZE
instead of hard coded 512 values.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
hw/virtio-blk.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index 5d7f1a2..80d51c4 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -277,7 +277,7 @@ static void virtio_blk_handle_write(BlockRequest *blkreq, int *num_writes,
}
blkreq[*num_writes].sector = req->out->sector;
- blkreq[*num_writes].nb_sectors = req->qiov.size / 512;
+ blkreq[*num_writes].nb_sectors = req->qiov.size / BDRV_SECTOR_SIZE;
blkreq[*num_writes].qiov = &req->qiov;
blkreq[*num_writes].cb = virtio_blk_rw_complete;
blkreq[*num_writes].opaque = req;
@@ -296,7 +296,8 @@ static void virtio_blk_handle_read(VirtIOBlockReq *req)
}
acb = bdrv_aio_readv(req->dev->bs, req->out->sector, &req->qiov,
- req->qiov.size / 512, virtio_blk_rw_complete, req);
+ req->qiov.size / BDRV_SECTOR_SIZE,
+ virtio_blk_rw_complete, req);
if (!acb) {
virtio_blk_rw_complete(req, -EIO);
}
@@ -505,7 +506,7 @@ VirtIODevice *virtio_blk_init(DeviceState *dev, BlockConf *conf)
s->bs = conf->dinfo->bdrv;
s->conf = conf;
s->rq = NULL;
- s->sector_mask = (s->conf->logical_block_size / 512) - 1;
+ s->sector_mask = (s->conf->logical_block_size / BDRV_SECTOR_SIZE) - 1;
bdrv_guess_geometry(s->bs, &cylinders, &heads, &secs);
s->vq = virtio_add_queue(&s->vdev, 128, virtio_blk_handle_output);
--
1.6.5.2
next prev parent reply other threads:[~2010-05-27 14:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-27 14:20 [Qemu-devel] [PATCH 0/4] Cleanups for block code Jes.Sorensen
2010-05-27 14:20 ` [Qemu-devel] [PATCH 1/4] Cleanup: bdrv_open() no need to shift total_size just to shift back Jes.Sorensen
2010-05-27 14:20 ` [Qemu-devel] [PATCH 2/4] Cleanup: Be consistent and use BDRV_SECTOR_SIZE instead of 512 Jes.Sorensen
2010-05-27 14:20 ` [Qemu-devel] [PATCH 3/4] Cleanup: raw-posix.c: Be more consistent using " Jes.Sorensen
2010-05-27 14:20 ` Jes.Sorensen [this message]
2010-05-28 13:48 ` [Qemu-devel] [PATCH 0/4] Cleanups for block code Kevin Wolf
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=1274970033-24093-5-git-send-email-Jes.Sorensen@redhat.com \
--to=jes.sorensen@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).