diff options
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/faulty.c | 1 | ||||
-rw-r--r-- | drivers/md/linear.c | 3 | ||||
-rw-r--r-- | drivers/md/md.c | 61 | ||||
-rw-r--r-- | drivers/md/multipath.c | 1 | ||||
-rw-r--r-- | drivers/md/raid0.c | 1 | ||||
-rw-r--r-- | drivers/md/raid1.c | 1 | ||||
-rw-r--r-- | drivers/md/raid10.c | 1 | ||||
-rw-r--r-- | drivers/md/raid5.c | 2 | ||||
-rw-r--r-- | drivers/md/raid6main.c | 1 |
9 files changed, 58 insertions, 14 deletions
diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c index f12e83086897..a7a5ab554338 100644 --- a/drivers/md/faulty.c +++ b/drivers/md/faulty.c | |||
@@ -342,4 +342,5 @@ module_init(raid_init); | |||
342 | module_exit(raid_exit); | 342 | module_exit(raid_exit); |
343 | MODULE_LICENSE("GPL"); | 343 | MODULE_LICENSE("GPL"); |
344 | MODULE_ALIAS("md-personality-10"); /* faulty */ | 344 | MODULE_ALIAS("md-personality-10"); /* faulty */ |
345 | MODULE_ALIAS("md-faulty"); | ||
345 | MODULE_ALIAS("md-level--5"); | 346 | MODULE_ALIAS("md-level--5"); |
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 79dee8159217..777585458c85 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -376,5 +376,6 @@ static void linear_exit (void) | |||
376 | module_init(linear_init); | 376 | module_init(linear_init); |
377 | module_exit(linear_exit); | 377 | module_exit(linear_exit); |
378 | MODULE_LICENSE("GPL"); | 378 | MODULE_LICENSE("GPL"); |
379 | MODULE_ALIAS("md-personality-1"); /* LINEAR - degrecated*/ | 379 | MODULE_ALIAS("md-personality-1"); /* LINEAR - deprecated*/ |
380 | MODULE_ALIAS("md-linear"); | ||
380 | MODULE_ALIAS("md-level--1"); | 381 | MODULE_ALIAS("md-level--1"); |
diff --git a/drivers/md/md.c b/drivers/md/md.c index ecc0166ba779..594d8c312e6a 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -303,12 +303,15 @@ static mdk_rdev_t * find_rdev(mddev_t * mddev, dev_t dev) | |||
303 | return NULL; | 303 | return NULL; |
304 | } | 304 | } |
305 | 305 | ||
306 | static struct mdk_personality *find_pers(int level) | 306 | static struct mdk_personality *find_pers(int level, char *clevel) |
307 | { | 307 | { |
308 | struct mdk_personality *pers; | 308 | struct mdk_personality *pers; |
309 | list_for_each_entry(pers, &pers_list, list) | 309 | list_for_each_entry(pers, &pers_list, list) { |
310 | if (pers->level == level) | 310 | if (level != LEVEL_NONE && pers->level == level) |
311 | return pers; | 311 | return pers; |
312 | if (strcmp(pers->name, clevel)==0) | ||
313 | return pers; | ||
314 | } | ||
312 | return NULL; | 315 | return NULL; |
313 | } | 316 | } |
314 | 317 | ||
@@ -715,6 +718,7 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev) | |||
715 | mddev->ctime = sb->ctime; | 718 | mddev->ctime = sb->ctime; |
716 | mddev->utime = sb->utime; | 719 | mddev->utime = sb->utime; |
717 | mddev->level = sb->level; | 720 | mddev->level = sb->level; |
721 | mddev->clevel[0] = 0; | ||
718 | mddev->layout = sb->layout; | 722 | mddev->layout = sb->layout; |
719 | mddev->raid_disks = sb->raid_disks; | 723 | mddev->raid_disks = sb->raid_disks; |
720 | mddev->size = sb->size; | 724 | mddev->size = sb->size; |
@@ -1051,6 +1055,7 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1051 | mddev->ctime = le64_to_cpu(sb->ctime) & ((1ULL << 32)-1); | 1055 | mddev->ctime = le64_to_cpu(sb->ctime) & ((1ULL << 32)-1); |
1052 | mddev->utime = le64_to_cpu(sb->utime) & ((1ULL << 32)-1); | 1056 | mddev->utime = le64_to_cpu(sb->utime) & ((1ULL << 32)-1); |
1053 | mddev->level = le32_to_cpu(sb->level); | 1057 | mddev->level = le32_to_cpu(sb->level); |
1058 | mddev->clevel[0] = 0; | ||
1054 | mddev->layout = le32_to_cpu(sb->layout); | 1059 | mddev->layout = le32_to_cpu(sb->layout); |
1055 | mddev->raid_disks = le32_to_cpu(sb->raid_disks); | 1060 | mddev->raid_disks = le32_to_cpu(sb->raid_disks); |
1056 | mddev->size = le64_to_cpu(sb->size)/2; | 1061 | mddev->size = le64_to_cpu(sb->size)/2; |
@@ -1774,15 +1779,36 @@ static ssize_t | |||
1774 | level_show(mddev_t *mddev, char *page) | 1779 | level_show(mddev_t *mddev, char *page) |
1775 | { | 1780 | { |
1776 | struct mdk_personality *p = mddev->pers; | 1781 | struct mdk_personality *p = mddev->pers; |
1777 | if (p == NULL && mddev->raid_disks == 0) | 1782 | if (p) |
1778 | return 0; | ||
1779 | if (mddev->level >= 0) | ||
1780 | return sprintf(page, "raid%d\n", mddev->level); | ||
1781 | else | ||
1782 | return sprintf(page, "%s\n", p->name); | 1783 | return sprintf(page, "%s\n", p->name); |
1784 | else if (mddev->clevel[0]) | ||
1785 | return sprintf(page, "%s\n", mddev->clevel); | ||
1786 | else if (mddev->level != LEVEL_NONE) | ||
1787 | return sprintf(page, "%d\n", mddev->level); | ||
1788 | else | ||
1789 | return 0; | ||
1790 | } | ||
1791 | |||
1792 | static ssize_t | ||
1793 | level_store(mddev_t *mddev, const char *buf, size_t len) | ||
1794 | { | ||
1795 | int rv = len; | ||
1796 | if (mddev->pers) | ||
1797 | return -EBUSY; | ||
1798 | if (len == 0) | ||
1799 | return 0; | ||
1800 | if (len >= sizeof(mddev->clevel)) | ||
1801 | return -ENOSPC; | ||
1802 | strncpy(mddev->clevel, buf, len); | ||
1803 | if (mddev->clevel[len-1] == '\n') | ||
1804 | len--; | ||
1805 | mddev->clevel[len] = 0; | ||
1806 | mddev->level = LEVEL_NONE; | ||
1807 | return rv; | ||
1783 | } | 1808 | } |
1784 | 1809 | ||
1785 | static struct md_sysfs_entry md_level = __ATTR_RO(level); | 1810 | static struct md_sysfs_entry md_level = |
1811 | __ATTR(level, 0644, level_show, level_store); | ||
1786 | 1812 | ||
1787 | static ssize_t | 1813 | static ssize_t |
1788 | raid_disks_show(mddev_t *mddev, char *page) | 1814 | raid_disks_show(mddev_t *mddev, char *page) |
@@ -2158,7 +2184,10 @@ static int do_md_run(mddev_t * mddev) | |||
2158 | } | 2184 | } |
2159 | 2185 | ||
2160 | #ifdef CONFIG_KMOD | 2186 | #ifdef CONFIG_KMOD |
2161 | request_module("md-level-%d", mddev->level); | 2187 | if (mddev->level != LEVEL_NONE) |
2188 | request_module("md-level-%d", mddev->level); | ||
2189 | else if (mddev->clevel[0]) | ||
2190 | request_module("md-%s", mddev->clevel); | ||
2162 | #endif | 2191 | #endif |
2163 | 2192 | ||
2164 | /* | 2193 | /* |
@@ -2180,15 +2209,21 @@ static int do_md_run(mddev_t * mddev) | |||
2180 | return -ENOMEM; | 2209 | return -ENOMEM; |
2181 | 2210 | ||
2182 | spin_lock(&pers_lock); | 2211 | spin_lock(&pers_lock); |
2183 | pers = find_pers(mddev->level); | 2212 | pers = find_pers(mddev->level, mddev->clevel); |
2184 | if (!pers || !try_module_get(pers->owner)) { | 2213 | if (!pers || !try_module_get(pers->owner)) { |
2185 | spin_unlock(&pers_lock); | 2214 | spin_unlock(&pers_lock); |
2186 | printk(KERN_WARNING "md: personality for level %d is not loaded!\n", | 2215 | if (mddev->level != LEVEL_NONE) |
2187 | mddev->level); | 2216 | printk(KERN_WARNING "md: personality for level %d is not loaded!\n", |
2217 | mddev->level); | ||
2218 | else | ||
2219 | printk(KERN_WARNING "md: personality for level %s is not loaded!\n", | ||
2220 | mddev->clevel); | ||
2188 | return -EINVAL; | 2221 | return -EINVAL; |
2189 | } | 2222 | } |
2190 | mddev->pers = pers; | 2223 | mddev->pers = pers; |
2191 | spin_unlock(&pers_lock); | 2224 | spin_unlock(&pers_lock); |
2225 | mddev->level = pers->level; | ||
2226 | strlcpy(mddev->clevel, pers->name, sizeof(mddev->clevel)); | ||
2192 | 2227 | ||
2193 | mddev->recovery = 0; | 2228 | mddev->recovery = 0; |
2194 | mddev->resync_max_sectors = mddev->size << 1; /* may be over-ridden by personality */ | 2229 | mddev->resync_max_sectors = mddev->size << 1; /* may be over-ridden by personality */ |
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index d4d838e3f9f8..e6aa309a66d7 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -578,4 +578,5 @@ module_init(multipath_init); | |||
578 | module_exit(multipath_exit); | 578 | module_exit(multipath_exit); |
579 | MODULE_LICENSE("GPL"); | 579 | MODULE_LICENSE("GPL"); |
580 | MODULE_ALIAS("md-personality-7"); /* MULTIPATH */ | 580 | MODULE_ALIAS("md-personality-7"); /* MULTIPATH */ |
581 | MODULE_ALIAS("md-multipath"); | ||
581 | MODULE_ALIAS("md-level--4"); | 582 | MODULE_ALIAS("md-level--4"); |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 7fb69e29391b..abbca150202b 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -536,4 +536,5 @@ module_init(raid0_init); | |||
536 | module_exit(raid0_exit); | 536 | module_exit(raid0_exit); |
537 | MODULE_LICENSE("GPL"); | 537 | MODULE_LICENSE("GPL"); |
538 | MODULE_ALIAS("md-personality-2"); /* RAID0 */ | 538 | MODULE_ALIAS("md-personality-2"); /* RAID0 */ |
539 | MODULE_ALIAS("md-raid0"); | ||
539 | MODULE_ALIAS("md-level-0"); | 540 | MODULE_ALIAS("md-level-0"); |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 7d4465f93064..181c9616d5f1 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -2092,4 +2092,5 @@ module_init(raid_init); | |||
2092 | module_exit(raid_exit); | 2092 | module_exit(raid_exit); |
2093 | MODULE_LICENSE("GPL"); | 2093 | MODULE_LICENSE("GPL"); |
2094 | MODULE_ALIAS("md-personality-3"); /* RAID1 */ | 2094 | MODULE_ALIAS("md-personality-3"); /* RAID1 */ |
2095 | MODULE_ALIAS("md-raid1"); | ||
2095 | MODULE_ALIAS("md-level-1"); | 2096 | MODULE_ALIAS("md-level-1"); |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 8e6f6dfddb2b..201dc7168a5f 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -2117,4 +2117,5 @@ module_init(raid_init); | |||
2117 | module_exit(raid_exit); | 2117 | module_exit(raid_exit); |
2118 | MODULE_LICENSE("GPL"); | 2118 | MODULE_LICENSE("GPL"); |
2119 | MODULE_ALIAS("md-personality-9"); /* RAID10 */ | 2119 | MODULE_ALIAS("md-personality-9"); /* RAID10 */ |
2120 | MODULE_ALIAS("md-raid10"); | ||
2120 | MODULE_ALIAS("md-level-10"); | 2121 | MODULE_ALIAS("md-level-10"); |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index b0cfd3ca9ca0..9cc844f455bf 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -2240,5 +2240,7 @@ module_init(raid5_init); | |||
2240 | module_exit(raid5_exit); | 2240 | module_exit(raid5_exit); |
2241 | MODULE_LICENSE("GPL"); | 2241 | MODULE_LICENSE("GPL"); |
2242 | MODULE_ALIAS("md-personality-4"); /* RAID5 */ | 2242 | MODULE_ALIAS("md-personality-4"); /* RAID5 */ |
2243 | MODULE_ALIAS("md-raid5"); | ||
2244 | MODULE_ALIAS("md-raid4"); | ||
2243 | MODULE_ALIAS("md-level-5"); | 2245 | MODULE_ALIAS("md-level-5"); |
2244 | MODULE_ALIAS("md-level-4"); | 2246 | MODULE_ALIAS("md-level-4"); |
diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c index 06b32bd671a3..84dd875bb2f6 100644 --- a/drivers/md/raid6main.c +++ b/drivers/md/raid6main.c | |||
@@ -2341,4 +2341,5 @@ module_init(raid6_init); | |||
2341 | module_exit(raid6_exit); | 2341 | module_exit(raid6_exit); |
2342 | MODULE_LICENSE("GPL"); | 2342 | MODULE_LICENSE("GPL"); |
2343 | MODULE_ALIAS("md-personality-8"); /* RAID6 */ | 2343 | MODULE_ALIAS("md-personality-8"); /* RAID6 */ |
2344 | MODULE_ALIAS("md-raid6"); | ||
2344 | MODULE_ALIAS("md-level-6"); | 2345 | MODULE_ALIAS("md-level-6"); |