From nobody Sun Oct 5 19:23:38 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15078357802681022.6368552216442; Thu, 12 Oct 2017 12:16:20 -0700 (PDT) Received: from localhost ([::1]:46928 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2ixq-00086T-H4 for importer@patchew.org; Thu, 12 Oct 2017 15:16:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2ioi-000094-Tx for qemu-devel@nongnu.org; Thu, 12 Oct 2017 15:06:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e2ioh-0003zd-S7 for qemu-devel@nongnu.org; Thu, 12 Oct 2017 15:06:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55338) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e2iod-0003y3-2n; Thu, 12 Oct 2017 15:06:43 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2B47AD77FE; Thu, 12 Oct 2017 19:06:42 +0000 (UTC) Received: from red.redhat.com (ovpn-122-223.rdu2.redhat.com [10.10.122.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id 92EDD6063A; Thu, 12 Oct 2017 19:06:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2B47AD77FE Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=eblake@redhat.com From: Eric Blake To: qemu-devel@nongnu.org Date: Thu, 12 Oct 2017 13:59:16 -0500 Message-Id: <20171012185916.22776-21-eblake@redhat.com> In-Reply-To: <20171012185916.22776-1-eblake@redhat.com> References: <20171012185916.22776-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 12 Oct 2017 19:06:42 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 20/20] block: Drop unused .bdrv_co_get_block_status() 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: kwolf@redhat.com, famz@redhat.com, qemu-block@nongnu.org, Max Reitz , Stefan Hajnoczi , jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We are gradually moving away from sector-based interfaces, towards byte-based. Now that all drivers have been updated to provide the byte-based .bdrv_co_block_status(), we can delete the sector-based interface. Signed-off-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy --- v4: rebase to interface tweak v3: no change v2: rebase to earlier changes --- include/block/block_int.h | 3 --- block/io.c | 34 +--------------------------------- 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 7c8503f693..6e7ae5fc8d 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -213,9 +213,6 @@ struct BlockDriver { * guarantees input aligned to request_alignment, as well as * non-NULL pnum, map, and file. */ - int64_t coroutine_fn (*bdrv_co_get_block_status)(BlockDriverState *bs, - int64_t sector_num, int nb_sectors, int *pnum, - BlockDriverState **file); int coroutine_fn (*bdrv_co_block_status)(BlockDriverState *bd, bool want_zero, int64_t offset, int64_t bytes, int64_t *pnum, int64_t *map, BlockDriverState **file); diff --git a/block/io.c b/block/io.c index 6a2a2e1484..7ae4cdadf5 100644 --- a/block/io.c +++ b/block/io.c @@ -1847,7 +1847,7 @@ static int coroutine_fn bdrv_co_block_status(BlockDri= verState *bs, bytes =3D n; } - if (!bs->drv->bdrv_co_get_block_status && !bs->drv->bdrv_co_block_stat= us) { + if (!bs->drv->bdrv_co_block_status) { *pnum =3D bytes; ret =3D BDRV_BLOCK_DATA | BDRV_BLOCK_ALLOCATED; if (offset + bytes =3D=3D total_size) { @@ -1865,40 +1865,9 @@ static int coroutine_fn bdrv_co_block_status(BlockDr= iverState *bs, /* Round out to request_alignment boundaries */ align =3D bs->bl.request_alignment; - if (bs->drv->bdrv_co_get_block_status && align < BDRV_SECTOR_SIZE) { - align =3D BDRV_SECTOR_SIZE; - } aligned_offset =3D QEMU_ALIGN_DOWN(offset, align); aligned_bytes =3D ROUND_UP(offset + bytes, align) - aligned_offset; - if (bs->drv->bdrv_co_get_block_status) { - int count; /* sectors */ - int64_t longret; - - assert(QEMU_IS_ALIGNED(aligned_offset | aligned_bytes, - BDRV_SECTOR_SIZE)); - /* - * The contract allows us to return pnum smaller than bytes, even - * if the next query would see the same status; we truncate the - * request to avoid overflowing the driver's 32-bit interface. - */ - longret =3D bs->drv->bdrv_co_get_block_status( - bs, aligned_offset >> BDRV_SECTOR_BITS, - MIN(INT_MAX, aligned_bytes) >> BDRV_SECTOR_BITS, &count, - &local_file); - if (longret < 0) { - assert(INT_MIN <=3D longret); - ret =3D longret; - goto out; - } - if (longret & BDRV_BLOCK_OFFSET_VALID) { - local_map =3D longret & BDRV_BLOCK_OFFSET_MASK; - } - ret =3D longret & ~BDRV_BLOCK_OFFSET_MASK; - *pnum =3D count * BDRV_SECTOR_SIZE; - goto refine; - } - ret =3D bs->drv->bdrv_co_block_status(bs, want_zero, aligned_offset, aligned_bytes, pnum, &local_map, &local_file); @@ -1916,7 +1885,6 @@ static int coroutine_fn bdrv_co_block_status(BlockDri= verState *bs, *pnum =3D total_size - aligned_offset; } -refine: /* * The driver's result must be a multiple of request_alignment. * Clamp pnum and adjust map to original request. --=20 2.13.6