Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp9656505rwr; Thu, 11 May 2023 19:23:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ401iyj8AFQxXlYsFfhvXtqDUoc0L+zAlT+YxeuBf9GeXhzzYqYIv/bBdt2rONCAipCikeL X-Received: by 2002:a17:90a:db49:b0:250:d137:e2ae with SMTP id u9-20020a17090adb4900b00250d137e2aemr8153851pjx.23.1683858202489; Thu, 11 May 2023 19:23:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683858202; cv=none; d=google.com; s=arc-20160816; b=PRG05QK9Jcxxpnc4poE760m5kPCcQSpDAQD8r/49H0AqYaiHz3XnnSblDCrcQpyuz8 Pchwv92TCYH928IUjJ+5bD+rOKkH4ft99JDqHchq9zLyhmgW03oFNqMTeiwAZVVaafpe ARvyit+P9xsDl2D7Dtt6w2AcBt4uF2CMt0/l1aUaY1Q0URHMZbdYgPC3U1PvHDKa0ZjY jeF8XRpR3x6MaMh1jdhcRlOY24Jv8ZHMRQvyZf7GpOUSIjUlpsw0+SEt1xQy09KmUak7 QM2f5MVIN6jKV5ENHAOuZ+Nipkm/mHp7M84RFUjhL/iuBhC7sK3ma7XDtG+/NbAJeDrm uVMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=UGtNbYniB5kITe9i1mR+JoymqEdOSPFtZu78CE6HIXY=; b=jkMkluZnQDwguOvAQSE0psWhYzV+4AkWE3XOmwV2vlhmpMIzEmzGhEf5+F1fB4QRvd mCwpffxKz5CD2GIgO9YvrI+ArpxIND0FUgxBszq9K7pKkbxLov86W4232cTbI/iCzSJq 34jmmskWDXdi9rj9oDb4YwOQNokbyIwdnj8VKeGjbC+OjQsNw7VT3ncQNm5NZoNU1yeA Puk0N0vhU5Sp/INt9JG07Vx+Iz9Zzg1Ezx9MUGHXdpK9vr0A66sFNAzQmtCWsKKU7ui8 auoot22/rMg4PvSyYDgQecpsGr460AcbR8mLbjBmDUPxpfcp/0l+Le67sRqvGl1NWZAs r47w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id my8-20020a17090b4c8800b0025069d02778si14309125pjb.28.2023.05.11.19.23.10; Thu, 11 May 2023 19:23:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239798AbjELB7K (ORCPT + 99 others); Thu, 11 May 2023 21:59:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239657AbjELB66 (ORCPT ); Thu, 11 May 2023 21:58:58 -0400 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99FED5B8B; Thu, 11 May 2023 18:58:55 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4QHX4C62H7z4f3lY0; Fri, 12 May 2023 09:58:51 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgBnHbFYnV1kbjQOJQ--.16243S7; Fri, 12 May 2023 09:58:53 +0800 (CST) From: Yu Kuai To: logang@deltatee.com, reddunur@online.de, jovetoo@gmail.com, dgilmour76@gmail.com, song@kernel.org Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH -next 3/5] md: export md_is_rdwr() and is_md_suspended() Date: Fri, 12 May 2023 09:56:08 +0800 Message-Id: <20230512015610.821290-4-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230512015610.821290-1-yukuai1@huaweicloud.com> References: <20230512015610.821290-1-yukuai1@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgBnHbFYnV1kbjQOJQ--.16243S7 X-Coremail-Antispam: 1UD129KBjvJXoW7WFyxAFW8Cr47Wr43CrWruFg_yoW8uF1rpa ySqFyfZr4DZF43Gw4UJ3yDua45Zr1xKFW2yry7Cw4rZa43Xr1DCF1rWFWUXrykGFyfCr12 qa1UJFy8Cr40yrUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBE14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JrWl82xGYIkIc2 x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJw A2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS 0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2 IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0 Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2kIc2 xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v2 6r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2 Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_ Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMI IF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUd8n5UUUUU = X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yu Kuai The two apis will be used later to fix a deadlock in raid456, there are no functional changes. Signed-off-by: Yu Kuai --- drivers/md/md.c | 16 ---------------- drivers/md/md.h | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index cf60d4b5356d..5db26b7e7314 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -90,18 +90,6 @@ static void mddev_detach(struct mddev *mddev); static void md_wakeup_thread_directly(struct md_thread __rcu *thread); static void export_rdev(struct md_rdev *rdev); -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 @@ -377,10 +365,6 @@ EXPORT_SYMBOL_GPL(md_new_event); static LIST_HEAD(all_mddevs); static DEFINE_SPINLOCK(all_mddevs_lock); -static bool is_md_suspended(struct mddev *mddev) -{ - return percpu_ref_is_dying(&mddev->active_io); -} /* Rather than calling directly into the personality make_request function, * IO requests come here first so that we can check if the device is * being suspended pending a reconfiguration. diff --git a/drivers/md/md.h b/drivers/md/md.h index a228e78e7f3a..7827f27c1406 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -563,6 +563,23 @@ 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 bool is_md_suspended(struct mddev *mddev) +{ + return percpu_ref_is_dying(&mddev->active_io); +} + static inline int __must_check mddev_lock(struct mddev *mddev) { return mutex_lock_interruptible(&mddev->reconfig_mutex); -- 2.39.2