From nobody Thu May 2 19:33:20 2024 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516632425303844.7512401494712; Mon, 22 Jan 2018 06:47:05 -0800 (PST) Received: from localhost ([::1]:46043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eddN8-0005PY-Nl for importer@patchew.org; Mon, 22 Jan 2018 09:46:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eddMC-00050k-2X for qemu-devel@nongnu.org; Mon, 22 Jan 2018 09:45:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eddM9-0007so-Ga for qemu-devel@nongnu.org; Mon, 22 Jan 2018 09:45:56 -0500 Received: from new-relay.sw.ru ([195.214.232.40]:50448) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eddM9-0007qN-9H; Mon, 22 Jan 2018 09:45:53 -0500 Received: from msk-vpn.virtuozzo.com ([195.214.232.6] helo=kvm.sw.ru) by new-relay.sw.ru with esmtp (Exim 4.89) (envelope-from ) id 1eddM5-0004dW-Q7; Mon, 22 Jan 2018 17:45:49 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Mon, 22 Jan 2018 17:45:49 +0300 Message-Id: <20180122144549.25318-1-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.11.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 195.214.232.40 Subject: [Qemu-devel] [RFC] block-backend: fix double inc/dec inflight requests number 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, den@openvz.org, vsementsov@virtuozzo.com, mreitz@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" blk_co_preadv and blk_co_pwritev calls bdrv_inc_in_flight and bdrv_dec_in_flight. But they calls correspondingly bdrv_co_preadv and bdrv_co_pwritev, which inc/dec in-flight count by themselves. Counting in-flight requests in blk_ layer is redundant, drop it. Signed-off-by: Vladimir Sementsov-Ogievskiy --- Hi all! Is it a bug or a feature? Why do we call inc/dec twice for read/write? We don't do this for flush and discard.. (patch is called RFC, but it may be applied as is, if it is OK) block/block-backend.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index baef8e7abc..8219f59d93 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1094,17 +1094,13 @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, i= nt64_t offset, return ret; } =20 - bdrv_inc_in_flight(bs); - /* throttling disk I/O */ if (blk->public.throttle_group_member.throttle_state) { throttle_group_co_io_limits_intercept(&blk->public.throttle_group_= member, bytes, false); } =20 - ret =3D bdrv_co_preadv(blk->root, offset, bytes, qiov, flags); - bdrv_dec_in_flight(bs); - return ret; + return bdrv_co_preadv(blk->root, offset, bytes, qiov, flags); } =20 int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset, @@ -1121,7 +1117,6 @@ int coroutine_fn blk_co_pwritev(BlockBackend *blk, in= t64_t offset, return ret; } =20 - bdrv_inc_in_flight(bs); /* throttling disk I/O */ if (blk->public.throttle_group_member.throttle_state) { throttle_group_co_io_limits_intercept(&blk->public.throttle_group_= member, @@ -1132,9 +1127,7 @@ int coroutine_fn blk_co_pwritev(BlockBackend *blk, in= t64_t offset, flags |=3D BDRV_REQ_FUA; } =20 - ret =3D bdrv_co_pwritev(blk->root, offset, bytes, qiov, flags); - bdrv_dec_in_flight(bs); - return ret; + return bdrv_co_pwritev(blk->root, offset, bytes, qiov, flags); } =20 typedef struct BlkRwCo { --=20 2.11.1