diff options
author | NeilBrown <neilb@suse.de> | 2006-01-06 03:20:36 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:34:06 -0500 |
commit | 2604b703b6b3db80e3c75ce472a54dfd0b7bf9f4 (patch) | |
tree | 8c0e985c455ff35af24fbe60d8a3f5a276034370 /drivers/md/faulty.c | |
parent | a24a8dd858e0ba50f06a9fd8f61fe8c4fe7a8d8e (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/faulty.c')
-rw-r--r-- | drivers/md/faulty.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c index 0248f8e7eac0..f12e83086897 100644 --- a/drivers/md/faulty.c +++ b/drivers/md/faulty.c | |||
@@ -316,9 +316,10 @@ static int stop(mddev_t *mddev) | |||
316 | return 0; | 316 | return 0; |
317 | } | 317 | } |
318 | 318 | ||
319 | static mdk_personality_t faulty_personality = | 319 | static struct mdk_personality faulty_personality = |
320 | { | 320 | { |
321 | .name = "faulty", | 321 | .name = "faulty", |
322 | .level = LEVEL_FAULTY, | ||
322 | .owner = THIS_MODULE, | 323 | .owner = THIS_MODULE, |
323 | .make_request = make_request, | 324 | .make_request = make_request, |
324 | .run = run, | 325 | .run = run, |
@@ -329,15 +330,16 @@ static mdk_personality_t faulty_personality = | |||
329 | 330 | ||
330 | static int __init raid_init(void) | 331 | static int __init raid_init(void) |
331 | { | 332 | { |
332 | return register_md_personality(FAULTY, &faulty_personality); | 333 | return register_md_personality(&faulty_personality); |
333 | } | 334 | } |
334 | 335 | ||
335 | static void raid_exit(void) | 336 | static void raid_exit(void) |
336 | { | 337 | { |
337 | unregister_md_personality(FAULTY); | 338 | unregister_md_personality(&faulty_personality); |
338 | } | 339 | } |
339 | 340 | ||
340 | module_init(raid_init); | 341 | module_init(raid_init); |
341 | module_exit(raid_exit); | 342 | module_exit(raid_exit); |
342 | MODULE_LICENSE("GPL"); | 343 | MODULE_LICENSE("GPL"); |
343 | MODULE_ALIAS("md-personality-10"); /* faulty */ | 344 | MODULE_ALIAS("md-personality-10"); /* faulty */ |
345 | MODULE_ALIAS("md-level--5"); | ||