From patchwork Fri Jul 15 23:23:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 9232917 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 8F0E760574 for ; Fri, 15 Jul 2016 23:44:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8304B2574A for ; Fri, 15 Jul 2016 23:44:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7768E26419; Fri, 15 Jul 2016 23:44:35 +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 1FB072574A for ; Fri, 15 Jul 2016 23:44:35 +0000 (UTC) Received: from localhost ([::1]:35375 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOCmY-0003x6-84 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 15 Jul 2016 19:44:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOCSA-0003um-2W for qemu-devel@nongnu.org; Fri, 15 Jul 2016 19:23:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bOCS5-0004KA-BV for qemu-devel@nongnu.org; Fri, 15 Jul 2016 19:23:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38451) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOCS2-0004Ha-8u; Fri, 15 Jul 2016 19:23:22 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E20D6381026; Fri, 15 Jul 2016 23:23:21 +0000 (UTC) Received: from red.redhat.com (ovpn-116-197.phx2.redhat.com [10.3.116.197]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6FNNCNm020927; Fri, 15 Jul 2016 19:23:21 -0400 From: Eric Blake To: qemu-devel@nongnu.org Date: Fri, 15 Jul 2016 17:23:03 -0600 Message-Id: <1468624988-423-15-git-send-email-eblake@redhat.com> In-Reply-To: <1468624988-423-1-git-send-email-eblake@redhat.com> References: <1468624988-423-1-git-send-email-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 15 Jul 2016 23:23:21 +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: [Qemu-devel] [PATCH v2 14/19] qcow2: Switch .bdrv_co_discard() to byte-based 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, pbonzini@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Another step towards killing off sector-based block APIs. Signed-off-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- block/qcow2.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index a6bca73..d620d0a 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -2479,15 +2479,15 @@ static coroutine_fn int qcow2_co_pwrite_zeroes(BlockDriverState *bs, return ret; } -static coroutine_fn int qcow2_co_discard(BlockDriverState *bs, - int64_t sector_num, int nb_sectors) +static coroutine_fn int qcow2_co_pdiscard(BlockDriverState *bs, + int64_t offset, int count) { int ret; BDRVQcow2State *s = bs->opaque; qemu_co_mutex_lock(&s->lock); - ret = qcow2_discard_clusters(bs, sector_num << BDRV_SECTOR_BITS, - nb_sectors, QCOW2_DISCARD_REQUEST, false); + ret = qcow2_discard_clusters(bs, offset, count >> BDRV_SECTOR_BITS, + QCOW2_DISCARD_REQUEST, false); qemu_co_mutex_unlock(&s->lock); return ret; } @@ -3410,7 +3410,7 @@ BlockDriver bdrv_qcow2 = { .bdrv_co_flush_to_os = qcow2_co_flush_to_os, .bdrv_co_pwrite_zeroes = qcow2_co_pwrite_zeroes, - .bdrv_co_discard = qcow2_co_discard, + .bdrv_co_pdiscard = qcow2_co_pdiscard, .bdrv_truncate = qcow2_truncate, .bdrv_write_compressed = qcow2_write_compressed, .bdrv_make_empty = qcow2_make_empty,