]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/md/dm-stripe.c
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux...
[linux-2.6-omap-h63xx.git] / drivers / md / dm-stripe.c
index 7c5e2a0c3f2d0b3b3b83706626a9a59ffcc73288..a2d068dbe9e2669dc25290a09e8918b4b5c2f28f 100644 (file)
@@ -4,7 +4,7 @@
  * This file is released under the GPL.
  */
 
-#include "dm.h"
+#include <linux/device-mapper.h>
 
 #include <linux/module.h>
 #include <linux/init.h>
@@ -60,8 +60,8 @@ static inline struct stripe_c *alloc_context(unsigned int stripes)
 {
        size_t len;
 
-       if (array_too_big(sizeof(struct stripe_c), sizeof(struct stripe),
-                         stripes))
+       if (dm_array_too_big(sizeof(struct stripe_c), sizeof(struct stripe),
+                            stripes))
                return NULL;
 
        len = sizeof(struct stripe_c) + (sizeof(struct stripe) * stripes);
@@ -222,16 +222,37 @@ static int stripe_map(struct dm_target *ti, struct bio *bio,
        return DM_MAPIO_REMAPPED;
 }
 
+/*
+ * Stripe status:
+ *
+ * INFO
+ * #stripes [stripe_name <stripe_name>] [group word count]
+ * [error count 'A|D' <error count 'A|D'>]
+ *
+ * TABLE
+ * #stripes [stripe chunk size]
+ * [stripe_name physical_start <stripe_name physical_start>]
+ *
+ */
+
 static int stripe_status(struct dm_target *ti,
                         status_type_t type, char *result, unsigned int maxlen)
 {
        struct stripe_c *sc = (struct stripe_c *) ti->private;
+       char buffer[sc->stripes + 1];
        unsigned int sz = 0;
        unsigned int i;
 
        switch (type) {
        case STATUSTYPE_INFO:
-               result[0] = '\0';
+               DMEMIT("%d ", sc->stripes);
+               for (i = 0; i < sc->stripes; i++)  {
+                       DMEMIT("%s ", sc->stripe[i].dev->name);
+                       buffer[i] = atomic_read(&(sc->stripe[i].error_count)) ?
+                               'D' : 'A';
+               }
+               buffer[i] = '\0';
+               DMEMIT("1 %s", buffer);
                break;
 
        case STATUSTYPE_TABLE:
@@ -263,8 +284,8 @@ static int stripe_end_io(struct dm_target *ti, struct bio *bio,
 
        memset(major_minor, 0, sizeof(major_minor));
        sprintf(major_minor, "%d:%d",
-               bio->bi_bdev->bd_disk->major,
-               bio->bi_bdev->bd_disk->first_minor);
+               MAJOR(disk_devt(bio->bi_bdev->bd_disk)),
+               MINOR(disk_devt(bio->bi_bdev->bd_disk)));
 
        /*
         * Test to see which stripe drive triggered the event