]> sourceware.org Git - dm.git/commitdiff
Get rid of \n at the end of DMERR & friends because they are already provided.
authorPatrick Caulfield <pcaulfie@redhat.com>
Fri, 8 Feb 2002 14:34:12 +0000 (14:34 +0000)
committerPatrick Caulfield <pcaulfie@redhat.com>
Fri, 8 Feb 2002 14:34:12 +0000 (14:34 +0000)
kernel/common/dm-mirror.c
kernel/common/dm-origin.c
kernel/common/dm-snapshot.c
kernel/common/kcopyd.c

index 404127afeb79d2d14ae1c08a8e83ad43c05ec999..0e89f511702711f762b21b4c1886487126cc00fa 100644 (file)
@@ -38,7 +38,7 @@ static void mirror_end_io(struct buffer_head *bh, int uptodate)
 
        /* Flag error if it failed */
        if (!uptodate) {
-               DMERR("Mirror copy to %s failed\n", kdevname(lc->todev->dev));
+               DMERR("Mirror copy to %s failed", kdevname(lc->todev->dev));
                lc->error = 1;
                dm_notify(lc); /* TODO: interface ?? */
        }
@@ -51,7 +51,6 @@ static void copy_callback(copy_cb_reason_t reason, void *context, long arg)
 {
        struct mirror_c *lc = (struct mirror_c *) context;
 
-       printk("PJC: callback: reason %d, block = %ld\n", reason, arg);
        if (reason == COPY_CB_PROGRESS) {
                lc->got_to = arg;
                return;
@@ -59,7 +58,7 @@ static void copy_callback(copy_cb_reason_t reason, void *context, long arg)
 
        if (reason == COPY_CB_FAILED_READ ||
            reason == COPY_CB_FAILED_WRITE) {
-               DMERR("Mirror block %s on %s failed, sector %ld\n", reason==COPY_CB_FAILED_READ?"read":"write",
+               DMERR("Mirror block %s on %s failed, sector %ld", reason==COPY_CB_FAILED_READ?"read":"write",
                      reason==COPY_CB_FAILED_READ?kdevname(lc->fromdev->dev):kdevname(lc->todev->dev), arg);
                lc->error = 1;
        }
@@ -71,7 +70,7 @@ static void copy_callback(copy_cb_reason_t reason, void *context, long arg)
 }
 
 /*
- * Construct a mirror mapping: <dev_path1> <offset> <dev_path2> <offset>
+ * Construct a mirror mapping: <dev_path1> <offset> <dev_path2> <offset> <throttle> [<priority>]
  */
 static int mirror_ctr(struct dm_table *t, offset_t b, offset_t l,
                      int argc, char **argv, void **context)
@@ -79,8 +78,10 @@ static int mirror_ctr(struct dm_table *t, offset_t b, offset_t l,
        struct mirror_c *lc;
        unsigned long offset1, offset2;
        char *value;
+       int priority = MIRROR_COPY_PRIORITY;
+       int throttle;
 
-       if (argc != 4) {
+       if (argc <= 4) {
                *context = "dm-mirror: Not enough arguments";
                return -EINVAL;
        }
@@ -99,18 +100,34 @@ static int mirror_ctr(struct dm_table *t, offset_t b, offset_t l,
        offset1 = simple_strtoul(argv[1], &value, 10);
        if (value == NULL) {
                *context = "Invalid offset for dev1";
+               dm_table_put_device(t, lc->fromdev);
                goto bad;
        }
 
        if (dm_table_get_device(t, argv[2], 0, l, &lc->todev)) {
                *context = "dm-mirror: Device lookup failed";
+               dm_table_put_device(t, lc->fromdev);
                goto bad;
        }
 
        offset2 = simple_strtoul(argv[3], &value, 10);
        if (value == NULL) {
                *context = "Invalid offset for dev2";
-               goto bad;
+               goto bad_put;
+       }
+
+       throttle = simple_strtoul(argv[4], &value, 10);
+       if (value == NULL) {
+               *context = "Invalid throttle value";
+               goto bad_put;
+       }
+
+       if (argc > 4) {
+               priority = simple_strtoul(argv[5], &value, 10);
+               if (value == NULL) {
+                       *context = "Invalid priority value";
+                       goto bad_put;
+               }
        }
 
        lc->from_delta = (int) offset1 - (int) b;
@@ -121,17 +138,21 @@ static int mirror_ctr(struct dm_table *t, offset_t b, offset_t l,
        init_rwsem(&lc->lock);
        *context = lc;
 
+       /* Tell kcopyd to do the biz */
        if (dm_blockcopy(offset1, offset2,
                         l - offset1,
                         lc->fromdev->dev, lc->todev->dev,
-                        MIRROR_COPY_PRIORITY, 0, copy_callback, lc)) {
-               DMERR("block copy call failed\n");
+                        priority, 0, copy_callback, lc)) {
+               DMERR("block copy call failed");
                dm_table_put_device(t, lc->fromdev);
                dm_table_put_device(t, lc->todev);
                goto bad;
        }
        return 0;
 
+ bad_put:
+       dm_table_put_device(t, lc->fromdev);
+       dm_table_put_device(t, lc->todev);
  bad:
        kfree(lc);
        return -EINVAL;
@@ -171,7 +192,7 @@ static int mirror_map(struct buffer_head *bh, int rw, void *context)
                        generic_make_request(WRITE, dbh);
                }
                else {
-                       DMERR("kmalloc failed for mirror bh\n");
+                       DMERR("kmalloc failed for mirror bh");
                        lc->error = 1;
                }
        }
index 541dca6fda76f12988bc3cef805ebad67fd45a72..0f3b902ac2cb488834e08fc635a3cb89f04f8e20 100644 (file)
@@ -124,7 +124,7 @@ module_exit(origin_exit);
 
 MODULE_AUTHOR("Patrick Caulfield <caulfield@sistina.com>");
 MODULE_DESCRIPTION("Device Mapper: Snapshot origin driver");
-MODULE_LICENSE("GPL")
+MODULE_LICENSE("GPL");
 
 /*
  * Overrides for Emacs so that we follow Linus's tabbing style.
@@ -136,3 +136,4 @@ MODULE_LICENSE("GPL")
 * c-file-style: "linux"
 * End:
 */
+
index 787623af60a2ada5b277683b83bdf79d4a13953b..2d93fc4415a1c498db2ce21bc78c1d9fdd61bb2a 100644 (file)
@@ -252,7 +252,7 @@ static void copy_callback(copy_cb_reason_t reason, void *context, long arg)
 
        /* Read/write error - snapshot is unusable */
        if (reason == COPY_CB_FAILED_WRITE || reason == COPY_CB_FAILED_READ) {
-               DMERR("Error reading/writing snapshot\n");
+               DMERR("Error reading/writing snapshot");
                ex->snap->full = 1;
        }
 }
@@ -494,12 +494,12 @@ static int read_metadata(struct snapshot_c *lc)
        /* Allocate our own iovec for this operation 'cos the others
           are way too small */
        if (alloc_kiovec(1, &read_iobuf)) {
-               DMERR("Error allocating iobuf for %s\n", kdevname(lc->cow_dev->dev));
+               DMERR("Error allocating iobuf for %s", kdevname(lc->cow_dev->dev));
                return -1;
        }
 
        if (alloc_iobuf_pages(read_iobuf, lc->extent_size)) {
-               DMERR("Error allocating iobuf space for %s\n", kdevname(lc->cow_dev->dev));
+               DMERR("Error allocating iobuf space for %s", kdevname(lc->cow_dev->dev));
                free_kiovec(1, &read_iobuf);
                return -1;
        }
@@ -509,7 +509,7 @@ static int read_metadata(struct snapshot_c *lc)
        {
                /* Make sure the chain does not go off the end of the device, or backwards */
                if (cur_sector > devsize || cur_sector < first_free_sector) {
-                       DMERR("COW table chain pointers are inconsistent, can't activate snapshot\n");
+                       DMERR("COW table chain pointers are inconsistent, can't activate snapshot");
                        err = -1;
                        goto ret_free;
                }
@@ -545,7 +545,7 @@ static int read_metadata(struct snapshot_c *lc)
                        }
                }
                else {
-                       DMERR("Error reading COW metadata for %s\n", kdevname(lc->cow_dev->dev));
+                       DMERR("Error reading COW metadata for %s", kdevname(lc->cow_dev->dev));
                        err = -1;
                        goto ret_free;
                }
@@ -586,7 +586,7 @@ static int read_header(struct snapshot_c *lc)
        /* Get it */
        status = read_blocks(lc->cow_iobuf, lc->cow_dev->dev, 0L, blocksize/SECTOR_SIZE);
        if (status != 0) {
-               DMERR("Snapshot dev %s error reading header\n", kdevname(lc->cow_dev->dev));
+               DMERR("Snapshot dev %s error reading header", kdevname(lc->cow_dev->dev));
                return -1;
        }
 
@@ -600,21 +600,21 @@ static int read_header(struct snapshot_c *lc)
 
        /* Check the version matches */
        if (le32_to_cpu(header->version) != SNAPSHOT_DISK_VERSION) {
-               DMWARN("Snapshot dev %s version mismatch. Stored: %d, driver: %d\n",
+               DMWARN("Snapshot dev %s version mismatch. Stored: %d, driver: %d",
                       kdevname(lc->cow_dev->dev), le32_to_cpu(header->version), SNAPSHOT_DISK_VERSION);
                return -1;
        }
 
        /* Check the chunk sizes match */
        if (le32_to_cpu(header->chunk_size) != lc->chunk_size) {
-               DMWARN("Snapshot dev %s chunk size mismatch. Stored: %d, requested: %d\n",
+               DMWARN("Snapshot dev %s chunk size mismatch. Stored: %d, requested: %d",
                       kdevname(lc->cow_dev->dev), le32_to_cpu(header->chunk_size), lc->chunk_size);
                return -1;
        }
 
        /* Check the extent sizes match */
        if (le32_to_cpu(header->extent_size) != lc->extent_size) {
-               DMWARN("Snapshot dev %s extent size mismatch. Stored: %d, requested: %ld\n",
+               DMWARN("Snapshot dev %s extent size mismatch. Stored: %d, requested: %ld",
                       kdevname(lc->cow_dev->dev), le32_to_cpu(header->extent_size), lc->extent_size);
                return -1;
        }
@@ -622,7 +622,7 @@ static int read_header(struct snapshot_c *lc)
        /* Get the rest of the data */
        lc->start_of_exceptions = le64_to_cpu(header->start_of_exceptions);
        if (header->full) {
-               DMWARN("Snapshot dev %s is full. It cannot be used\n", kdevname(lc->cow_dev->dev));
+               DMWARN("Snapshot dev %s is full. It cannot be used", kdevname(lc->cow_dev->dev));
                lc->full = 1;
                return -1;
        }
@@ -630,7 +630,7 @@ static int read_header(struct snapshot_c *lc)
        /* Validate against the size of the volume */
        devsize = get_dev_size(lc->cow_dev->dev);
        if (lc->start_of_exceptions > devsize) {
-               DMWARN("Snapshot metadata error on %s. start exceptions > device size (%ld > %ld)\n",
+               DMWARN("Snapshot metadata error on %s. start exceptions > device size (%ld > %ld)",
                       kdevname(lc->cow_dev->dev), lc->start_of_exceptions, devsize);
                return -1;
        }
@@ -651,12 +651,12 @@ static int write_header(struct snapshot_c *lc)
        /* Allocate our own iobuf for this so we don't corrupt any
           of the other writes that may be going on */
        if (alloc_kiovec(1, &head_iobuf)) {
-               DMERR("Error allocating iobuf for header on %s\n", kdevname(lc->cow_dev->dev));
+               DMERR("Error allocating iobuf for header on %s", kdevname(lc->cow_dev->dev));
                return -1;
        }
 
        if (alloc_iobuf_pages(head_iobuf, PAGE_SIZE/SECTOR_SIZE)) {
-               DMERR("Error allocating iobuf space for header on %s\n", kdevname(lc->cow_dev->dev));
+               DMERR("Error allocating iobuf space for header on %s", kdevname(lc->cow_dev->dev));
                free_kiovec(1, &head_iobuf);
                return -1;
        }
@@ -687,7 +687,7 @@ static int write_metadata(struct snapshot_c *lc)
        int writesize = blocksize/SECTOR_SIZE;
 
        if (write_blocks(lc->cow_iobuf, lc->cow_dev->dev, lc->current_metadata_sector, writesize) != 0) {
-               DMERR("Error writing COW block\n");
+               DMERR("Error writing COW block");
                return -1;
        }
 
@@ -735,14 +735,14 @@ static int setup_persistent_snapshot(struct snapshot_c *lc, int blocksize, void
 
                *context = "Unable to write snapshot header";
                if (write_header(lc) != 0) {
-                       DMERR("Error writing header to snapshot volume %s\n",
+                       DMERR("Error writing header to snapshot volume %s",
                              kdevname(lc->cow_dev->dev));
                        goto free_ret;
                }
 
                /* Write a blank metadata block to the device */
                if (write_metadata(lc) != 0) {
-                       DMERR("Error writing initial COW table to snapshot volume %s\n",
+                       DMERR("Error writing initial COW table to snapshot volume %s",
                              kdevname(lc->cow_dev->dev));
                        goto free_ret;
                }
@@ -980,7 +980,7 @@ static int snapshot_map(struct buffer_head *bh, int rw, void *context)
 
                        /* Check there is enough space */
                        if (lc->next_free_sector + lc->chunk_size >= devsize) {
-                               DMWARN("Snapshot %s is full\n", kdevname(lc->cow_dev->dev));
+                               DMWARN("Snapshot %s is full", kdevname(lc->cow_dev->dev));
                                lc->full = 1;
                                write_header(lc);
                                up_write(&lc->origin->lock);
@@ -992,7 +992,7 @@ static int snapshot_map(struct buffer_head *bh, int rw, void *context)
                        lc->next_free_sector += lc->chunk_size;
                        ex = add_exception(lc, read_start, reloc_sector);
                        if (!ex) {
-                               DMERR("Snapshot %s error adding new exception entry\n", kdevname(lc->cow_dev->dev));
+                               DMERR("Snapshot %s error adding new exception entry", kdevname(lc->cow_dev->dev));
                                /* Error here - treat it as full */
                                lc->full = 1;
                                write_header(lc);
@@ -1075,7 +1075,7 @@ int dm_do_snapshot(struct dm_dev *origin, struct buffer_head *bh)
                                dev_size = get_dev_size(snap->cow_dev->dev);
                                if (snap->next_free_sector + snap->chunk_size >= dev_size) {
                                                /* Snapshot is full, we can't use it */
-                                               DMWARN("Snapshot %s is full (sec=%ld, size=%ld)\n",
+                                               DMWARN("Snapshot %s is full (sec=%ld, size=%ld)",
                                                       kdevname(snap->cow_dev->dev), snap->next_free_sector + snap->chunk_size, dev_size);
                                                snap->full = 1;
                                                /* Mark it full on the device */
@@ -1091,7 +1091,7 @@ int dm_do_snapshot(struct dm_dev *origin, struct buffer_head *bh)
                                        snap->next_free_sector += snap->chunk_size;
                                        ex = add_exception(snap, read_start, reloc_sector);
                                        if (!ex) {
-                                               DMERR("Snapshot %s error adding new exception entry\n",
+                                               DMERR("Snapshot %s error adding new exception entry",
                                                      kdevname(snap->cow_dev->dev));
                                                /* Error here - treat it as full */
                                                snap->full = 1;
@@ -1134,11 +1134,11 @@ static int __init snapshot_init(void)
        int r = dm_register_target(&snapshot_target);
 
        if (r < 0)
-               DMERR("Device mapper: Snapshot: register failed %d\n", r);
+               DMERR("Device mapper: Snapshot: register failed %d", r);
        else {
                snapshot_origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head), GFP_KERNEL);
                if (snapshot_origins == NULL) {
-                       DMERR("Device mapper: Snapshot: unable to allocate memory\n");
+                       DMERR("Device mapper: Snapshot: unable to allocate memory");
                        r = -1;
                }
                else {
@@ -1158,8 +1158,7 @@ static void snapshot_exit(void)
        int r = dm_unregister_target(&snapshot_target);
 
        if (r < 0)
-               DMERR(
-                      "Device mapper: Snapshot: unregister failed %d\n", r);
+               DMERR("Device mapper: Snapshot: unregister failed %d", r);
 
        if (snapshot_origins)
                kfree(snapshot_origins);
index f4aa23167b6e6bed03b11f215a475f6588e3b0f0..d4df90f6b1344df307c80523f99b8f991d4c219e 100644 (file)
@@ -232,7 +232,7 @@ static int copy_kthread(void *unused)
                                /* Read original blocks */
                                if (read_blocks(iobuf, work_item->fromdev, work_item->fromsec + work_item->done_sectors,
                                                nr_sectors)) {
-                                       DMERR("Read blocks from device %s failed\n", kdevname(work_item->fromdev));
+                                       DMERR("Read blocks from device %s failed", kdevname(work_item->fromdev));
 
                                        /* Callback error */
                                        callback_reason = COPY_CB_FAILED_READ;
@@ -242,7 +242,7 @@ static int copy_kthread(void *unused)
                                /* Write them out again */
                                if (write_blocks(iobuf, work_item->todev, work_item->tosec + work_item->done_sectors,
                                                 nr_sectors)) {
-                                       DMERR("Write blocks to %s failed\n", kdevname(work_item->todev));
+                                       DMERR("Write blocks to %s failed", kdevname(work_item->todev));
 
                                        /* Callback error */
                                        callback_reason = COPY_CB_FAILED_WRITE;
@@ -344,7 +344,7 @@ int dm_blockcopy(unsigned long fromsec, unsigned long tosec, unsigned long nr_se
                        DECLARE_WAITQUEUE(wq, current);
                        struct task_struct *tsk = current;
 
-                       DMINFO("Started kcopyd thread\n");
+                       DMINFO("Started kcopyd thread");
 
                        /* Wait for it to complete it's startup initialisation */
                        set_task_state(tsk, TASK_INTERRUPTIBLE);
@@ -356,7 +356,7 @@ int dm_blockcopy(unsigned long fromsec, unsigned long tosec, unsigned long nr_se
                        remove_wait_queue(&start_waitq, &wq);
                }
                else {
-                       DMERR("Failed to start kcopyd thread\n");
+                       DMERR("Failed to start kcopyd thread");
                        up(&start_lock);
                        return -EAGAIN;
                }
@@ -409,12 +409,12 @@ static int __init kcopyd_init(void)
        init_MUTEX(&run_lock);
 
        if (alloc_kiovec(1, &iobuf)) {
-               DMERR("Unable to allocate kiobuf for kcopyd\n");
+               DMERR("Unable to allocate kiobuf for kcopyd");
                return -1;
        }
 
        if (alloc_iobuf_pages(iobuf, KIO_MAX_SECTORS)) {
-               DMERR("Unable to allocate pages for kcopyd\n");
+               DMERR("Unable to allocate pages for kcopyd");
                free_kiovec(1, &iobuf);
                return -1;
        }
@@ -426,7 +426,7 @@ static int __init kcopyd_init(void)
        if (!entry_cachep) {
                unmap_kiobuf(iobuf);
                free_kiovec(1, &iobuf);
-               DMERR("Unable to allocate slab cache for kcopyd\n");
+               DMERR("Unable to allocate slab cache for kcopyd");
                return -1;
        }
 
@@ -434,7 +434,7 @@ static int __init kcopyd_init(void)
                unmap_kiobuf(iobuf);
                free_kiovec(1, &iobuf);
                kmem_cache_destroy(entry_cachep);
-               DMERR("Unable to allocate any work structures for the free list\n");
+               DMERR("Unable to allocate any work structures for the free list");
                return -1;
        }
 
This page took 0.043538 seconds and 5 git commands to generate.