md: export md_is_rdwr() and is_md_suspended()
authorYu Kuai <yukuai3@huawei.com>
Fri, 12 May 2023 01:56:08 +0000 (09:56 +0800)
committerSong Liu <song@kernel.org>
Tue, 13 Jun 2023 22:13:21 +0000 (15:13 -0700)
The two apis will be used later to fix a deadlock in raid456, there are
no functional changes.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20230512015610.821290-4-yukuai1@huaweicloud.com
drivers/md/md.c
drivers/md/md.h

index b7f8378..fb060e3 100644 (file)
@@ -93,18 +93,6 @@ static int remove_and_add_spares(struct mddev *mddev,
                                 struct md_rdev *this);
 static void mddev_detach(struct mddev *mddev);
 
-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
@@ -360,10 +348,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.
index fd8f260..da173d6 100644 (file)
@@ -555,6 +555,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);