From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com
Subject: [Qemu-devel] [PULL 18/28] virtio-blk: Drop redundant VirtIOBlock member conf
Date: Mon, 20 Oct 2014 15:35:44 +0200 [thread overview]
Message-ID: <1413812154-11153-19-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1413812154-11153-1-git-send-email-kwolf@redhat.com>
From: Markus Armbruster <armbru@redhat.com>
Commit 12c5674 turned it into a pointer to member blk.conf.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoît Canet <benoit.canet@nodalink.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
hw/block/virtio-blk.c | 26 +++++++++++++-------------
include/hw/virtio/virtio-blk.h | 1 -
2 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 1fa9770..1621826 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -296,7 +296,7 @@ static bool virtio_blk_sect_range_ok(VirtIOBlock *dev,
if (sector & dev->sector_mask) {
return false;
}
- if (size % dev->conf->logical_block_size) {
+ if (size % dev->blk.conf.logical_block_size) {
return false;
}
bdrv_get_geometry(dev->bs, &total_sectors);
@@ -513,19 +513,20 @@ static void virtio_blk_reset(VirtIODevice *vdev)
static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config)
{
VirtIOBlock *s = VIRTIO_BLK(vdev);
+ BlockConf *conf = &s->blk.conf;
struct virtio_blk_config blkcfg;
uint64_t capacity;
- int blk_size = s->conf->logical_block_size;
+ int blk_size = conf->logical_block_size;
bdrv_get_geometry(s->bs, &capacity);
memset(&blkcfg, 0, sizeof(blkcfg));
virtio_stq_p(vdev, &blkcfg.capacity, capacity);
virtio_stl_p(vdev, &blkcfg.seg_max, 128 - 2);
- virtio_stw_p(vdev, &blkcfg.cylinders, s->conf->cyls);
+ virtio_stw_p(vdev, &blkcfg.cylinders, conf->cyls);
virtio_stl_p(vdev, &blkcfg.blk_size, blk_size);
- virtio_stw_p(vdev, &blkcfg.min_io_size, s->conf->min_io_size / blk_size);
- virtio_stw_p(vdev, &blkcfg.opt_io_size, s->conf->opt_io_size / blk_size);
- blkcfg.heads = s->conf->heads;
+ virtio_stw_p(vdev, &blkcfg.min_io_size, conf->min_io_size / blk_size);
+ virtio_stw_p(vdev, &blkcfg.opt_io_size, conf->opt_io_size / blk_size);
+ blkcfg.heads = conf->heads;
/*
* We must ensure that the block device capacity is a multiple of
* the logical block size. If that is not the case, let's use
@@ -537,13 +538,13 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config)
* divided by 512 - instead it is the amount of blk_size blocks
* per track (cylinder).
*/
- if (bdrv_getlength(s->bs) / s->conf->heads / s->conf->secs % blk_size) {
- blkcfg.sectors = s->conf->secs & ~s->sector_mask;
+ if (bdrv_getlength(s->bs) / conf->heads / conf->secs % blk_size) {
+ blkcfg.sectors = conf->secs & ~s->sector_mask;
} else {
- blkcfg.sectors = s->conf->secs;
+ blkcfg.sectors = conf->secs;
}
blkcfg.size_max = 0;
- blkcfg.physical_block_exp = get_physical_block_exp(s->conf);
+ blkcfg.physical_block_exp = get_physical_block_exp(conf);
blkcfg.alignment_offset = 0;
blkcfg.wce = bdrv_enable_write_cache(s->bs);
memcpy(config, &blkcfg, sizeof(struct virtio_blk_config));
@@ -746,9 +747,8 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
sizeof(struct virtio_blk_config));
s->bs = blk->conf.bs;
- s->conf = &blk->conf;
s->rq = NULL;
- s->sector_mask = (s->conf->logical_block_size / BDRV_SECTOR_SIZE) - 1;
+ s->sector_mask = (s->blk.conf.logical_block_size / BDRV_SECTOR_SIZE) - 1;
s->vq = virtio_add_queue(vdev, 128, virtio_blk_handle_output);
s->complete_request = virtio_blk_complete_request;
@@ -765,7 +765,7 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
register_savevm(dev, "virtio-blk", virtio_blk_id++, 2,
virtio_blk_save, virtio_blk_load, s);
bdrv_set_dev_ops(s->bs, &virtio_block_ops, s);
- bdrv_set_guest_block_size(s->bs, s->conf->logical_block_size);
+ bdrv_set_guest_block_size(s->bs, s->blk.conf.logical_block_size);
bdrv_iostatus_enable(s->bs);
}
diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h
index f3853f2..0f4323d 100644
--- a/include/hw/virtio/virtio-blk.h
+++ b/include/hw/virtio/virtio-blk.h
@@ -125,7 +125,6 @@ typedef struct VirtIOBlock {
VirtQueue *vq;
void *rq;
QEMUBH *bh;
- BlockConf *conf;
VirtIOBlkConf blk;
unsigned short sector_mask;
bool original_wce;
--
1.8.3.1
next prev parent reply other threads:[~2014-10-20 13:36 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-20 13:35 [Qemu-devel] [PULL 00/28] Block patches Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 01/28] qcow2: fix leak of Qcow2DiscardRegion in update_refcount_discard Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 02/28] block/raw-posix: Fix disk corruption in try_fiemap Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 03/28] block/raw-posix: use seek_hole ahead of fiemap Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 04/28] nbd: Fix filename generation Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 05/28] block: Split bdrv_new_root() off bdrv_new() Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 06/28] block: New BlockBackend Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 07/28] block: Connect BlockBackend to BlockDriverState Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 08/28] block: Connect BlockBackend and DriveInfo Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 09/28] block: Code motion to get rid of stubs/blockdev.c Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 10/28] block: Make BlockBackend own its BlockDriverState Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 11/28] blockdev: Eliminate drive_del() Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 12/28] block: Eliminate bdrv_iterate(), use bdrv_next() Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 13/28] block: Eliminate BlockDriverState member device_name[] Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 14/28] block: Merge BlockBackend and BlockDriverState name spaces Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 15/28] block: Eliminate DriveInfo member bdrv, use blk_by_legacy_dinfo() Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 16/28] block: Rename BlockDriverAIOCB* to BlockAIOCB* Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 17/28] block: Rename BlockDriverCompletionFunc to BlockCompletionFunc Kevin Wolf
2014-10-20 13:35 ` Kevin Wolf [this message]
2014-10-20 13:35 ` [Qemu-devel] [PULL 19/28] virtio-blk: Rename VirtIOBlkConf variables to conf Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 20/28] hw: Convert from BlockDriverState to BlockBackend, mostly Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 21/28] ide: Complete conversion from BlockDriverState to BlockBackend Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 22/28] pc87312: Drop unused members of PC87312State Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 23/28] blockdev: Drop superfluous DriveInfo member id Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 24/28] blockdev: Fix blockdev-add not to create DriveInfo Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 25/28] block/qapi: Convert qmp_query_block() to BlockBackend Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 26/28] blockdev: Convert qmp_eject(), qmp_change_blockdev() " Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 27/28] block: Lift device model API into BlockBackend Kevin Wolf
2014-10-20 13:35 ` [Qemu-devel] [PULL 28/28] block: Make device model's references to BlockBackend strong Kevin Wolf
2014-10-22 17:30 ` [Qemu-devel] [PULL 00/28] Block patches Peter Maydell
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=1413812154-11153-19-git-send-email-kwolf@redhat.com \
--to=kwolf@redhat.com \
--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).