Received: from eggs.gnu.org ([2001:4830:134:3::10]:34305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XVy9I-0002st-Sp for qemu-devel@nongnu.org; Mon, 22 Sep 2014 03:35:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XVy9C-0000hP-Nu for qemu-devel@nongnu.org; Mon, 22 Sep 2014 03:35:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XVy9C-0000gk-Gx for qemu-devel@nongnu.org; Mon, 22 Sep 2014 03:34:58 -0400 From: Markus Armbruster References: <1410891148-28849-1-git-send-email-armbru@redhat.com> <1410891148-28849-13-git-send-email-armbru@redhat.com> <541DF025.2000502@redhat.com> Date: Mon, 22 Sep 2014 09:34:46 +0200 In-Reply-To: <541DF025.2000502@redhat.com> (Max Reitz's message of "Sat, 20 Sep 2014 23:22:45 +0200") Message-ID: <877g0ww1k9.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v3 12/23] virtio-blk: Drop redundant VirtIOBlock member conf List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: kwolf@redhat.com, stefanha@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, benoit.canet@nodalink.com Max Reitz writes: > On 16.09.2014 20:12, Markus Armbruster wrote: >> Commit 12c5674 turned it into a pointer to member blk.conf. >> >> Signed-off-by: Markus Armbruster >> --- >> hw/block/virtio-blk.c | 28 ++++++++++++++-------------- >> include/hw/virtio/virtio-blk.h | 1 - >> 2 files changed, 14 insertions(+), 15 deletions(-) >> >> diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c >> index 38ad38f..5943af5 100644 >> --- a/hw/block/virtio-blk.c >> +++ b/hw/block/virtio-blk.c >> @@ -298,7 +298,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); >> @@ -519,19 +519,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 >> @@ -543,13 +544,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(&s->blk.conf); > > Is there a reason for you not using "conf" instead of "&s->blk.conf" here? > > Of course, it's not wrong, so with the one or the other: Looks like an editing accident to me. I'll clean it up in v4. > Reviewed-by: Max Reitz Thanks!