From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAA74C18E7D for ; Wed, 22 May 2019 10:34:08 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id A4429217D4 for ; Wed, 22 May 2019 10:34:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A4429217D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([127.0.0.1]:39873 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTOZU-0003oB-0r for qemu-devel@archiver.kernel.org; Wed, 22 May 2019 06:34:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTOYP-0003M5-C9 for qemu-devel@nongnu.org; Wed, 22 May 2019 06:33:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTOYO-0007IW-Dp for qemu-devel@nongnu.org; Wed, 22 May 2019 06:33:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43648) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hTOYL-0007Fg-0U; Wed, 22 May 2019 06:32:57 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4CC64772EE; Wed, 22 May 2019 10:32:56 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-92.ams2.redhat.com [10.36.117.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6428262660; Wed, 22 May 2019 10:32:52 +0000 (UTC) Date: Wed, 22 May 2019 12:32:50 +0200 From: Kevin Wolf To: Vladimir Sementsov-Ogievskiy Message-ID: <20190522103250.GC6087@localhost.localdomain> References: <20190408162617.258535-1-vsementsov@virtuozzo.com> <20190408162617.258535-3-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190408162617.258535-3-vsementsov@virtuozzo.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 22 May 2019 10:32:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-devel] [PATCH v2 2/2] block: avoid recursive block_status call if possible 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: fam@euphon.net, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Am 08.04.2019 um 18:26 hat Vladimir Sementsov-Ogievskiy geschrieben: > drv_co_block_status digs bs->file for additional, more accurate search > for hole inside region, reported as DATA by bs since 5daa74a6ebc. > > This accuracy is not free: assume we have qcow2 disk. Actually, qcow2 > knows, where are holes and where is data. But every block_status > request calls lseek additionally. Assume a big disk, full of > data, in any iterative copying block job (or img convert) we'll call > lseek(HOLE) on every iteration, and each of these lseeks will have to > iterate through all metadata up to the end of file. It's obviously > ineffective behavior. And for many scenarios we don't need this lseek > at all. > > However, lseek is needed when we have metadata-preallocated image. > > So, let's detect metadata-preallocation case and don't dig qcow2's > protocol file in other cases. > > The idea is to compare allocation size in POV of filesystem with > allocations size in POV of Qcow2 (by refcounts). If allocation in fs is > significantly lower, consider it as metadata-preallocation case. > > 102 iotest changed, as our detector can't detect shrinked file as > metadata-preallocation, which don't seem to be wrong, as with metadata > preallocation we always have valid file length. > > Other two iotests tiny changed QMP output sequence, which should be > exactly because skipped lseek at mirror beginning. No, these hunks don't show an improvement. An earlier {'return':{}} means that the block job coroutine has yielded earlier, so it's doing a blocking operation where it didn't do one before the patch. What happens is that qcow2_detect_metadata_preallocation() causes additional I/O by reading in the refcount block. I'll modify the commit message accordingly while applying. Kevin