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/raid5.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/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 6e4db95cebb1..b0cfd3ca9ca0 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -2187,9 +2187,10 @@ static void raid5_quiesce(mddev_t *mddev, int state) | |||
2187 | } | 2187 | } |
2188 | } | 2188 | } |
2189 | 2189 | ||
2190 | static mdk_personality_t raid5_personality= | 2190 | static struct mdk_personality raid5_personality = |
2191 | { | 2191 | { |
2192 | .name = "raid5", | 2192 | .name = "raid5", |
2193 | .level = 5, | ||
2193 | .owner = THIS_MODULE, | 2194 | .owner = THIS_MODULE, |
2194 | .make_request = make_request, | 2195 | .make_request = make_request, |
2195 | .run = run, | 2196 | .run = run, |
@@ -2204,17 +2205,40 @@ static mdk_personality_t raid5_personality= | |||
2204 | .quiesce = raid5_quiesce, | 2205 | .quiesce = raid5_quiesce, |
2205 | }; | 2206 | }; |
2206 | 2207 | ||
2207 | static int __init raid5_init (void) | 2208 | static struct mdk_personality raid4_personality = |
2208 | { | 2209 | { |
2209 | return register_md_personality (RAID5, &raid5_personality); | 2210 | .name = "raid4", |
2211 | .level = 4, | ||
2212 | .owner = THIS_MODULE, | ||
2213 | .make_request = make_request, | ||
2214 | .run = run, | ||
2215 | .stop = stop, | ||
2216 | .status = status, | ||
2217 | .error_handler = error, | ||
2218 | .hot_add_disk = raid5_add_disk, | ||
2219 | .hot_remove_disk= raid5_remove_disk, | ||
2220 | .spare_active = raid5_spare_active, | ||
2221 | .sync_request = sync_request, | ||
2222 | .resize = raid5_resize, | ||
2223 | .quiesce = raid5_quiesce, | ||
2224 | }; | ||
2225 | |||
2226 | static int __init raid5_init(void) | ||
2227 | { | ||
2228 | register_md_personality(&raid5_personality); | ||
2229 | register_md_personality(&raid4_personality); | ||
2230 | return 0; | ||
2210 | } | 2231 | } |
2211 | 2232 | ||
2212 | static void raid5_exit (void) | 2233 | static void raid5_exit(void) |
2213 | { | 2234 | { |
2214 | unregister_md_personality (RAID5); | 2235 | unregister_md_personality(&raid5_personality); |
2236 | unregister_md_personality(&raid4_personality); | ||
2215 | } | 2237 | } |
2216 | 2238 | ||
2217 | module_init(raid5_init); | 2239 | module_init(raid5_init); |
2218 | module_exit(raid5_exit); | 2240 | module_exit(raid5_exit); |
2219 | MODULE_LICENSE("GPL"); | 2241 | MODULE_LICENSE("GPL"); |
2220 | MODULE_ALIAS("md-personality-4"); /* RAID5 */ | 2242 | MODULE_ALIAS("md-personality-4"); /* RAID5 */ |
2243 | MODULE_ALIAS("md-level-5"); | ||
2244 | MODULE_ALIAS("md-level-4"); | ||