diff options
author | Brian Wood <brian.j.wood@intel.com> | 2008-02-07 21:11:24 -0500 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2008-02-07 21:11:24 -0500 |
commit | 4f7f5c675fd6bacaae3c67be44de872dcff0e3b7 (patch) | |
tree | 5825966577a4018047bc126922b1f815af905348 /drivers/md | |
parent | a25eb9446ad50027bc2082386e5358bedad087ed (diff) |
dm: stripe enhanced status return
This patch adds additional information to the status line. It is added at the
end of the returned text so it will not interfere with existing
implementations using this data. The addition of this information will allow
for a common return interface to match that returned with the dm-raid1.c
status line (with Jonathan Brassow's patches).
Here is a sample of what is returned with a mirror "status" call:
isw_eeaaabgfg_mirror: 0 488390920 mirror 2 8:16 8:32 3727/3727 1 AA 1 core
Here's what's returned with this patch for a stripe "status" call:
isw_dheeijjdej_stripe: 0 976783872 striped 2 8:16 8:32 1 AA
Signed-off-by: Brian Wood <brian.j.wood@intel.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-stripe.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index 7c5e2a0c3f2..4de90ab3968 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c | |||
@@ -222,16 +222,37 @@ static int stripe_map(struct dm_target *ti, struct bio *bio, | |||
222 | return DM_MAPIO_REMAPPED; | 222 | return DM_MAPIO_REMAPPED; |
223 | } | 223 | } |
224 | 224 | ||
225 | /* | ||
226 | * Stripe status: | ||
227 | * | ||
228 | * INFO | ||
229 | * #stripes [stripe_name <stripe_name>] [group word count] | ||
230 | * [error count 'A|D' <error count 'A|D'>] | ||
231 | * | ||
232 | * TABLE | ||
233 | * #stripes [stripe chunk size] | ||
234 | * [stripe_name physical_start <stripe_name physical_start>] | ||
235 | * | ||
236 | */ | ||
237 | |||
225 | static int stripe_status(struct dm_target *ti, | 238 | static int stripe_status(struct dm_target *ti, |
226 | status_type_t type, char *result, unsigned int maxlen) | 239 | status_type_t type, char *result, unsigned int maxlen) |
227 | { | 240 | { |
228 | struct stripe_c *sc = (struct stripe_c *) ti->private; | 241 | struct stripe_c *sc = (struct stripe_c *) ti->private; |
242 | char buffer[sc->stripes + 1]; | ||
229 | unsigned int sz = 0; | 243 | unsigned int sz = 0; |
230 | unsigned int i; | 244 | unsigned int i; |
231 | 245 | ||
232 | switch (type) { | 246 | switch (type) { |
233 | case STATUSTYPE_INFO: | 247 | case STATUSTYPE_INFO: |
234 | result[0] = '\0'; | 248 | DMEMIT("%d ", sc->stripes); |
249 | for (i = 0; i < sc->stripes; i++) { | ||
250 | DMEMIT("%s ", sc->stripe[i].dev->name); | ||
251 | buffer[i] = atomic_read(&(sc->stripe[i].error_count)) ? | ||
252 | 'D' : 'A'; | ||
253 | } | ||
254 | buffer[i] = '\0'; | ||
255 | DMEMIT("1 %s", buffer); | ||
235 | break; | 256 | break; |
236 | 257 | ||
237 | case STATUSTYPE_TABLE: | 258 | case STATUSTYPE_TABLE: |