From patchwork Thu Feb 1 09:25:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 195223 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp30602dyb; Thu, 1 Feb 2024 01:33:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IFO5ZGF331Bjj8yCHBMiZ5H3cGwZ/fralVLdL/k6qKNLCPnXDrRiwFu/mT6U8UefM4ZYF6I X-Received: by 2002:aa7:df1a:0:b0:55f:3d24:e64d with SMTP id c26-20020aa7df1a000000b0055f3d24e64dmr1152251edy.3.1706780029524; Thu, 01 Feb 2024 01:33:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706780029; cv=pass; d=google.com; s=arc-20160816; b=b60D1auQgBFREQjBd8c1bW9loN/oGQUVuOOE+neA7zaABrRG6OwWDjIoKlvscJHxC4 OccX0uj21PcEBBwxw/VC7rw95SXqeJhJggz53WqjO/dnngwrTmel55mz6y0Ti/6Cq46x 9Hmwphkai/YBNDiKeWHoDjRDXIhhGi+XJwYszyWN+Y9/yLLRxFrnNH8cBijs8j0BOAer 9WxuqkNKnvUihFZNKYwEcpsHT5w3JwBlfxkgmk4ia30xbtCuLnFHM8dwTQC7djYeGHHN zs4PXSwmfrBcjA8Bl6SllEODVOvy5DfqMKhr0Gv6/Qu5QKEWNXdJQJv1H2aSy5CK+JlF vpwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=t/Rfjl2seGG+IetcoK+NDdWeNbaN7vNh3uonOlKoaDA=; fh=AfgDUp6EEcEVbV7MNLN8kX6dqh71F4C9TcPvh6KsvOU=; b=TnxIfEtX6oTQ6yg/UR/zOtOvTi3ymoruR314Q1udTPBrxh/SDNNslHjyGWpHux83DI 8pFJOy46e0YdDatX4WYfh7fZ7QU4n2YMgbz21ebgcv3CGRwGdZdQTVwPNYgqpWuNu2Zt uiXdWp5YEKHcS4VTjlGkynwM2nV0GynhT9OVVYTvdNzVu1pG+IiB69P2jpwlyDbTIeGO LzY95aLyyONr0bHCdA3IREfmaQ+GWjQLzEtvphA+1E+LquhXr7x4NWfJl+fsX6DgIfda neLJXG+G4Vk/8/S9mVAydmKT1LatWE8YW9ME08B1YU6TjIbnLZdbPOJ+gTv2CjckGwFV kgjg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-47872-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47872-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCU4Aa8UP2AvRvISVWNiEdTh7BjEWUjTpnQU6V4AsuJXryxMt48anZOJ9QBb/vzuM8yKSroQ8ToMmSWBrJFhFAOn15XFYQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b19-20020a0564021f1300b0055f179146easi3530742edb.651.2024.02.01.01.33.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 01:33:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47872-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-47872-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47872-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 25C0E1F25A0C for ; Thu, 1 Feb 2024 09:33:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D3583161B56; Thu, 1 Feb 2024 09:30:38 +0000 (UTC) Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62FF815D5BE; Thu, 1 Feb 2024 09:30:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706779836; cv=none; b=QDU2qdDSimbgKemqBhypvU1lmp/GQElPfWmA7F8cit9un8moXnX1jlDwCeygc+F/Zd/sONb+nd0S9OO0p3r9zLzoPKt7ooraGtkv04yCpxho2NWY9gsQs3rn6Y5KMnI5+gap493JiNUVrT2I/CiWeL/YTj/RcAAKsrYi7w+osCM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706779836; c=relaxed/simple; bh=vPUwDnj2r3EpC4pjhrctEkLZPrJIzYpfNoWsG8fF+D8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eLtXtk4pjPjbd6OjfrCiqEf8mZ1V33QElLft0qtcwDrFUPVN7jxaaFxVRYnIutWnzA0EkQGdg9koo17U3PxecBlKq9xLyckRKEHASGlc3EYALGXEasDX0MdSawu5nrP/493bpA3Tat1Ud2ZcOWFmVxr7QE28LgJFMADjPOM7XWw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4TQYY04MC4z4f3kk9; Thu, 1 Feb 2024 17:30:28 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 32A511A0199; Thu, 1 Feb 2024 17:30:31 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgCXaBGtZLtl8V6KCg--.33515S12; Thu, 01 Feb 2024 17:30:30 +0800 (CST) From: Yu Kuai To: mpatocka@redhat.com, heinzm@redhat.com, xni@redhat.com, blazej.kucman@linux.intel.com, agk@redhat.com, snitzer@kernel.org, dm-devel@lists.linux.dev, song@kernel.org, yukuai3@huawei.com, jbrassow@f14.redhat.com, neilb@suse.de, shli@fb.com, akpm@osdl.org Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH v5 08/14] md: export helper md_is_rdwr() Date: Thu, 1 Feb 2024 17:25:53 +0800 Message-Id: <20240201092559.910982-9-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240201092559.910982-1-yukuai1@huaweicloud.com> References: <20240201092559.910982-1-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: cCh0CgCXaBGtZLtl8V6KCg--.33515S12 X-Coremail-Antispam: 1UD129KBjvJXoW7Kr47Kr4xtrykGw13uF4fGrg_yoW8XFWrpa 9agFy3Ar4UZF43X34UJayDua45Z3WfKrWqkry3u393Za43XrZ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GMAIL-THRID: 1789688576382895780 X-GMAIL-MSGID: 1789688576382895780 From: Yu Kuai There are no functional changes for now, prepare to fix a deadlock for dm-raid456. Signed-off-by: Yu Kuai --- drivers/md/md.c | 12 ------------ drivers/md/md.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 19f16a77cf9c..2c245341148a 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -99,18 +99,6 @@ static void mddev_detach(struct mddev *mddev); static void export_rdev(struct md_rdev *rdev, struct mddev *mddev); static void md_wakeup_thread_directly(struct md_thread __rcu *thread); -enum md_ro_state { - MD_RDWR, - MD_RDONLY, - MD_AUTO_READ, - MD_MAX_STATE -}; - -static bool md_is_rdwr(struct mddev *mddev) -{ - return (mddev->ro == MD_RDWR); -} - /* * Default number of read corrections we'll attempt on an rdev * before ejecting it from the array. We divide the read error diff --git a/drivers/md/md.h b/drivers/md/md.h index 437ab70ce79b..684cc866402a 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -558,6 +558,18 @@ enum recovery_flags { MD_RESYNCING_REMOTE, /* remote node is running resync thread */ }; +enum md_ro_state { + MD_RDWR, + MD_RDONLY, + MD_AUTO_READ, + MD_MAX_STATE +}; + +static inline bool md_is_rdwr(struct mddev *mddev) +{ + return (mddev->ro == MD_RDWR); +} + static inline int __must_check mddev_lock(struct mddev *mddev) { return mutex_lock_interruptible(&mddev->reconfig_mutex);