From patchwork Fri Jul 10 17:27:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 11657201 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 82A6A14E3 for ; Fri, 10 Jul 2020 17:28:37 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1419D20725 for ; Fri, 10 Jul 2020 17:28:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1419D20725 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=openvz.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:41492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtwpA-00075t-4y for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 Jul 2020 13:28:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtwnx-0005M1-27; Fri, 10 Jul 2020 13:27:21 -0400 Received: from relay.sw.ru ([185.231.240.75]:57034 helo=relay3.sw.ru) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtwnu-0006dS-TN; Fri, 10 Jul 2020 13:27:20 -0400 Received: from [192.168.15.187] (helo=iris.sw.ru) by relay3.sw.ru with esmtp (Exim 4.93) (envelope-from ) id 1jtwnk-0008U2-6b; Fri, 10 Jul 2020 20:27:08 +0300 From: "Denis V. Lunev" To: qemu-block@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 1/2] block/block-backend: add converter from BlockAcctStats to BlockBackend Date: Fri, 10 Jul 2020 20:27:10 +0300 Message-Id: <20200710172711.8059-2-den@openvz.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200710172711.8059-1-den@openvz.org> References: <20200710172711.8059-1-den@openvz.org> Received-SPF: pass client-ip=185.231.240.75; envelope-from=den@openvz.org; helo=relay3.sw.ru X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/10 13:27:14 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , "Denis V. Lunev" , Vladimir Sementsov-Ogievskiy , Max Reitz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Right now BlockAcctStats is always reside on BlockBackend. This structure is not used in any other place. Thus we are able to create a converter from one pointer to another. Signed-off-by: Denis V. Lunev CC: Vladimir Sementsov-Ogievskiy CC: Kevin Wolf CC: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/block-backend.c | 5 +++++ include/sysemu/block-backend.h | 1 + 2 files changed, 6 insertions(+) diff --git a/block/block-backend.c b/block/block-backend.c index 6936b25c83..e77a7e468e 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -2143,6 +2143,11 @@ BlockAcctStats *blk_get_stats(BlockBackend *blk) return &blk->stats; } +BlockBackend *blk_stats2blk(BlockAcctStats *s) +{ + return container_of(s, BlockBackend, stats); +} + void *blk_aio_get(const AIOCBInfo *aiocb_info, BlockBackend *blk, BlockCompletionFunc *cb, void *opaque) { diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 8203d7f6f9..bd4694e7bc 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -227,6 +227,7 @@ void blk_add_insert_bs_notifier(BlockBackend *blk, Notifier *notify); void blk_io_plug(BlockBackend *blk); void blk_io_unplug(BlockBackend *blk); BlockAcctStats *blk_get_stats(BlockBackend *blk); +BlockBackend *blk_stats2blk(BlockAcctStats *stats); BlockBackendRootState *blk_get_root_state(BlockBackend *blk); void blk_update_root_state(BlockBackend *blk); bool blk_get_detect_zeroes_from_root_state(BlockBackend *blk);