From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2BCD01580FD for ; Sun, 22 Dec 2024 13:08:21 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CE1AEE089F; Sun, 22 Dec 2024 13:08:13 +0000 (UTC) Received: from mail.muc.de (mail.muc.de [193.149.48.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E8C70E07C7 for ; Sun, 22 Dec 2024 13:08:12 +0000 (UTC) Received: (qmail 494 invoked by uid 3782); 22 Dec 2024 14:08:10 +0100 Received: from muc.de (p4fe15530.dip0.t-ipconnect.de [79.225.85.48]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 22 Dec 2024 14:08:10 +0100 Received: (qmail 15513 invoked by uid 1000); 22 Dec 2024 13:08:10 -0000 Date: Sun, 22 Dec 2024 13:08:10 +0000 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Fun with mdadm (Software RAID) Message-ID: References: <20241220145053.B361C85A435A@turkos.aspodata.se> <20241220174453.4E33285A435A@turkos.aspodata.se> <20241220220258.7422F85A435A@turkos.aspodata.se> <20241221164513.D4EF385A4946@turkos.aspodata.se> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="0DxtxlVJ/7ZJOaVT" Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Archives-Salt: 48bc64c7-90d8-4c49-b0b1-90cbe6739959 X-Archives-Hash: 4dbde323be0dee1f43ae4084d3eca3e4 --0DxtxlVJ/7ZJOaVT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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). --0DxtxlVJ/7ZJOaVT Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="diff.20241222.diff" 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; --0DxtxlVJ/7ZJOaVT--