linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / md / dm-stripe.c
index 6c29fce..697aaca 100644 (file)
@@ -12,8 +12,6 @@
 #include <linux/bio.h>
 #include <linux/slab.h>
 
-#define DM_MSG_PREFIX "striped"
-
 struct stripe {
        struct dm_dev *dev;
        sector_t physical_start;
@@ -51,9 +49,9 @@ static inline struct stripe_c *alloc_context(unsigned int stripes)
 static int get_stripe(struct dm_target *ti, struct stripe_c *sc,
                      unsigned int stripe, char **argv)
 {
-       unsigned long long start;
+       sector_t start;
 
-       if (sscanf(argv[1], "%llu", &start) != 1)
+       if (sscanf(argv[1], SECTOR_FORMAT, &start) != 1)
                return -EINVAL;
 
        if (dm_get_device(ti, argv[0], start, sc->stripe_width,
@@ -80,19 +78,19 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        unsigned int i;
 
        if (argc < 2) {
-               ti->error = "Not enough arguments";
+               ti->error = "dm-stripe: Not enough arguments";
                return -EINVAL;
        }
 
        stripes = simple_strtoul(argv[0], &end, 10);
        if (*end) {
-               ti->error = "Invalid stripe count";
+               ti->error = "dm-stripe: Invalid stripe count";
                return -EINVAL;
        }
 
        chunk_size = simple_strtoul(argv[1], &end, 10);
        if (*end) {
-               ti->error = "Invalid chunk_size";
+               ti->error = "dm-stripe: Invalid chunk_size";
                return -EINVAL;
        }
 
@@ -101,19 +99,19 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
         */
        if (!chunk_size || (chunk_size & (chunk_size - 1)) ||
            (chunk_size < (PAGE_SIZE >> SECTOR_SHIFT))) {
-               ti->error = "Invalid chunk size";
+               ti->error = "dm-stripe: Invalid chunk size";
                return -EINVAL;
        }
 
-       if (ti->len & (chunk_size - 1)) {
-               ti->error = "Target length not divisible by "
+       if (((uint32_t)ti->len) & (chunk_size - 1)) {
+               ti->error = "dm-stripe: Target length not divisible by "
                    "chunk size";
                return -EINVAL;
        }
 
        width = ti->len;
        if (sector_div(width, stripes)) {
-               ti->error = "Target length not divisible by "
+               ti->error = "dm-stripe: Target length not divisible by "
                    "number of stripes";
                return -EINVAL;
        }
@@ -122,14 +120,14 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
         * Do we have enough arguments for that many stripes ?
         */
        if (argc != (2 + 2 * stripes)) {
-               ti->error = "Not enough destinations "
+               ti->error = "dm-stripe: Not enough destinations "
                        "specified";
                return -EINVAL;
        }
 
        sc = alloc_context(stripes);
        if (!sc) {
-               ti->error = "Memory allocation for striped context "
+               ti->error = "dm-stripe: Memory allocation for striped context "
                    "failed";
                return -ENOMEM;
        }
@@ -151,7 +149,8 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 
                r = get_stripe(ti, sc, i, argv);
                if (r < 0) {
-                       ti->error = "Couldn't parse stripe destination";
+                       ti->error = "dm-stripe: Couldn't parse stripe "
+                               "destination";
                        while (i--)
                                dm_put_device(ti, sc->stripe[i].dev);
                        kfree(sc);
@@ -202,11 +201,10 @@ static int stripe_status(struct dm_target *ti,
                break;
 
        case STATUSTYPE_TABLE:
-               DMEMIT("%d %llu", sc->stripes,
-                       (unsigned long long)sc->chunk_mask + 1);
+               DMEMIT("%d " SECTOR_FORMAT, sc->stripes, sc->chunk_mask + 1);
                for (i = 0; i < sc->stripes; i++)
-                       DMEMIT(" %s %llu", sc->stripe[i].dev->name,
-                           (unsigned long long)sc->stripe[i].physical_start);
+                       DMEMIT(" %s " SECTOR_FORMAT, sc->stripe[i].dev->name,
+                              sc->stripe[i].physical_start);
                break;
        }
        return 0;
@@ -228,7 +226,7 @@ int __init dm_stripe_init(void)
 
        r = dm_register_target(&stripe_target);
        if (r < 0)
-               DMWARN("target registration failed");
+               DMWARN("striped target registration failed");
 
        return r;
 }
@@ -236,7 +234,7 @@ int __init dm_stripe_init(void)
 void dm_stripe_exit(void)
 {
        if (dm_unregister_target(&stripe_target))
-               DMWARN("target unregistration failed");
+               DMWARN("striped target unregistration failed");
 
        return;
 }