From: "Masalkhi, Abd Alrhman" <abd.masalkhi@gatech.edu>
To: "song@kernel.org" <song@kernel.org>,
"yukuai@fygo.io" <yukuai@fygo.io>,
"chengzhihao1@huawei.com" <chengzhihao1@huawei.com>,
"magiclinan@didiglobal.com" <magiclinan@didiglobal.com>,
"xiao@kernel.org" <xiao@kernel.org>
Cc: "linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Masalkhi, Abd Alrhman" <abd.masalkhi@gatech.edu>
Subject: [RFC PATCH v3 2/4] md: pass struct mdu_disk_info64 to md_add_new_disk()
Date: Wed, 7 Oct 2026 11:51:56 +0000 [thread overview]
Message-ID: <20261007115104.13884-3-abd.masalkhi@gatech.edu> (raw)
In-Reply-To: <20261007115104.13884-1-abd.masalkhi@gatech.edu>
From: Abd-Alrhman Masalkhi <abd.masalkhi@gatech.edu>
The md control device passes disk information as struct mdu_disk_info64.
Make md_add_new_disk() take this structure, so that the control device
and the old ADD_NEW_DISK ioctl can share it.
The ADD_NEW_DISK ioctl converts its mdu_disk_info_t with the new helper
convert_to_disk_info64(), and md_setup_drive() uses a struct
mdu_disk_info64 directly.
No functional change.
Signed-off-by: Abd-Alrhman Masalkhi <abd.masalkhi@gatech.edu>
---
drivers/md/md-autodetect.c | 2 +-
drivers/md/md.c | 26 +++++++++++++++++++++-----
drivers/md/md.h | 4 ++--
3 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/drivers/md/md-autodetect.c b/drivers/md/md-autodetect.c
index 4b80165afd23..9ba061f1a628 100644
--- a/drivers/md/md-autodetect.c
+++ b/drivers/md/md-autodetect.c
@@ -201,7 +201,7 @@ static void __init md_setup_drive(struct md_setup_args *args)
err = md_set_array_info(mddev, &ainfo);
for (i = 0; i <= MD_SB_DISKS && devices[i]; i++) {
- struct mdu_disk_info_s dinfo = {
+ struct mdu_disk_info64 dinfo = {
.major = MAJOR(devices[i]),
.minor = MINOR(devices[i]),
};
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 154ee5a65cb7..be1634ae1d09 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7486,7 +7486,7 @@ static int get_disk_info(struct mddev *mddev, void __user * arg)
return 0;
}
-int md_add_new_disk(struct mddev *mddev, struct mdu_disk_info_s *info)
+int md_add_new_disk(struct mddev *mddev, struct mdu_disk_info64 *info)
{
struct md_rdev *rdev;
dev_t dev = MKDEV(info->major,info->minor);
@@ -8305,6 +8305,16 @@ static bool md_ioctl_need_suspend(unsigned int cmd)
}
}
+static void convert_to_disk_info64(struct mdu_disk_info64 *info64,
+ mdu_disk_info_t *info)
+{
+ info64->number = info->number;
+ info64->major = info->major;
+ info64->minor = info->minor;
+ info64->raid_disk = info->raid_disk;
+ info64->state = info->state;
+}
+
static int __md_set_array_info(struct mddev *mddev, void __user *argp)
{
mdu_array_info_t info;
@@ -8452,13 +8462,16 @@ static int md_ioctl(struct block_device *bdev, blk_mode_t mode,
*/
if (mddev->pers) {
mdu_disk_info_t info;
+ struct mdu_disk_info64 info64 = {0};
if (copy_from_user(&info, argp, sizeof(info)))
err = -EFAULT;
else if (!(info.state & (1<<MD_DISK_SYNC)))
/* Need to clear read-only for this */
break;
- else
- err = md_add_new_disk(mddev, &info);
+ else {
+ convert_to_disk_info64(&info64, &info);
+ err = md_add_new_disk(mddev, &info64);
+ }
goto unlock;
}
break;
@@ -8493,10 +8506,13 @@ static int md_ioctl(struct block_device *bdev, blk_mode_t mode,
case ADD_NEW_DISK:
{
mdu_disk_info_t info;
+ struct mdu_disk_info64 info64 = {0};
if (copy_from_user(&info, argp, sizeof(info)))
err = -EFAULT;
- else
- err = md_add_new_disk(mddev, &info);
+ else {
+ convert_to_disk_info64(&info64, &info);
+ err = md_add_new_disk(mddev, &info64);
+ }
goto unlock;
}
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 6440da292105..a84c8b97fa2c 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -1043,12 +1043,12 @@ static inline void mddev_unlock_and_resume(struct mddev *mddev)
}
struct mdu_array_info_s;
-struct mdu_disk_info_s;
+struct mdu_disk_info64;
extern int mdp_major;
void md_autostart_arrays(int part);
int md_set_array_info(struct mddev *mddev, struct mdu_array_info_s *info);
-int md_add_new_disk(struct mddev *mddev, struct mdu_disk_info_s *info);
+int md_add_new_disk(struct mddev *mddev, struct mdu_disk_info64 *info);
int do_md_run(struct mddev *mddev);
#define MDDEV_STACK_INTEGRITY (1u << 0)
int mddev_stack_rdev_limits(struct mddev *mddev, struct queue_limits *lim,
--
2.43.0
next prev parent reply other threads:[~2026-10-07 11:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 11:51 [RFC PATCH v3 0/4] md: add a control device for array management Masalkhi, Abd Alrhman
2026-10-07 11:51 ` [RFC PATCH v3 1/4] md: add uapi definitions for the md control device Masalkhi, Abd Alrhman
2026-10-07 11:51 ` Masalkhi, Abd Alrhman [this message]
2026-10-07 12:08 ` [RFC PATCH v3 2/4] md: pass struct mdu_disk_info64 to md_add_new_disk() sashiko-bot
2026-10-07 11:52 ` [RFC PATCH v3 3/4] md: use struct mdu_array_info64 for SET_ARRAY_INFO Masalkhi, Abd Alrhman
2026-10-07 12:01 ` sashiko-bot
2026-10-07 11:52 ` [RFC PATCH v3 4/4] md: add a control device for array management Masalkhi, Abd Alrhman
2026-10-07 12:09 ` sashiko-bot
2026-10-07 18:09 ` Masalkhi, Abd Alrhman
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=20261007115104.13884-3-abd.masalkhi@gatech.edu \
--to=abd.masalkhi@gatech.edu \
--cc=chengzhihao1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=magiclinan@didiglobal.com \
--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