What is the purpose of the structure mddev in md.c?

303 Views Asked by At

I am pretty new to Linux kernel programming and I am supposed to create a new RAID level for a course. This is why I am asking myself some questions about the functions and structures contained in the md.c file and especially about the structure mddev defined here. As you can see there are nearly no comments about the structure in itself. I simply do not understand what is the main role of that and what is the big difference with md_personality? Both seem to define the RAID functionality.

1

There are 1 best solutions below

1
pratik On

As per my understanding, whenever you create any new RAID device using mdadm utility with certain RAID level, MD layer creates mddev structure which holds information related to that newly created device like major-minor number for newly created device, max devices allowed etc.

md_personality is related to raid level you have given in mdadm. It contains RAID level and supported operations which can be performed on RAID device. md_personality is itself part of mddev.

In your case, I think you need to create new personality for your own purpose just like other personalities, i.e. raid5_personality for RAID 5 level.