@@ -850,6 +850,42 @@ static inline void mddev_check_write_zeroes(struct mddev *mddev, struct bio *bio
mddev->queue->limits.max_write_zeroes_sectors = 0;
}
+static inline int mddev_suspend_and_lock(struct mddev *mddev)
+{
+ int ret;
+
+ __mddev_suspend(mddev);
+ ret = mddev_lock(mddev);
+ if (ret)
+ __mddev_resume(mddev);
+
+ return ret;
+}
+
+static inline void mddev_suspend_and_lock_nointr(struct mddev *mddev)
+{
+ __mddev_suspend(mddev);
+ mutex_lock(&mddev->reconfig_mutex);
+}
+
+static inline int mddev_suspend_and_trylock(struct mddev *mddev)
+{
+ int ret;
+
+ __mddev_suspend(mddev);
+ ret = mutex_trylock(&mddev->reconfig_mutex);
+ if (ret)
+ __mddev_resume(mddev);
+
+ return ret;
+}
+
+static inline void mddev_unlock_and_resume(struct mddev *mddev)
+{
+ mddev_unlock(mddev);
+ __mddev_resume(mddev);
+}
+
struct mdu_array_info_s;
struct mdu_disk_info_s;