From patchwork Wed Jun 1 21:10:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 9148161 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 49EDD60751 for ; Wed, 1 Jun 2016 21:20:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B00B20410 for ; Wed, 1 Jun 2016 21:20:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FE6926B39; Wed, 1 Jun 2016 21:20:17 +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 CF48C20410 for ; Wed, 1 Jun 2016 21:20:16 +0000 (UTC) Received: from localhost ([::1]:44165 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8DYl-0001Oq-VB for patchwork-qemu-devel@patchwork.kernel.org; Wed, 01 Jun 2016 17:20:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8DPK-00028I-42 for qemu-devel@nongnu.org; Wed, 01 Jun 2016 17:10:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8DPH-0008DD-T0 for qemu-devel@nongnu.org; Wed, 01 Jun 2016 17:10:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45924) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8DPE-0008CI-9E; Wed, 01 Jun 2016 17:10:24 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 EA0F864361; Wed, 1 Jun 2016 21:10:23 +0000 (UTC) Received: from red.redhat.com (ovpn-116-150.phx2.redhat.com [10.3.116.150]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u51LAF6a027968; Wed, 1 Jun 2016 17:10:23 -0400 From: Eric Blake To: qemu-devel@nongnu.org Date: Wed, 1 Jun 2016 15:10:13 -0600 Message-Id: <1464815413-613-14-git-send-email-eblake@redhat.com> In-Reply-To: <1464815413-613-1-git-send-email-eblake@redhat.com> References: <1464815413-613-1-git-send-email-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 01 Jun 2016 21:10:23 +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 13/13] block: Kill bdrv_co_write_zeroes() 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, Fam Zheng , Stefan Hajnoczi , 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 Now that all drivers have been converted to a byte interface, we no longer need a sector interface. Signed-off-by: Eric Blake Reviewed-by: Kevin Wolf --- include/block/block_int.h | 2 -- block/io.c | 15 ++------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 1dfdf92..8a4963c 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -163,8 +163,6 @@ struct BlockDriver { * function pointer may be NULL or return -ENOSUP and .bdrv_co_writev() * will be called instead. */ - int coroutine_fn (*bdrv_co_write_zeroes)(BlockDriverState *bs, - int64_t sector_num, int nb_sectors, BdrvRequestFlags flags); int coroutine_fn (*bdrv_co_pwrite_zeroes)(BlockDriverState *bs, int64_t offset, int count, BdrvRequestFlags flags); int coroutine_fn (*bdrv_co_discard)(BlockDriverState *bs, diff --git a/block/io.c b/block/io.c index 5f021d5..6013b97 100644 --- a/block/io.c +++ b/block/io.c @@ -901,7 +901,7 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BlockDriverState *bs, goto err; } - if ((drv->bdrv_co_write_zeroes || drv->bdrv_co_pwrite_zeroes) && + if (drv->bdrv_co_pwrite_zeroes && buffer_is_zero(bounce_buffer, iov.iov_len)) { ret = bdrv_co_do_pwrite_zeroes(bs, cluster_sector_num * BDRV_SECTOR_SIZE, @@ -1170,16 +1170,6 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, !(bs->supported_zero_flags & BDRV_REQ_FUA)) { need_flush = true; } - } else if (drv->bdrv_co_write_zeroes) { - assert(offset % BDRV_SECTOR_SIZE == 0); - assert(count % BDRV_SECTOR_SIZE == 0); - ret = drv->bdrv_co_write_zeroes(bs, offset >> BDRV_SECTOR_BITS, - num >> BDRV_SECTOR_BITS, - flags & bs->supported_zero_flags); - if (ret != -ENOTSUP && (flags & BDRV_REQ_FUA) && - !(bs->supported_zero_flags & BDRV_REQ_FUA)) { - need_flush = true; - } } else { assert(!bs->supported_zero_flags); } @@ -1259,8 +1249,7 @@ static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs, ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req); if (!ret && bs->detect_zeroes != BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF && - !(flags & BDRV_REQ_ZERO_WRITE) && - (drv->bdrv_co_pwrite_zeroes || drv->bdrv_co_write_zeroes) && + !(flags & BDRV_REQ_ZERO_WRITE) && drv->bdrv_co_pwrite_zeroes && qemu_iovec_is_zero(qiov)) { flags |= BDRV_REQ_ZERO_WRITE; if (bs->detect_zeroes == BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP) {