From nobody Sat Apr 27 09:02:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1671202732; cv=none; d=zohomail.com; s=zohoarc; b=DTSF1VUI4Q8WrpqGk7vlToAdTIAYdAhwdvOAwqmEAOiNn74jiIVlq4FzVUbHFRyNtxHtmhTsRzGQtA1CmwrgDVMnaOXEnkkszzP8txaHqjyaqqImBW6IKP1rQFOdmXFERQlFXmh0zX86Qf1qfRufXnWd5fptaZOyDV25QEBcMQQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671202732; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=p34lXTXH9ojVsTIXuK1Z0GIkt5wxYDiGjhLtCnvUauk=; b=OOFT8v9SiN7J8G3G1ltP2+L8U3h/GN4NxfeGLnHY/ee64mSYnhai5Dqew3WcFsA+uORybocBiWOxqFerbBRBWsQXZQh9XlQ4+jdgNpXUJHeNJAaeV89JZrACoAqhG8Lg23rLLdpydVDxNJBWgB1dN1G3nQ56z8tLCu+YTSuSYWU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1671202732905433.8408771838516; Fri, 16 Dec 2022 06:58:52 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.464762.723264 (Exim 4.92) (envelope-from ) id 1p6CAN-0002wN-Vp; Fri, 16 Dec 2022 14:58:27 +0000 Received: by outflank-mailman (output) from mailman id 464762.723264; Fri, 16 Dec 2022 14:58:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p6CAN-0002wE-Sw; Fri, 16 Dec 2022 14:58:27 +0000 Received: by outflank-mailman (input) for mailman id 464762; Fri, 16 Dec 2022 14:58:26 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p6CAM-0002gY-JX for xen-devel@lists.xenproject.org; Fri, 16 Dec 2022 14:58:26 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 17b173ec-7d52-11ed-8fd4-01056ac49cbb; Fri, 16 Dec 2022 15:58:25 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8E26834319; Fri, 16 Dec 2022 14:58:25 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5EBA6138FD; Fri, 16 Dec 2022 14:58:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Woe6FZGHnGO1eAAAMHmgww (envelope-from ); Fri, 16 Dec 2022 14:58:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 17b173ec-7d52-11ed-8fd4-01056ac49cbb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1671202705; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p34lXTXH9ojVsTIXuK1Z0GIkt5wxYDiGjhLtCnvUauk=; b=AngV43GSjP+EgZTw+CQomnAcO316/D35yfh/mfBKQ5hF4BdyCtiwaz7XtMvsvlXtA/c1xA 5yE4jmHwbvtFR3rtls0oq7hPzQmFM+JuYtDOQPNab6b39P/kVA26097d3KntzSou1AUQ24 LYMy0SHyMyqHH5dVQpG/hN1PdAc4s+c= From: Juergen Gross To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Cc: Juergen Gross , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Jens Axboe , xen-devel@lists.xenproject.org Subject: [PATCH 1/4] xen/blkback: fix white space code style issues Date: Fri, 16 Dec 2022 15:58:13 +0100 Message-Id: <20221216145816.27374-2-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221216145816.27374-1-jgross@suse.com> References: <20221216145816.27374-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1671202734624100004 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juergen Gross Acked-by: Roger Pau Monn=C3=A9 --- drivers/block/xen-blkback/blkback.c | 2 +- drivers/block/xen-blkback/common.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkbac= k/blkback.c index a5cf7f1e871c..6e2163aaf362 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -891,7 +891,7 @@ static int xen_blkbk_map(struct xen_blkif_ring *ring, out: for (i =3D last_map; i < num; i++) { /* Don't zap current batch's valid persistent grants. */ - if(i >=3D map_until) + if (i >=3D map_until) pages[i]->persistent_gnt =3D NULL; pages[i]->handle =3D BLKBACK_INVALID_HANDLE; } diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback= /common.h index a28473470e66..9a13a6b420a6 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h @@ -296,7 +296,7 @@ struct xen_blkif_ring { struct work_struct free_work; /* Thread shutdown wait queue. */ wait_queue_head_t shutdown_wq; - struct xen_blkif *blkif; + struct xen_blkif *blkif; }; =20 struct xen_blkif { @@ -315,7 +315,7 @@ struct xen_blkif { atomic_t drain; =20 struct work_struct free_work; - unsigned int nr_ring_pages; + unsigned int nr_ring_pages; bool multi_ref; /* All rings for this device. */ struct xen_blkif_ring *rings; @@ -329,7 +329,7 @@ struct seg_buf { }; =20 struct grant_page { - struct page *page; + struct page *page; struct persistent_gnt *persistent_gnt; grant_handle_t handle; grant_ref_t gref; --=20 2.35.3 From nobody Sat Apr 27 09:02:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1671202733; cv=none; d=zohomail.com; s=zohoarc; b=XXoMzqeHdsyG6SM3rt46jWClEiMFLpHIH/59RcSQKwYiyqe/XEfAm9gd4lCqm7Sbncabi5Cm5JpOy8GcC/JUt0IX8KPghii/PVaZY/xmzlX2rtToNwO2DnBps2kWON6ZPJBDiaSYtGvhSMusrQ2L0afh3nrpQAiIhZxtmSVPvIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671202733; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DdtkNadGDanVmd8kJX65xjdddaLea0RGEwD4P1a+J98=; b=aR5I5SOzWg9jKzs6IlWvcTQW8ChX+tazd5SfFewxPwjyzIEE8bETQcCE82USLl4Wf2DJfmxraLJgoB/X7UgI/hDFDjBQWxsOIv/LHNE+K/tQBhE4PQUEmACiOR6jil6uK5tVc5q6PPV5Gu6VabdeIfmMsLA2ZAuTzWccygRpms0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1671202733499683.984671557302; Fri, 16 Dec 2022 06:58:53 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.464763.723275 (Exim 4.92) (envelope-from ) id 1p6CAT-0003EJ-7f; Fri, 16 Dec 2022 14:58:33 +0000 Received: by outflank-mailman (output) from mailman id 464763.723275; Fri, 16 Dec 2022 14:58:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p6CAT-0003E9-4D; Fri, 16 Dec 2022 14:58:33 +0000 Received: by outflank-mailman (input) for mailman id 464763; Fri, 16 Dec 2022 14:58:32 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p6CAS-0002gY-1D for xen-devel@lists.xenproject.org; Fri, 16 Dec 2022 14:58:32 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 1b0bd78a-7d52-11ed-8fd4-01056ac49cbb; Fri, 16 Dec 2022 15:58:31 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3370A3431A; Fri, 16 Dec 2022 14:58:31 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id EB6A1138FD; Fri, 16 Dec 2022 14:58:30 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id D5wpOJaHnGPAeAAAMHmgww (envelope-from ); Fri, 16 Dec 2022 14:58:30 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1b0bd78a-7d52-11ed-8fd4-01056ac49cbb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1671202711; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DdtkNadGDanVmd8kJX65xjdddaLea0RGEwD4P1a+J98=; b=lODXEK7ebePxLiw4PLu3KgzPfwzpEJ8IAv4i/mfs4SKHCuKJrxjbYg1qOAihkqBC6oD+9U nhSOPxk8HT/dVvpZHdqnBP9Yo3K27sS+sbEM7f/LIiYFCQXYHMP0OtPzTqT1jic8TKGPY9 KjNkKTIBe7WLq0e05vK4e9zGRsdkFbs= From: Juergen Gross To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Cc: Juergen Gross , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Jens Axboe , xen-devel@lists.xenproject.org Subject: [PATCH 2/4] xen/blkback: remove stale prototype Date: Fri, 16 Dec 2022 15:58:14 +0100 Message-Id: <20221216145816.27374-3-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221216145816.27374-1-jgross@suse.com> References: <20221216145816.27374-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1671202734616100003 Content-Type: text/plain; charset="utf-8" There is no function xen_blkif_purge_persistent(), so remove its prototype from common.h. Signed-off-by: Juergen Gross Acked-by: Roger Pau Monn=C3=A9 --- drivers/block/xen-blkback/common.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback= /common.h index 9a13a6b420a6..fab8a8dee0da 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h @@ -384,7 +384,6 @@ void xen_blkif_xenbus_fini(void); =20 irqreturn_t xen_blkif_be_int(int irq, void *dev_id); int xen_blkif_schedule(void *arg); -int xen_blkif_purge_persistent(void *arg); void xen_blkbk_free_caches(struct xen_blkif_ring *ring); =20 int xen_blkbk_flush_diskcache(struct xenbus_transaction xbt, --=20 2.35.3 From nobody Sat Apr 27 09:02:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1671202738; cv=none; d=zohomail.com; s=zohoarc; b=Nz5ZiIdlzRoPVk+xNgLqMTxpI33Gia0f30+RzZAp2x5kktBH1NpZ+1jZFohuXvCgLfwnwd8gf53puwR3sKaD3PVuh7R2mbcmjJVqqJvRBNWkO/NL63HdLTLsLjCqwiqupagucabhi2/WMW+SCMF1jdCqiB9iQ3AzdNVTRWKuVBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671202738; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=x36AuY9fdrueTpOox7l4aH9J7+eTrfGAHM9OlY2CQHU=; b=jon4SbOr3CMjFeXrCRpYaAyRQ09c3ggenjD0bpkhSa/Z3arf1cqnPKiyJ+rRWZK2t1Dx7UN86uIvK6Pdk8Our/0tpIVf3SY3x77txT9L0r8r0fc6O/t3JcB4aaJAPSEY04nmB70SXl6XpqXSo9nt38zpM3GFYnKsIimhPz+BeBQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1671202738242990.6280383981092; Fri, 16 Dec 2022 06:58:58 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.464764.723285 (Exim 4.92) (envelope-from ) id 1p6CAZ-0003ZL-Em; Fri, 16 Dec 2022 14:58:39 +0000 Received: by outflank-mailman (output) from mailman id 464764.723285; Fri, 16 Dec 2022 14:58:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p6CAZ-0003ZC-Bq; Fri, 16 Dec 2022 14:58:39 +0000 Received: by outflank-mailman (input) for mailman id 464764; Fri, 16 Dec 2022 14:58:38 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p6CAY-0003Y8-HI for xen-devel@lists.xenproject.org; Fri, 16 Dec 2022 14:58:38 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 1e75bb65-7d52-11ed-91b6-6bf2151ebd3b; Fri, 16 Dec 2022 15:58:37 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C4D0734319; Fri, 16 Dec 2022 14:58:36 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 93C0B138FD; Fri, 16 Dec 2022 14:58:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ccTCIpyHnGPPeAAAMHmgww (envelope-from ); Fri, 16 Dec 2022 14:58:36 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1e75bb65-7d52-11ed-91b6-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1671202716; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x36AuY9fdrueTpOox7l4aH9J7+eTrfGAHM9OlY2CQHU=; b=SpGCTUY9+p3OSfiSSP0kSXj9iihsB9mtnEn6ajE8dHqS/FXFp5u52Ir2MnnMN0A0cCXhCR /nXL0RpYDQ5qQuU2FRxvLaqebBWdRkl6u08yKZs+ggqLcW7K2N/SgFEgEOusM82T6Xk9rN 7dJmWlPYvDa0JU/uSa6/ZfB3W7Wi8OE= From: Juergen Gross To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Cc: Juergen Gross , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Jens Axboe , xen-devel@lists.xenproject.org Subject: [PATCH 3/4] xen/blkback: simplify free_persistent_gnts() interface Date: Fri, 16 Dec 2022 15:58:15 +0100 Message-Id: <20221216145816.27374-4-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221216145816.27374-1-jgross@suse.com> References: <20221216145816.27374-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1671202738703100001 Content-Type: text/plain; charset="utf-8" The interface of free_persistent_gnts() can be simplified, as there is only a single caller of free_persistent_gnts() and the 2nd and 3rd parameters are easily obtainable via the ring pointer, which is passed as the first parameter anyway. Signed-off-by: Juergen Gross Acked-by: Roger Pau Monn=C3=A9 --- drivers/block/xen-blkback/blkback.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkbac= k/blkback.c index 6e2163aaf362..243712b59a05 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -239,9 +239,9 @@ static void put_persistent_gnt(struct xen_blkif_ring *r= ing, atomic_dec(&ring->persistent_gnt_in_use); } =20 -static void free_persistent_gnts(struct xen_blkif_ring *ring, struct rb_ro= ot *root, - unsigned int num) +static void free_persistent_gnts(struct xen_blkif_ring *ring) { + struct rb_root *root =3D &ring->persistent_gnts; struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST]; struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; struct persistent_gnt *persistent_gnt; @@ -249,6 +249,9 @@ static void free_persistent_gnts(struct xen_blkif_ring = *ring, struct rb_root *ro int segs_to_unmap =3D 0; struct gntab_unmap_queue_data unmap_data; =20 + if (RB_EMPTY_ROOT(root)) + return; + unmap_data.pages =3D pages; unmap_data.unmap_ops =3D unmap; unmap_data.kunmap_ops =3D NULL; @@ -277,9 +280,11 @@ static void free_persistent_gnts(struct xen_blkif_ring= *ring, struct rb_root *ro =20 rb_erase(&persistent_gnt->node, root); kfree(persistent_gnt); - num--; + ring->persistent_gnt_c--; } - BUG_ON(num !=3D 0); + + BUG_ON(!RB_EMPTY_ROOT(&ring->persistent_gnts)); + BUG_ON(ring->persistent_gnt_c !=3D 0); } =20 void xen_blkbk_unmap_purged_grants(struct work_struct *work) @@ -631,12 +636,7 @@ int xen_blkif_schedule(void *arg) void xen_blkbk_free_caches(struct xen_blkif_ring *ring) { /* Free all persistent grant pages */ - if (!RB_EMPTY_ROOT(&ring->persistent_gnts)) - free_persistent_gnts(ring, &ring->persistent_gnts, - ring->persistent_gnt_c); - - BUG_ON(!RB_EMPTY_ROOT(&ring->persistent_gnts)); - ring->persistent_gnt_c =3D 0; + free_persistent_gnts(ring); =20 /* Since we are shutting down remove all pages from the buffer */ gnttab_page_cache_shrink(&ring->free_pages, 0 /* All */); --=20 2.35.3 From nobody Sat Apr 27 09:02:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1671202741; cv=none; d=zohomail.com; s=zohoarc; b=NGavOg4ifKY4WKMJRdfYKP87yT4yF5+tkKx9WevEWRBSnAgss/spT43r19Wm8MeiB6N7WuvVw78emlWstI9JA/8ivwFccIiZWPzh1A/ZHvlxauhC2fhC0x1vsTXfMjmiY0HofV2IbF9en1GPyemoVlgQ7Pa8aakUxJnx64OvSxg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671202741; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=S1aJf8gXHaJ+X80/r6maMNPs5igiWeM8Bd/SEgyLpuA=; b=Ba7YC7IuJo+LV8kHmLu5jowTrOAtUC90rvxRRyS+9WcdTVmDA6Ab+oP6xeZvLahOPsbGQ1NKT4obt8keko4PfdCs8rsEzXBCHrW2o6Tud1ZcMcM4DQ7OoU+/hkOwWsXHPsHgd5khZqJNFP3UB6d7pISa3b2CfIprkXStIcDh0WQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1671202741926795.2209431308656; Fri, 16 Dec 2022 06:59:01 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.464766.723297 (Exim 4.92) (envelope-from ) id 1p6CAe-000410-S7; Fri, 16 Dec 2022 14:58:44 +0000 Received: by outflank-mailman (output) from mailman id 464766.723297; Fri, 16 Dec 2022 14:58:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p6CAe-00040n-Ov; Fri, 16 Dec 2022 14:58:44 +0000 Received: by outflank-mailman (input) for mailman id 464766; Fri, 16 Dec 2022 14:58:43 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p6CAd-0002gY-Pq for xen-devel@lists.xenproject.org; Fri, 16 Dec 2022 14:58:43 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [2001:67c:2178:6::1d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 21bb8993-7d52-11ed-8fd4-01056ac49cbb; Fri, 16 Dec 2022 15:58:42 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 676BF5D097; Fri, 16 Dec 2022 14:58:42 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3A5E8138FD; Fri, 16 Dec 2022 14:58:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 3TMRDaKHnGPZeAAAMHmgww (envelope-from ); Fri, 16 Dec 2022 14:58:42 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 21bb8993-7d52-11ed-8fd4-01056ac49cbb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1671202722; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S1aJf8gXHaJ+X80/r6maMNPs5igiWeM8Bd/SEgyLpuA=; b=X4OcY5RzrJYhO+F6Pv8Xntji3GFS9qqfvMdZDVzhk5OGM5gkqQdbyKjUs+gLMU5wdBr20y Sxg/cuBju/PlS9J4M2tR4pMwjUW2YTrGYAsyVU/TDbstIrOSLYQOe+h8ztyBlsDXwnNNvy 0bGgYExlshlxwyNzTjGhy/V6tbfp68I= From: Juergen Gross To: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Cc: Juergen Gross , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Jens Axboe , xen-devel@lists.xenproject.org Subject: [PATCH 4/4] xen/blkback: move blkif_get_x86_*_req() into blkback.c Date: Fri, 16 Dec 2022 15:58:16 +0100 Message-Id: <20221216145816.27374-5-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221216145816.27374-1-jgross@suse.com> References: <20221216145816.27374-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1671202742689100005 Content-Type: text/plain; charset="utf-8" There is no need to have the functions blkif_get_x86_32_req() and blkif_get_x86_64_req() in a header file, as they are used in one place only. So move them into the using source file and drop the inline qualifier. While at it fix some style issues, and simplify the code by variable reusing and using min() instead of open coding it. Instead of using barrier() use READ_ONCE() for avoiding multiple reads of nr_segments. Signed-off-by: Juergen Gross Acked-by: Roger Pau Monn=C3=A9 --- drivers/block/xen-blkback/blkback.c | 104 ++++++++++++++++++++++++++++ drivers/block/xen-blkback/common.h | 96 ------------------------- 2 files changed, 104 insertions(+), 96 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkbac= k/blkback.c index 243712b59a05..7561fdb72c13 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -1072,7 +1072,111 @@ static void end_block_io_op(struct bio *bio) bio_put(bio); } =20 +static void blkif_get_x86_32_req(struct blkif_request *dst, + struct blkif_x86_32_request *src) +{ + int i, n; + + dst->operation =3D READ_ONCE(src->operation); + + switch (dst->operation) { + case BLKIF_OP_READ: + case BLKIF_OP_WRITE: + case BLKIF_OP_WRITE_BARRIER: + case BLKIF_OP_FLUSH_DISKCACHE: + dst->u.rw.nr_segments =3D READ_ONCE(src->u.rw.nr_segments); + dst->u.rw.handle =3D src->u.rw.handle; + dst->u.rw.id =3D src->u.rw.id; + dst->u.rw.sector_number =3D src->u.rw.sector_number; + n =3D min_t(int, BLKIF_MAX_SEGMENTS_PER_REQUEST, + dst->u.rw.nr_segments); + for (i =3D 0; i < n; i++) + dst->u.rw.seg[i] =3D src->u.rw.seg[i]; + break; + + case BLKIF_OP_DISCARD: + dst->u.discard.flag =3D src->u.discard.flag; + dst->u.discard.id =3D src->u.discard.id; + dst->u.discard.sector_number =3D src->u.discard.sector_number; + dst->u.discard.nr_sectors =3D src->u.discard.nr_sectors; + break; + + case BLKIF_OP_INDIRECT: + dst->u.indirect.indirect_op =3D src->u.indirect.indirect_op; + dst->u.indirect.nr_segments =3D + READ_ONCE(src->u.indirect.nr_segments); + dst->u.indirect.handle =3D src->u.indirect.handle; + dst->u.indirect.id =3D src->u.indirect.id; + dst->u.indirect.sector_number =3D src->u.indirect.sector_number; + n =3D min(MAX_INDIRECT_PAGES, + INDIRECT_PAGES(dst->u.indirect.nr_segments)); + for (i =3D 0; i < n; i++) + dst->u.indirect.indirect_grefs[i] =3D + src->u.indirect.indirect_grefs[i]; + break; + + default: + /* + * Don't know how to translate this op. Only get the + * ID so failure can be reported to the frontend. + */ + dst->u.other.id =3D src->u.other.id; + break; + } +} =20 +static void blkif_get_x86_64_req(struct blkif_request *dst, + struct blkif_x86_64_request *src) +{ + int i, n; + + dst->operation =3D READ_ONCE(src->operation); + + switch (dst->operation) { + case BLKIF_OP_READ: + case BLKIF_OP_WRITE: + case BLKIF_OP_WRITE_BARRIER: + case BLKIF_OP_FLUSH_DISKCACHE: + dst->u.rw.nr_segments =3D READ_ONCE(src->u.rw.nr_segments); + dst->u.rw.handle =3D src->u.rw.handle; + dst->u.rw.id =3D src->u.rw.id; + dst->u.rw.sector_number =3D src->u.rw.sector_number; + n =3D min_t(int, BLKIF_MAX_SEGMENTS_PER_REQUEST, + dst->u.rw.nr_segments); + for (i =3D 0; i < n; i++) + dst->u.rw.seg[i] =3D src->u.rw.seg[i]; + break; + + case BLKIF_OP_DISCARD: + dst->u.discard.flag =3D src->u.discard.flag; + dst->u.discard.id =3D src->u.discard.id; + dst->u.discard.sector_number =3D src->u.discard.sector_number; + dst->u.discard.nr_sectors =3D src->u.discard.nr_sectors; + break; + + case BLKIF_OP_INDIRECT: + dst->u.indirect.indirect_op =3D src->u.indirect.indirect_op; + dst->u.indirect.nr_segments =3D + READ_ONCE(src->u.indirect.nr_segments); + dst->u.indirect.handle =3D src->u.indirect.handle; + dst->u.indirect.id =3D src->u.indirect.id; + dst->u.indirect.sector_number =3D src->u.indirect.sector_number; + n =3D min(MAX_INDIRECT_PAGES, + INDIRECT_PAGES(dst->u.indirect.nr_segments)); + for (i =3D 0; i < n; i++) + dst->u.indirect.indirect_grefs[i] =3D + src->u.indirect.indirect_grefs[i]; + break; + + default: + /* + * Don't know how to translate this op. Only get the + * ID so failure can be reported to the frontend. + */ + dst->u.other.id =3D src->u.other.id; + break; + } +} =20 /* * Function to copy the from the ring buffer the 'struct blkif_request' diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback= /common.h index fab8a8dee0da..40f67bfc052d 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h @@ -394,100 +394,4 @@ int xen_blkbk_barrier(struct xenbus_transaction xbt, struct xenbus_device *xen_blkbk_xenbus(struct backend_info *be); void xen_blkbk_unmap_purged_grants(struct work_struct *work); =20 -static inline void blkif_get_x86_32_req(struct blkif_request *dst, - struct blkif_x86_32_request *src) -{ - int i, n =3D BLKIF_MAX_SEGMENTS_PER_REQUEST, j; - dst->operation =3D READ_ONCE(src->operation); - switch (dst->operation) { - case BLKIF_OP_READ: - case BLKIF_OP_WRITE: - case BLKIF_OP_WRITE_BARRIER: - case BLKIF_OP_FLUSH_DISKCACHE: - dst->u.rw.nr_segments =3D src->u.rw.nr_segments; - dst->u.rw.handle =3D src->u.rw.handle; - dst->u.rw.id =3D src->u.rw.id; - dst->u.rw.sector_number =3D src->u.rw.sector_number; - barrier(); - if (n > dst->u.rw.nr_segments) - n =3D dst->u.rw.nr_segments; - for (i =3D 0; i < n; i++) - dst->u.rw.seg[i] =3D src->u.rw.seg[i]; - break; - case BLKIF_OP_DISCARD: - dst->u.discard.flag =3D src->u.discard.flag; - dst->u.discard.id =3D src->u.discard.id; - dst->u.discard.sector_number =3D src->u.discard.sector_number; - dst->u.discard.nr_sectors =3D src->u.discard.nr_sectors; - break; - case BLKIF_OP_INDIRECT: - dst->u.indirect.indirect_op =3D src->u.indirect.indirect_op; - dst->u.indirect.nr_segments =3D src->u.indirect.nr_segments; - dst->u.indirect.handle =3D src->u.indirect.handle; - dst->u.indirect.id =3D src->u.indirect.id; - dst->u.indirect.sector_number =3D src->u.indirect.sector_number; - barrier(); - j =3D min(MAX_INDIRECT_PAGES, INDIRECT_PAGES(dst->u.indirect.nr_segments= )); - for (i =3D 0; i < j; i++) - dst->u.indirect.indirect_grefs[i] =3D - src->u.indirect.indirect_grefs[i]; - break; - default: - /* - * Don't know how to translate this op. Only get the - * ID so failure can be reported to the frontend. - */ - dst->u.other.id =3D src->u.other.id; - break; - } -} - -static inline void blkif_get_x86_64_req(struct blkif_request *dst, - struct blkif_x86_64_request *src) -{ - int i, n =3D BLKIF_MAX_SEGMENTS_PER_REQUEST, j; - dst->operation =3D READ_ONCE(src->operation); - switch (dst->operation) { - case BLKIF_OP_READ: - case BLKIF_OP_WRITE: - case BLKIF_OP_WRITE_BARRIER: - case BLKIF_OP_FLUSH_DISKCACHE: - dst->u.rw.nr_segments =3D src->u.rw.nr_segments; - dst->u.rw.handle =3D src->u.rw.handle; - dst->u.rw.id =3D src->u.rw.id; - dst->u.rw.sector_number =3D src->u.rw.sector_number; - barrier(); - if (n > dst->u.rw.nr_segments) - n =3D dst->u.rw.nr_segments; - for (i =3D 0; i < n; i++) - dst->u.rw.seg[i] =3D src->u.rw.seg[i]; - break; - case BLKIF_OP_DISCARD: - dst->u.discard.flag =3D src->u.discard.flag; - dst->u.discard.id =3D src->u.discard.id; - dst->u.discard.sector_number =3D src->u.discard.sector_number; - dst->u.discard.nr_sectors =3D src->u.discard.nr_sectors; - break; - case BLKIF_OP_INDIRECT: - dst->u.indirect.indirect_op =3D src->u.indirect.indirect_op; - dst->u.indirect.nr_segments =3D src->u.indirect.nr_segments; - dst->u.indirect.handle =3D src->u.indirect.handle; - dst->u.indirect.id =3D src->u.indirect.id; - dst->u.indirect.sector_number =3D src->u.indirect.sector_number; - barrier(); - j =3D min(MAX_INDIRECT_PAGES, INDIRECT_PAGES(dst->u.indirect.nr_segments= )); - for (i =3D 0; i < j; i++) - dst->u.indirect.indirect_grefs[i] =3D - src->u.indirect.indirect_grefs[i]; - break; - default: - /* - * Don't know how to translate this op. Only get the - * ID so failure can be reported to the frontend. - */ - dst->u.other.id =3D src->u.other.id; - break; - } -} - #endif /* __XEN_BLKIF__BACKEND__COMMON_H__ */ --=20 2.35.3