diff options
author | Yu Kuai <yukuai3@huawei.com> | 2023-05-12 09:56:08 +0800 |
---|---|---|
committer | Song Liu <song@kernel.org> | 2023-06-13 15:13:21 -0700 |
commit | 431e61257d631157e1d374f1368febf37aa59f7c (patch) | |
tree | 8d9adecbca00a8e3520b5d175f66c359e5516054 /drivers/md/md.h | |
parent | 873f50ece41aad5c4f788a340960c53774b5526e (diff) | |
download | lwn-431e61257d631157e1d374f1368febf37aa59f7c.tar.gz lwn-431e61257d631157e1d374f1368febf37aa59f7c.zip |
md: export md_is_rdwr() and is_md_suspended()
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
Diffstat (limited to 'drivers/md/md.h')
-rw-r--r-- | drivers/md/md.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/md/md.h b/drivers/md/md.h index fd8f260ed5f8..da173d6bf726 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -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); |