From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:48943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0z5l-0002NR-Ac for qemu-devel@nongnu.org; Tue, 06 Sep 2011 13:05:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0z5f-00061g-AX for qemu-devel@nongnu.org; Tue, 06 Sep 2011 13:05:45 -0400 Received: from oxygen.pond.sub.org ([78.46.104.156]:46028) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0z5f-000618-3b for qemu-devel@nongnu.org; Tue, 06 Sep 2011 13:05:39 -0400 From: Markus Armbruster Date: Tue, 6 Sep 2011 18:58:57 +0200 Message-Id: <1315328340-6192-25-git-send-email-armbru@redhat.com> In-Reply-To: <1315328340-6192-1-git-send-email-armbru@redhat.com> References: <1315328340-6192-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH v3 24/27] block: Reset buffer alignment on detach List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefano.stabellini@eu.citrix.com, lcapitulino@redhat.com, hare@suse.de, amit.shah@redhat.com, pbonzini@redhat.com, hch@lst.de BlockDriverState member buffer_alignment is initially 512. The device model may set them, with bdrv_set_buffer_alignment(). If the device model gets detached (hot unplug), the device's alignment is left behind. Only okay because device hot unplug automatically destroys the BlockDriverState. But that's a questionable feature, best not to rely on it. Signed-off-by: Markus Armbruster --- block.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/block.c b/block.c index e986986..b006e58 100644 --- a/block.c +++ b/block.c @@ -788,6 +788,7 @@ void bdrv_detach_dev(BlockDriverState *bs, void *dev) bs->dev = NULL; bs->dev_ops = NULL; bs->dev_opaque = NULL; + bs->buffer_alignment = 512; } /* TODO change to return DeviceState * when all users are qdevified */ -- 1.7.6