summaryrefslogtreecommitdiff
path: root/drivers/md/md.h
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2024-03-05 10:23:00 +0300
committerSong Liu <song@kernel.org>2024-03-05 23:53:32 +0300
commit314e9af065513ff86ec9e32eaa96b9bd275cf51d (patch)
treec09c8f5c5ad861c1eb5f309fb661bcce7a0cda38 /drivers/md/md.h
parent7a2347e284d7ec2f0759be4db60fa7ca937284fc (diff)
downloadlinux-314e9af065513ff86ec9e32eaa96b9bd275cf51d.tar.xz
md: export helper md_is_rdwr()
There are no functional changes for now, prepare to fix a deadlock for dm-raid456. Cc: stable@vger.kernel.org # v6.7+ Signed-off-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Xiao Ni <xni@redhat.com> Acked-by: Mike Snitzer <snitzer@kernel.org> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20240305072306.2562024-4-yukuai1@huaweicloud.com
Diffstat (limited to 'drivers/md/md.h')
-rw-r--r--drivers/md/md.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/md/md.h b/drivers/md/md.h
index dff2e333756d..a40e898fe57e 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -569,6 +569,18 @@ 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 int __must_check mddev_lock(struct mddev *mddev)
{
return mutex_lock_interruptible(&mddev->reconfig_mutex);