From patchwork Fri Dec 1 01:42:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 843609 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ypLKP0Tljz9t3x for ; Sat, 2 Dec 2017 04:06:49 +1100 (AEDT) Received: from localhost ([::1]:58805 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKolz-0006Ny-3G for incoming@patchwork.ozlabs.org; Fri, 01 Dec 2017 12:06:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKnhF-00027z-SA for qemu-devel@nongnu.org; Fri, 01 Dec 2017 10:58:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKndO-0008L5-SS for qemu-devel@nongnu.org; Fri, 01 Dec 2017 10:57:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46004) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eKnbF-0005bq-U5; Fri, 01 Dec 2017 10:51:38 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 15A7161BB2; Fri, 1 Dec 2017 01:43:48 +0000 (UTC) Received: from red.redhat.com (ovpn-122-213.rdu2.redhat.com [10.10.122.213]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8DF160649; Fri, 1 Dec 2017 01:43:39 +0000 (UTC) From: Eric Blake To: qemu-devel@nongnu.org Date: Thu, 30 Nov 2017 19:42:42 -0600 Message-Id: <20171201014242.16877-21-eblake@redhat.com> In-Reply-To: <20171201014242.16877-1-eblake@redhat.com> References: <20171201014242.16877-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 01 Dec 2017 01:43:48 +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 v5 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, vsementsov@virtuozzo.com, famz@redhat.com, qemu-block@nongnu.org, Max Reitz , Stefan Hajnoczi , jsnow@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- v5: rebase to master 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 980333c671..df9b62934d 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -215,9 +215,6 @@ struct BlockDriver { * in turn, the driver must return an error or set pnum to an * aligned non-zero value. */ - 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 *bs, 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 49d299b7e3..9e59dfb550 100644 --- a/block/io.c +++ b/block/io.c @@ -1893,7 +1893,7 @@ static int coroutine_fn bdrv_co_block_status(BlockDriverState *bs, /* Must be non-NULL or bdrv_getlength() would have failed */ assert(bs->drv); - if (!bs->drv->bdrv_co_get_block_status && !bs->drv->bdrv_co_block_status) { + if (!bs->drv->bdrv_co_block_status) { *pnum = bytes; ret = BDRV_BLOCK_DATA | BDRV_BLOCK_ALLOCATED; if (offset + bytes == total_size) { @@ -1911,40 +1911,9 @@ static int coroutine_fn bdrv_co_block_status(BlockDriverState *bs, /* Round out to request_alignment boundaries */ align = bs->bl.request_alignment; - if (bs->drv->bdrv_co_get_block_status && align < BDRV_SECTOR_SIZE) { - align = BDRV_SECTOR_SIZE; - } aligned_offset = QEMU_ALIGN_DOWN(offset, align); aligned_bytes = 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 = 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 <= longret); - ret = longret; - goto out; - } - if (longret & BDRV_BLOCK_OFFSET_VALID) { - local_map = longret & BDRV_BLOCK_OFFSET_MASK; - } - ret = longret & ~BDRV_BLOCK_OFFSET_MASK; - *pnum = count * BDRV_SECTOR_SIZE; - goto refine; - } - ret = bs->drv->bdrv_co_block_status(bs, want_zero, aligned_offset, aligned_bytes, pnum, &local_map, &local_file); @@ -1963,7 +1932,6 @@ static int coroutine_fn bdrv_co_block_status(BlockDriverState *bs, *pnum = total_size - aligned_offset; } -refine: /* * The driver's result must be a multiple of request_alignment. * Clamp pnum and adjust map to original request.