aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid0.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/raid0.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/raid0.c')
-rw-r--r--drivers/md/raid0.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index b4eaa67fabde..7fb69e29391b 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -275,7 +275,11 @@ static int raid0_run (mddev_t *mddev)
275 mdk_rdev_t *rdev; 275 mdk_rdev_t *rdev;
276 struct list_head *tmp; 276 struct list_head *tmp;
277 277
278 printk("%s: setting max_sectors to %d, segment boundary to %d\n", 278 if (mddev->chunk_size == 0) {
279 printk(KERN_ERR "md/raid0: non-zero chunk size required.\n");
280 return -EINVAL;
281 }
282 printk(KERN_INFO "%s: setting max_sectors to %d, segment boundary to %d\n",
279 mdname(mddev), 283 mdname(mddev),
280 mddev->chunk_size >> 9, 284 mddev->chunk_size >> 9,
281 (mddev->chunk_size>>1)-1); 285 (mddev->chunk_size>>1)-1);
@@ -507,9 +511,10 @@ static void raid0_status (struct seq_file *seq, mddev_t *mddev)
507 return; 511 return;
508} 512}
509 513
510static mdk_personality_t raid0_personality= 514static struct mdk_personality raid0_personality=
511{ 515{
512 .name = "raid0", 516 .name = "raid0",
517 .level = 0,
513 .owner = THIS_MODULE, 518 .owner = THIS_MODULE,
514 .make_request = raid0_make_request, 519 .make_request = raid0_make_request,
515 .run = raid0_run, 520 .run = raid0_run,
@@ -519,15 +524,16 @@ static mdk_personality_t raid0_personality=
519 524
520static int __init raid0_init (void) 525static int __init raid0_init (void)
521{ 526{
522 return register_md_personality (RAID0, &raid0_personality); 527 return register_md_personality (&raid0_personality);
523} 528}
524 529
525static void raid0_exit (void) 530static void raid0_exit (void)
526{ 531{
527 unregister_md_personality (RAID0); 532 unregister_md_personality (&raid0_personality);
528} 533}
529 534
530module_init(raid0_init); 535module_init(raid0_init);
531module_exit(raid0_exit); 536module_exit(raid0_exit);
532MODULE_LICENSE("GPL"); 537MODULE_LICENSE("GPL");
533MODULE_ALIAS("md-personality-2"); /* RAID0 */ 538MODULE_ALIAS("md-personality-2"); /* RAID0 */
539MODULE_ALIAS("md-level-0");