Hello, Karl.

On Sat, Dec 21, 2024 at 17:45:13 +0100, k...@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.

Have fun!

> Regards,
> /Karl Hammar

-- 
Alan Mackenzie (Nuremberg, Germany).

diff --git a/drivers/md/md-autodetect.c b/drivers/md/md-autodetect.c
index b2a00f213c2c..2cd347108284 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 = 1; 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 via email to