From patchwork Thu Jan 10 15:03:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 10756011 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 13AD513B5 for ; Thu, 10 Jan 2019 15:05:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01C3129960 for ; Thu, 10 Jan 2019 15:05:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA49829A0F; Thu, 10 Jan 2019 15:05:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 34BD029A23 for ; Thu, 10 Jan 2019 15:05:30 +0000 (UTC) Received: from localhost ([127.0.0.1]:44578 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbth-0004Bw-9x for patchwork-qemu-devel@patchwork.kernel.org; Thu, 10 Jan 2019 10:05:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbsH-00030v-K7 for qemu-devel@nongnu.org; Thu, 10 Jan 2019 10:04:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghbsG-0007OJ-G2 for qemu-devel@nongnu.org; Thu, 10 Jan 2019 10:04:01 -0500 Received: from fanzine.igalia.com ([91.117.99.155]:57868) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ghbsF-0007NH-Po; Thu, 10 Jan 2019 10:04:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=m2WBlCimuDjftw+8ixiiiYkdpLsUiwuy4ahzX9WwfLg=; b=hV8xgwpy3l9MDp8hb94GHuluEdsvFqA/IIELVFc3/HBU1g/JK8L+89H014LEWBf3OeQfgTDZuVz7JJQZ6aLR3B3LHWm01Fb5mei9aDv8XdA0PeUI30MoYY3vWWi7fUmnKh/47qzrX8zT4r1p4lWRqgYcME3CIvjym6AuprEOXXExAz4pE12399eygUNTTNFZzQJ4VMT0S6GdJqv/YtxHTZg++WEB2gmKdWYJqpZxiLtZQnbDVXOVBfEA7W6ATswLHHedb47kywlnm4Xj2vAvKNGUndDAw6j4qV+MSO59k+naFcyYmxVDYtpqrnWacmy76EupoXm3os52Cm9un8DGkg==; Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1ghbsD-0003mV-Kq; Thu, 10 Jan 2019 16:03:57 +0100 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1ghbry-0002Bf-5m; Thu, 10 Jan 2019 17:03:42 +0200 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Thu, 10 Jan 2019 17:03:37 +0200 Message-Id: <26733c0b339a4cf53318aa2b898eaa409fb307c6.1547132561.git.berto@igalia.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH 3/6] block: Acquire the AioContext in floppy_drive_realize() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Stefan Hajnoczi , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Alberto Garcia --- hw/block/fdc.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 6f19f127a5..d9bc80de83 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -512,6 +512,7 @@ static void floppy_drive_realize(DeviceState *qdev, Error **errp) { FloppyDrive *dev = FLOPPY_DRIVE(qdev); FloppyBus *bus = FLOPPY_BUS(qdev->parent_bus); + AioContext *ctx; FDrive *drive; int ret; @@ -543,13 +544,16 @@ static void floppy_drive_realize(DeviceState *qdev, Error **errp) assert(ret == 0); } + ctx = blk_get_aio_context(dev->conf.blk); + aio_context_acquire(ctx); + blkconf_blocksizes(&dev->conf); if (dev->conf.logical_block_size != 512 || dev->conf.physical_block_size != 512) { error_setg(errp, "Physical and logical block size must " "be 512 for floppy"); - return; + goto out; } /* rerror/werror aren't supported by fdc and therefore not even registered @@ -561,7 +565,7 @@ static void floppy_drive_realize(DeviceState *qdev, Error **errp) if (!blkconf_apply_backend_options(&dev->conf, blk_is_read_only(dev->conf.blk), false, errp)) { - return; + goto out; } /* 'enospc' is the default for -drive, 'report' is what blk_new() gives us @@ -569,11 +573,11 @@ static void floppy_drive_realize(DeviceState *qdev, Error **errp) if (blk_get_on_error(dev->conf.blk, 0) != BLOCKDEV_ON_ERROR_ENOSPC && blk_get_on_error(dev->conf.blk, 0) != BLOCKDEV_ON_ERROR_REPORT) { error_setg(errp, "fdc doesn't support drive option werror"); - return; + goto out; } if (blk_get_on_error(dev->conf.blk, 1) != BLOCKDEV_ON_ERROR_REPORT) { error_setg(errp, "fdc doesn't support drive option rerror"); - return; + goto out; } drive->conf = &dev->conf; @@ -589,6 +593,9 @@ static void floppy_drive_realize(DeviceState *qdev, Error **errp) dev->type = drive->drive; fd_revalidate(drive); + +out: + aio_context_release(ctx); } static void floppy_drive_class_init(ObjectClass *klass, void *data)