]> err.no Git - linux-2.6/blobdiff - drivers/md/dm-snap.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
[linux-2.6] / drivers / md / dm-snap.c
index 14bd1a1815b1b4792f3933bdcc0486b57cecb2ec..8eea0ddbf5ec7dad5d4b012bd251dfeca83cd286 100644 (file)
@@ -23,6 +23,8 @@
 #include "dm-bio-list.h"
 #include "kcopyd.h"
 
+#define DM_MSG_PREFIX "snapshots"
+
 /*
  * The percentage increment we will wake up users at
  */
@@ -117,7 +119,7 @@ static int init_origin_hash(void)
        _origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head),
                           GFP_KERNEL);
        if (!_origins) {
-               DMERR("Device mapper: Snapshot: unable to allocate memory");
+               DMERR("unable to allocate memory");
                return -ENOMEM;
        }
 
@@ -412,7 +414,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        int blocksize;
 
        if (argc < 4) {
-               ti->error = "dm-snapshot: requires exactly 4 arguments";
+               ti->error = "requires exactly 4 arguments";
                r = -EINVAL;
                goto bad1;
        }
@@ -530,7 +532,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        }
 
        ti->private = s;
-       ti->split_io = chunk_size;
+       ti->split_io = s->chunk_size;
 
        return 0;
 
@@ -559,8 +561,12 @@ static void snapshot_dtr(struct dm_target *ti)
 {
        struct dm_snapshot *s = (struct dm_snapshot *) ti->private;
 
+       /* Prevent further origin writes from using this snapshot. */
+       /* After this returns there can be no new kcopyd jobs. */
        unregister_snapshot(s);
 
+       kcopyd_client_destroy(s->kcopyd_client);
+
        exit_exception_table(&s->pending, pending_cache);
        exit_exception_table(&s->complete, exception_cache);
 
@@ -569,7 +575,7 @@ static void snapshot_dtr(struct dm_target *ti)
 
        dm_put_device(ti, s->origin);
        dm_put_device(ti, s->cow);
-       kcopyd_client_destroy(s->kcopyd_client);
+
        kfree(s);
 }
 
@@ -959,9 +965,9 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
                                snap->store.fraction_full(&snap->store,
                                                          &numerator,
                                                          &denominator);
-                               snprintf(result, maxlen,
-                                        SECTOR_FORMAT "/" SECTOR_FORMAT,
-                                        numerator, denominator);
+                               snprintf(result, maxlen, "%llu/%llu",
+                                       (unsigned long long)numerator,
+                                       (unsigned long long)denominator);
                        }
                        else
                                snprintf(result, maxlen, "Unknown");
@@ -974,9 +980,10 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
                 * to make private copies if the output is to
                 * make sense.
                 */
-               snprintf(result, maxlen, "%s %s %c " SECTOR_FORMAT,
+               snprintf(result, maxlen, "%s %s %c %llu",
                         snap->origin->name, snap->cow->name,
-                        snap->type, snap->chunk_size);
+                        snap->type,
+                        (unsigned long long)snap->chunk_size);
                break;
        }
 
@@ -1122,7 +1129,7 @@ static int origin_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        struct dm_dev *dev;
 
        if (argc != 1) {
-               ti->error = "dm-origin: incorrect number of arguments";
+               ti->error = "origin: incorrect number of arguments";
                return -EINVAL;
        }
 
@@ -1199,7 +1206,7 @@ static int origin_status(struct dm_target *ti, status_type_t type, char *result,
 
 static struct target_type origin_target = {
        .name    = "snapshot-origin",
-       .version = {1, 1, 0},
+       .version = {1, 4, 0},
        .module  = THIS_MODULE,
        .ctr     = origin_ctr,
        .dtr     = origin_dtr,
@@ -1210,7 +1217,7 @@ static struct target_type origin_target = {
 
 static struct target_type snapshot_target = {
        .name    = "snapshot",
-       .version = {1, 1, 0},
+       .version = {1, 4, 0},
        .module  = THIS_MODULE,
        .ctr     = snapshot_ctr,
        .dtr     = snapshot_dtr,
@@ -1231,7 +1238,7 @@ static int __init dm_snapshot_init(void)
 
        r = dm_register_target(&origin_target);
        if (r < 0) {
-               DMERR("Device mapper: Origin: register failed %d\n", r);
+               DMERR("Origin target register failed %d", r);
                goto bad1;
        }