From patchwork Thu Oct 6 13:02:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 9364797 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1A61D607D3 for ; Thu, 6 Oct 2016 13:28:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A28029000 for ; Thu, 6 Oct 2016 13:28:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F275C29002; Thu, 6 Oct 2016 13:28:09 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5EA6029004 for ; Thu, 6 Oct 2016 13:28:05 +0000 (UTC) Received: from localhost ([::1]:56097 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bs8iS-0002gE-9S for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Oct 2016 09:28:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bs8Kh-0005lN-N5 for qemu-devel@nongnu.org; Thu, 06 Oct 2016 09:03:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bs8Ka-00019N-Ma for qemu-devel@nongnu.org; Thu, 06 Oct 2016 09:03:31 -0400 Received: from smtp3.mundo-r.com ([212.51.32.191]:63640 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bs8Ka-00017x-Fc; Thu, 06 Oct 2016 09:03:24 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2A8AgCgSvZX/5tjdVtdHQEFAQsBgz0BAQEBAR5XfI0ylV0BAQUBgRaPcIIxgg+CCx6GAgKBfzgUAQIBAQEBAQEBXieEYgIEJ1IQPxI8GxmIUgG+YTKFcoJPhmCBA4UTBY8uilGGKIlTgjyNOEmQLR42PwUHghlSHIFWb4hAAQEB X-IPAS-Result: A2A8AgCgSvZX/5tjdVtdHQEFAQsBgz0BAQEBAR5XfI0ylV0BAQUBgRaPcIIxgg+CCx6GAgKBfzgUAQIBAQEBAQEBXieEYgIEJ1IQPxI8GxmIUgG+YTKFcoJPhmCBA4UTBY8uilGGKIlTgjyNOEmQLR42PwUHghlSHIFWb4hAAQEB X-IronPort-AV: E=Sophos;i="5.31,454,1473112800"; d="scan'208";a="195926151" Received: from fanzine.igalia.com ([91.117.99.155]) by smtp4.mundo-r.com with ESMTP; 06 Oct 2016 15:03:19 +0200 Received: from a88-114-146-170.elisa-laajakaista.fi ([88.114.146.170] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim) id 1bs8KV-0001gL-0h; Thu, 06 Oct 2016 15:03:19 +0200 Received: from berto by perseus.local with local (Exim 4.87) (envelope-from ) id 1bs8KH-0007XZ-BR; Thu, 06 Oct 2016 16:03:05 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Thu, 6 Oct 2016 16:02:47 +0300 Message-Id: <6d55b86caa3f3e29eeb2dc2076cee558fded22b1.1475757437.git.berto@igalia.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.51.32.191 Subject: [Qemu-devel] [PATCH v10 04/16] block: Use block_job_add_bdrv() in backup_start() 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, Markus Armbruster , Max Reitz , Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Use block_job_add_bdrv() instead of blocking all operations in backup_start() and unblocking them in backup_run(). Signed-off-by: Alberto Garcia --- block/backup.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/block/backup.c b/block/backup.c index 582bd0f..3a9cb7f 100644 --- a/block/backup.c +++ b/block/backup.c @@ -427,7 +427,6 @@ static void coroutine_fn backup_run(void *opaque) BackupBlockJob *job = opaque; BackupCompleteData *data; BlockDriverState *bs = blk_bs(job->common.blk); - BlockBackend *target = job->target; int64_t start, end; int64_t sectors_per_cluster = cluster_size_sectors(job); int ret = 0; @@ -514,8 +513,6 @@ static void coroutine_fn backup_run(void *opaque) qemu_co_rwlock_unlock(&job->flush_rwlock); g_free(job->done_bitmap); - bdrv_op_unblock_all(blk_bs(target), job->common.blocker); - data = g_malloc(sizeof(*data)); data->ret = ret; block_job_defer_to_main_loop(&job->common, backup_complete, data); @@ -629,7 +626,7 @@ void backup_start(const char *job_id, BlockDriverState *bs, job->cluster_size = MAX(BACKUP_CLUSTER_SIZE_DEFAULT, bdi.cluster_size); } - bdrv_op_block_all(target, job->common.blocker); + block_job_add_bdrv(&job->common, target); job->common.len = len; job->common.co = qemu_coroutine_create(backup_run, job); block_job_txn_add_job(txn, &job->common);