From patchwork Tue Sep 6 16:58:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 113619 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 21BEEB6F71 for ; Wed, 7 Sep 2011 03:06:03 +1000 (EST) Received: from localhost ([::1]:58254 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0z5r-0002OJ-9A for incoming@patchwork.ozlabs.org; Tue, 06 Sep 2011 13:05:51 -0400 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 Received: from blackfin.pond.sub.org (p5B32C9A8.dip.t-dialin.net [91.50.201.168]) by oxygen.pond.sub.org (Postfix) with ESMTPA id CD5899FF79; Tue, 6 Sep 2011 19:05:36 +0200 (CEST) Received: by blackfin.pond.sub.org (Postfix, from userid 500) id 1F30860085; Tue, 6 Sep 2011 18:59:02 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 6 Sep 2011 18:58:57 +0200 Message-Id: <1315328340-6192-25-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1315328340-6192-1-git-send-email-armbru@redhat.com> References: <1315328340-6192-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 78.46.104.156 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 Subject: [Qemu-devel] [PATCH v3 24/27] block: Reset buffer alignment on detach X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 */