From patchwork Thu Mar 17 15:56:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 8612691 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8E600C0553 for ; Thu, 17 Mar 2016 16:05:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A3D5D20374 for ; Thu, 17 Mar 2016 16:05:19 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id CE94920361 for ; Thu, 17 Mar 2016 16:05:18 +0000 (UTC) Received: from localhost ([::1]:36210 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agaQI-0002w6-5Y for patchwork-qemu-devel@patchwork.kernel.org; Thu, 17 Mar 2016 12:05:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agaId-0002ha-NG for qemu-devel@nongnu.org; Thu, 17 Mar 2016 11:57:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agaIc-0001rM-MD for qemu-devel@nongnu.org; Thu, 17 Mar 2016 11:57:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55681) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agaIX-0001pI-Cm; Thu, 17 Mar 2016 11:57:17 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id E3B9515563; Thu, 17 Mar 2016 15:57:16 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-71.ams2.redhat.com [10.36.116.71]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2HFuj1T010106; Thu, 17 Mar 2016 11:57:15 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 17 Mar 2016 16:56:36 +0100 Message-Id: <1458230202-29136-24-git-send-email-kwolf@redhat.com> In-Reply-To: <1458230202-29136-1-git-send-email-kwolf@redhat.com> References: <1458230202-29136-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 23/29] block: Pull up blk_read_unthrottled() implementation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use blk_read(), so that it goes through blk_co_preadv() like all read requests from the BB to the BDS. Signed-off-by: Kevin Wolf --- block/block-backend.c | 12 ++++++++++-- block/io.c | 14 -------------- include/block/block.h | 2 -- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index 5b15475..475d27a 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -789,12 +789,20 @@ int blk_read(BlockBackend *blk, int64_t sector_num, uint8_t *buf, int blk_read_unthrottled(BlockBackend *blk, int64_t sector_num, uint8_t *buf, int nb_sectors) { - int ret = blk_check_request(blk, sector_num, nb_sectors); + BlockDriverState *bs = blk_bs(blk); + bool enabled; + int ret; + + ret = blk_check_request(blk, sector_num, nb_sectors); if (ret < 0) { return ret; } - return bdrv_read_unthrottled(blk_bs(blk), sector_num, buf, nb_sectors); + enabled = bs->io_limits_enabled; + bs->io_limits_enabled = false; + ret = blk_read(blk, sector_num, buf, nb_sectors); + bs->io_limits_enabled = enabled; + return ret; } int blk_write(BlockBackend *blk, int64_t sector_num, const uint8_t *buf, diff --git a/block/io.c b/block/io.c index aa8537c..41d954ca 100644 --- a/block/io.c +++ b/block/io.c @@ -615,20 +615,6 @@ int bdrv_read(BlockDriverState *bs, int64_t sector_num, return bdrv_rw_co(bs, sector_num, buf, nb_sectors, false, 0); } -/* Just like bdrv_read(), but with I/O throttling temporarily disabled */ -int bdrv_read_unthrottled(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors) -{ - bool enabled; - int ret; - - enabled = bs->io_limits_enabled; - bs->io_limits_enabled = false; - ret = bdrv_read(bs, sector_num, buf, nb_sectors); - bs->io_limits_enabled = enabled; - return ret; -} - /* Return < 0 if error. Important errors are: -EIO generic I/O error (may happen for all errors) -ENOMEDIUM No media inserted. diff --git a/include/block/block.h b/include/block/block.h index ea8ed04..01349ef 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -229,8 +229,6 @@ void bdrv_reopen_commit(BDRVReopenState *reopen_state); void bdrv_reopen_abort(BDRVReopenState *reopen_state); int bdrv_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors); -int bdrv_read_unthrottled(BlockDriverState *bs, int64_t sector_num, - uint8_t *buf, int nb_sectors); int bdrv_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors); int bdrv_write_zeroes(BlockDriverState *bs, int64_t sector_num,