public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Fun with mdadm (Software RAID)
Date: Sun, 22 Dec 2024 13:08:10 +0000	[thread overview]
Message-ID: <Z2gPOjweATy3-9IF@MAC.fritz.box> (raw)
In-Reply-To: <Z2bz04_VYre6JVTF@MAC.fritz.box>

[-- Attachment #1: Type: text/plain, Size: 1168 bytes --]

Hello again!

On Sat, Dec 21, 2024 at 16:58:59 +0000, Alan Mackenzie wrote:
> Hello, Karl.

> On Sat, Dec 21, 2024 at 17:45:13 +0100, karl@aspodata.se wrote:
> > Alan Mackenzie:
> > ...
> > > I've now got working code which assembles a metadata 1.2 RAID array at
> > > boot time.  The syntax needed on the command line is, again,

> > >     md=124,1.2,/dev/nvme0n1p6,/dev/nvme1n1p6

> > > ..  In place of 1.2 can be any of 0.90, 1.0, 1.1, though I haven't tested
> > > it with anything but 1.2 as yet.
> > ...

> > Fun! Which kernel, can you send a patch ?

> 6.6.62.  Patch enclosed.  It should apply cleanly from the directory
> ..../drivers/md.

There was an error in yesterday's patch.  For some reason I can't
fathom, I'd started a loop with

    for (i = 1; ....)

in place of the correct

    for (i = 0; ....)

..  The consequence was that the driver would not recognise "0.90" when
given explicitly in the kernel command line, for example as

    md=126,0.90,/dev/nvme0n1p4,/dev/nvme1n1p4

..  Please use the enclosed patch in place of that patch from yesterday.

Thanks!

> Have fun!

> > Regards,
> > /Karl Hammar

-- 
Alan Mackenzie (Nuremberg, Germany).


[-- Attachment #2: diff.20241222.diff --]
[-- Type: text/plain, Size: 1473 bytes --]

diff --git a/drivers/md/md-autodetect.c b/drivers/md/md-autodetect.c
index b2a00f213c2c..6bd6e9177969 100644
--- a/drivers/md/md-autodetect.c
+++ b/drivers/md/md-autodetect.c
@@ -124,6 +124,17 @@ static void __init md_setup_drive(struct md_setup_args *args)
 	struct mddev *mddev;
 	int err = 0, i;
 	char name[16];
+	int major_version = 0, minor_version = 90;
+	char *pp;
+	static struct {
+		char *metadata;
+		int major_version;
+		int minor_version;
+	} metadata_table[] =
+		{{"0.90", 0, 90},
+		 {"1.0", 1, 0},
+		 {"1.1", 1, 1},
+		 {"1.2", 1, 2}};
 
 	if (args->partitioned) {
 		mdev = MKDEV(mdp_major, args->minor << MdpMinorShift);
@@ -133,6 +144,21 @@ static void __init md_setup_drive(struct md_setup_args *args)
 		sprintf(name, "md%d", args->minor);
 	}
 
+	pp = strchr(devname, ',');
+	if (pp)
+	{
+		*pp = 0;
+		for (i = 0; i < ARRAY_SIZE(metadata_table); i++)
+			if (!strcmp(devname, metadata_table[i].metadata))
+			{
+				major_version = metadata_table[i].major_version;
+				minor_version = metadata_table[i].minor_version;
+				devname = pp + 1;
+				break;
+			}
+		*pp = ',';
+	}
+
 	for (i = 0; i < MD_SB_DISKS && devname != NULL; i++) {
 		struct kstat stat;
 		char *p;
@@ -183,6 +209,8 @@ static void __init md_setup_drive(struct md_setup_args *args)
 		goto out_unlock;
 	}
 
+	ainfo.major_version = major_version;
+	ainfo.minor_version = minor_version;
 	if (args->level != LEVEL_NONE) {
 		/* non-persistent */
 		ainfo.level = args->level;

  reply	other threads:[~2024-12-22 13:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-20 10:47 [gentoo-user] Fun with mdadm (Software RAID) Alan Mackenzie
2024-12-20 14:50 ` karl
2024-12-20 15:28   ` Alan Mackenzie
2024-12-20 17:44     ` karl
2024-12-20 20:19       ` Alan Mackenzie
2024-12-20 20:38         ` Hoël Bézier
2024-12-20 20:53           ` Alan Mackenzie
2024-12-20 22:02         ` karl
2024-12-30  4:08           ` Frank Steinmetzger
2024-12-20 22:02         ` karl
2024-12-21 12:43           ` Alan Mackenzie
2024-12-21 16:36             ` Alan Mackenzie
2024-12-21 16:45               ` karl
2024-12-21 16:58                 ` Alan Mackenzie
2024-12-22 13:08                   ` Alan Mackenzie [this message]
2024-12-22 12:16             ` Wols Lists
2024-12-22 12:08         ` Wols Lists
2024-12-22 12:02       ` Wols Lists
2024-12-22 13:43         ` Alan Mackenzie
2024-12-22 15:29           ` Peter Humphrey
2024-12-22 16:53             ` Wols Lists
2024-12-22 20:05               ` Alan Mackenzie
2024-12-25 21:16                 ` Steven Lembark

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=Z2gPOjweATy3-9IF@MAC.fritz.box \
    --to=acm@muc.de \
    --cc=gentoo-user@lists.gentoo.org \
    /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