From: Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>
To: song@kernel.org, yukuai@fygo.io, chengzhihao1@huawei.com,
magiclinan@didiglobal.com, xiao@kernel.org, agk@redhat.com,
snitzer@kernel.org, mpatocka@redhat.com, bmarzins@redhat.com,
arnd@arndb.de, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org,
dm-devel@lists.linux.dev,
Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>
Subject: [PATCH 1/2] md: make mddev lookup and ioctl helpers non-static
Date: Mon, 28 Sep 2026 20:12:23 +0000 [thread overview]
Message-ID: <20260928201224.3602262-2-abd.masalkhi@gmail.com> (raw)
In-Reply-To: <20260928201224.3602262-1-abd.masalkhi@gmail.com>
A following patch adds an md misc control device, so that arrays can
be managed without opening the md block device. Its code lives in a
separate file and needs to look up arrays and reuse existing ioctl
helpers.
Signed-off-by: Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>
---
drivers/md/md.c | 10 +++++-----
drivers/md/md.h | 5 +++++
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 680b34a63cb3..b5027d65c6d8 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -364,8 +364,8 @@ EXPORT_SYMBOL_GPL(md_new_event);
* Enables to iterate over all existing md arrays
* all_mddevs_lock protects this list.
*/
-static LIST_HEAD(all_mddevs);
-static DEFINE_SPINLOCK(all_mddevs_lock);
+LIST_HEAD(all_mddevs);
+DEFINE_SPINLOCK(all_mddevs_lock);
static bool is_md_suspended(struct mddev *mddev)
{
@@ -623,7 +623,7 @@ bool md_flush_request(struct mddev *mddev, struct bio *bio)
}
EXPORT_SYMBOL(md_flush_request);
-static inline struct mddev *mddev_get(struct mddev *mddev)
+struct mddev *mddev_get(struct mddev *mddev)
{
lockdep_assert_held(&all_mddevs_lock);
@@ -8101,7 +8101,7 @@ static void put_cluster_ops(struct mddev *mddev)
* Any differences that cannot be handled will cause an error.
* Normally, only one change can be managed at a time.
*/
-static int update_array_info(struct mddev *mddev, mdu_array_info_t *info)
+int update_array_info(struct mddev *mddev, mdu_array_info_t *info)
{
int rv = 0;
int cnt = 0;
@@ -8227,7 +8227,7 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info)
return rv;
}
-static int set_disk_faulty(struct mddev *mddev, dev_t dev)
+int set_disk_faulty(struct mddev *mddev, dev_t dev)
{
struct md_rdev *rdev;
int err = 0;
diff --git a/drivers/md/md.h b/drivers/md/md.h
index b6d2e8929a0f..cb8760521764 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -953,6 +953,7 @@ extern int mddev_init(struct mddev *mddev);
extern void mddev_destroy(struct mddev *mddev);
void md_init_stacking_limits(struct queue_limits *lim);
struct mddev *md_alloc(dev_t dev, char *name);
+extern struct mddev *mddev_get(struct mddev *mddev);
void mddev_put(struct mddev *mddev);
extern int md_run(struct mddev *mddev);
extern int md_start(struct mddev *mddev);
@@ -974,6 +975,10 @@ extern void mddev_destroy_serial_pool(struct mddev *mddev,
struct md_rdev *rdev);
struct md_rdev *md_find_rdev_nr_rcu(struct mddev *mddev, int nr);
struct md_rdev *md_find_rdev_rcu(struct mddev *mddev, dev_t dev);
+int update_array_info(struct mddev *mddev, mdu_array_info_t *info);
+
+extern struct list_head all_mddevs;
+extern spinlock_t all_mddevs_lock;
static inline bool is_rdev_broken(struct md_rdev *rdev)
{
--
2.43.0
next prev parent reply other threads:[~2026-09-28 20:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 20:12 [PATCH 0/2] md: add a control device for array management Abd-Alrhman Masalkhi
2026-09-28 20:12 ` Abd-Alrhman Masalkhi [this message]
2026-09-28 20:12 ` [PATCH 2/2] " Abd-Alrhman Masalkhi
2026-09-29 4:49 ` Greg KH
2026-09-29 7:12 ` Abd-Alrhman Masalkhi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260928201224.3602262-2-abd.masalkhi@gmail.com \
--to=abd.masalkhi@gmail.com \
--cc=agk@redhat.com \
--cc=arnd@arndb.de \
--cc=bmarzins@redhat.com \
--cc=chengzhihao1@huawei.com \
--cc=dm-devel@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=magiclinan@didiglobal.com \
--cc=mpatocka@redhat.com \
--cc=snitzer@kernel.org \
--cc=song@kernel.org \
--cc=xiao@kernel.org \
--cc=yukuai@fygo.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®