aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid10.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-01-06 03:20:36 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:34:06 -0500
commit2604b703b6b3db80e3c75ce472a54dfd0b7bf9f4 (patch)
tree8c0e985c455ff35af24fbe60d8a3f5a276034370 /drivers/md/raid10.c
parenta24a8dd858e0ba50f06a9fd8f61fe8c4fe7a8d8e (diff)
[PATCH] md: remove personality numbering from md
md supports multiple different RAID level, each being implemented by a 'personality' (which is often in a separate module). These personalities have fairly artificial 'numbers'. The numbers are use to: 1- provide an index into an array where the various personalities are recorded 2- identify the module (via an alias) which implements are particular personality. Neither of these uses really justify the existence of personality numbers. The array can be replaced by a linked list which is searched (array lookup only happens very rarely). Module identification can be done using an alias based on level rather than 'personality' number. The current 'raid5' modules support two level (4 and 5) but only one personality. This slight awkwardness (which was handled in the mapping from level to personality) can be better handled by allowing raid5 to register 2 personalities. With this change in place, the core md module does not need to have an exhaustive list of all possible personalities, so other personalities can be added independently. This patch also moves the check for chunksize being non-zero into the ->run routines for the personalities that need it, rather than having it in core-md. This has a side effect of allowing 'faulty' and 'linear' not to have a chunk-size set. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r--drivers/md/raid10.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 253322ae9195..f23d52c5df94 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1883,11 +1883,11 @@ static int run(mddev_t *mddev)
1883 int nc, fc; 1883 int nc, fc;
1884 sector_t stride, size; 1884 sector_t stride, size;
1885 1885
1886 if (mddev->level != 10) { 1886 if (mddev->chunk_size == 0) {
1887 printk(KERN_ERR "raid10: %s: raid level not set correctly... (%d)\n", 1887 printk(KERN_ERR "md/raid10: non-zero chunk size required.\n");
1888 mdname(mddev), mddev->level); 1888 return -EINVAL;
1889 goto out;
1890 } 1889 }
1890
1891 nc = mddev->layout & 255; 1891 nc = mddev->layout & 255;
1892 fc = (mddev->layout >> 8) & 255; 1892 fc = (mddev->layout >> 8) & 255;
1893 if ((nc*fc) <2 || (nc*fc) > mddev->raid_disks || 1893 if ((nc*fc) <2 || (nc*fc) > mddev->raid_disks ||
@@ -2072,9 +2072,10 @@ static void raid10_quiesce(mddev_t *mddev, int state)
2072 } 2072 }
2073} 2073}
2074 2074
2075static mdk_personality_t raid10_personality = 2075static struct mdk_personality raid10_personality =
2076{ 2076{
2077 .name = "raid10", 2077 .name = "raid10",
2078 .level = 10,
2078 .owner = THIS_MODULE, 2079 .owner = THIS_MODULE,
2079 .make_request = make_request, 2080 .make_request = make_request,
2080 .run = run, 2081 .run = run,
@@ -2090,15 +2091,16 @@ static mdk_personality_t raid10_personality =
2090 2091
2091static int __init raid_init(void) 2092static int __init raid_init(void)
2092{ 2093{
2093 return register_md_personality(RAID10, &raid10_personality); 2094 return register_md_personality(&raid10_personality);
2094} 2095}
2095 2096
2096static void raid_exit(void) 2097static void raid_exit(void)
2097{ 2098{
2098 unregister_md_personality(RAID10); 2099 unregister_md_personality(&raid10_personality);
2099} 2100}
2100 2101
2101module_init(raid_init); 2102module_init(raid_init);
2102module_exit(raid_exit); 2103module_exit(raid_exit);
2103MODULE_LICENSE("GPL"); 2104MODULE_LICENSE("GPL");
2104MODULE_ALIAS("md-personality-9"); /* RAID10 */ 2105MODULE_ALIAS("md-personality-9"); /* RAID10 */
2106MODULE_ALIAS("md-level-10");