Received: from eggs.gnu.org ([2001:4830:134:3::10]:48501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTtQc-0003qa-US for qemu-devel@nongnu.org; Tue, 16 Sep 2014 10:08:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XTtQX-0001az-Nv for qemu-devel@nongnu.org; Tue, 16 Sep 2014 10:08:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12900) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTtQX-0001ak-Gs for qemu-devel@nongnu.org; Tue, 16 Sep 2014 10:08:17 -0400 From: Markus Armbruster References: <1410620427-20089-1-git-send-email-armbru@redhat.com> <1410620427-20089-9-git-send-email-armbru@redhat.com> <20140916131831.GE27495@nodalink.com> Date: Tue, 16 Sep 2014 16:08:08 +0200 In-Reply-To: <20140916131831.GE27495@nodalink.com> (=?utf-8?Q?=22Beno?= =?utf-8?Q?=C3=AEt?= Canet"'s message of "Tue, 16 Sep 2014 13:18:31 +0000") Message-ID: <87a95zk69j.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 08/23] block: Eliminate BlockDriverState member device_name[] List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?Q?Beno=C3=AEt?= Canet Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com Beno=C3=AEt Canet writes: >> #include "qemu-common.h" >> -#include "block/block_int.h" >> +#include "block/block.h" >> +#include "qemu/error-report.h" >> +#include "qemu/main-loop.h" > > That's a lot of include fiddling I am not sure to understand them while l= ooking > at the following diff. Before the patch, we need block_int.h because we dereference bs. After the patch, we don't, so I can drop block_int.h. But then I have to add back those includes included by block_int.h we actually need here. >> #include "hw/hw.h" >> #include "qemu/queue.h" >> #include "qemu/timer.h" >> @@ -130,9 +132,9 @@ static void blk_send(QEMUFile *f, BlkMigBlock * blk) >> | flags); >>=20=20 >> /* device name */ >> - len =3D strlen(blk->bmds->bs->device_name); >> + len =3D strlen(bdrv_get_device_name(blk->bmds->bs)); >> qemu_put_byte(f, len); >> - qemu_put_buffer(f, (uint8_t *)blk->bmds->bs->device_name, len); >> + qemu_put_buffer(f, (uint8_t *)bdrv_get_device_name(blk->bmds->bs), = len); >>=20=20 >> /* if a block is zero we need to flush here since the network >> * bandwidth is now a lot higher than the storage device bandwidth. >> @@ -382,9 +384,9 @@ static void init_blk_migration(QEMUFile *f) >>=20=20 >> if (bmds->shared_base) { >> DPRINTF("Start migration for %s with shared base image\n", >> - bs->device_name); >> + bdrv_get_device_name(bs)); >> } else { >> - DPRINTF("Start full migration for %s\n", bs->device_name); >> + DPRINTF("Start full migration for %s\n", bdrv_get_device_na= me(bs)); >> } >>=20=20 >> QSIMPLEQ_INSERT_TAIL(&block_mig_state.bmds_list, bmds, entry); > > >> @@ -1959,10 +1941,10 @@ void bdrv_drain_all(void) >> V Also, NULL terminate the device_name to prevent double remove */ >> void bdrv_make_anon(BlockDriverState *bs) >> { >> - if (bs->device_name[0] !=3D '\0') { > > >> + if (bs->device_list.tqe_prev) { >> QTAILQ_REMOVE(&bdrv_states, bs, device_list); >> + bs->device_list.tqe_prev =3D NULL; > > I think a comments explaining the trick you are doing here would be worth= y: > after all you are touching directly the inner parts of a linked list and > bypassing the list API. Fair enough. >> } >> - bs->device_name[0] =3D '\0'; >> if (bs->node_name[0] !=3D '\0') { >> QTAILQ_REMOVE(&graph_bdrv_states, bs, node_list); >> }