[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230512015610.821290-4-yukuai1@huaweicloud.com>
Date: Fri, 12 May 2023 09:56:08 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: logang@...tatee.com, reddunur@...ine.de, jovetoo@...il.com,
dgilmour76@...il.com, song@...nel.org
Cc: linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
yukuai3@...wei.com, yukuai1@...weicloud.com, yi.zhang@...wei.com,
yangerkun@...wei.com
Subject: [PATCH -next 3/5] md: export md_is_rdwr() and is_md_suspended()
From: Yu Kuai <yukuai3@...wei.com>
The two apis will be used later to fix a deadlock in raid456, there are
no functional changes.
Signed-off-by: Yu Kuai <yukuai3@...wei.com>
---
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
Powered by blists - more mailing lists