sys/dev/disk/dm: Make dmdebug() print __func__
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Sun, 9 Oct 2016 09:22:18 +0000 (18:22 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Sun, 9 Oct 2016 10:19:12 +0000 (19:19 +0900)
and fix/remove dmdebug calls that could be cleaned up or simplified.

sys/dev/disk/dm/device-mapper.c
sys/dev/disk/dm/dm.h
sys/dev/disk/dm/dm_ioctl.c
sys/dev/disk/dm/dm_pdev.c
sys/dev/disk/dm/dm_table.c
sys/dev/disk/dm/targets/flakey/dm_target_flakey.c
sys/dev/disk/dm/targets/striped/dm_target_striped.c

index ff055fd..85c4d3e 100644 (file)
@@ -213,8 +213,7 @@ dmopen(struct dev_open_args *ap)
        dmv->is_open = 1;
        dm_dev_unbusy(dmv);
 
-       dmdebug("dm open routine called %" PRIu32 "\n",
-           minor(ap->a_head.a_dev));
+       dmdebug("minor=%" PRIu32 "\n", minor(ap->a_head.a_dev));
        return 0;
 }
 
@@ -234,8 +233,7 @@ dmclose(struct dev_close_args *ap)
        dmv->is_open = 0;
        dm_dev_unbusy(dmv);
 
-       dmdebug("dm close routine called %" PRIu32 "\n",
-           minor(ap->a_head.a_dev));
+       dmdebug("minor=%" PRIu32 "\n", minor(ap->a_head.a_dev));
        return 0;
 }
 
@@ -252,8 +250,6 @@ dmioctl(struct dev_ioctl_args *ap)
        prop_dictionary_t dm_dict_in;
 
        err = r = 0;
-
-       dmdebug("dmioctl called\n");
        KKASSERT(data != NULL);
 
        if ((r = disk_ioctl_switch(dev, cmd, data)) != ENOTTY)
@@ -321,10 +317,10 @@ dm_ioctl_switch(u_long cmd)
 
        switch(cmd) {
        case NETBSD_DM_IOCTL:
-               dmdebug("dm NETBSD_DM_IOCTL called\n");
+               dmdebug("NETBSD_DM_IOCTL called\n");
                break;
        default:
-               dmdebug("dm unknown ioctl called\n");
+               dmdebug("Unknown ioctl %lu called\n", cmd);
                return ENOTTY;
                break; /* NOT REACHED */
        }
@@ -362,10 +358,11 @@ disk_ioctl_switch(cdev_t dev, u_long cmd, void *data)
                        dpart->media_blksize = DEV_BSIZE;
                        dpart->fstype = FS_BSDFFS;
                }
+               dmdebug("DIOCGPART called\n");
                break;
 
        default:
-               dmdebug("unknown disk_ioctl called\n");
+               dmdebug("Unknown disk ioctl %lu called\n", cmd);
                return ENOTTY;
                break; /* NOT REACHED */
        }
index 396ec85..69cddc1 100644 (file)
@@ -274,7 +274,7 @@ int dm_pdev_init(void);
 int dm_pdev_uninit(void);
 
 #define dmdebug(format, ...)   \
-    do { if (dm_debug_level) kprintf(format, ## __VA_ARGS__); } while(0)
+    do { if (dm_debug_level) kprintf("%s: "format, __func__, ## __VA_ARGS__); } while(0)
 
 #define DM_TARGET_MODULE(name, evh)                            \
     static moduledata_t name##_mod = {                         \
index 4b42288..d692712 100644 (file)
@@ -724,8 +724,6 @@ dm_table_load_ioctl(prop_dictionary_t dm_dict)
        dm_dbg_print_flags(dmv->flags);
        tbl = dm_table_get_entry(&dmv->table_head, DM_TABLE_INACTIVE);
 
-       dmdebug("dmv->name = %s\n", dmv->name);
-
        prop_dictionary_set_uint32(dm_dict, DM_IOCTL_MINOR, dmv->minor);
 
        while ((target_dict = prop_object_iterator_next(iter)) != NULL) {
@@ -753,10 +751,9 @@ dm_table_load_ioctl(prop_dictionary_t dm_dict)
                prop_dictionary_get_uint64(target_dict, DM_TABLE_LENGTH,
                    &table_en->length);
 
-               dmdebug("dm_ioctl.c... table_en->start = %ju, "
-                            "table_en->length = %ju\n",
-                            (uintmax_t)table_en->start,
-                            (uintmax_t)table_en->length);
+               dmdebug("table_en->start = %ju, table_en->length = %ju\n",
+                       (uintmax_t)table_en->start,
+                       (uintmax_t)table_en->length);
 
                table_en->target = target;
                table_en->dev = dmv;
@@ -780,7 +777,7 @@ dm_table_load_ioctl(prop_dictionary_t dm_dict)
                 * therfore I have to pass it to target init
                 * routine and parse parameters there.
                 */
-               dmdebug("DM: str passed in is: \"%s\"\n", str);
+               dmdebug("String passed in is: \"%s\"\n", str);
 
                if ((ret = dm_table_init(target, table_en, str)) != 0) {
                        dm_table_release(&dmv->table_head, DM_TABLE_INACTIVE);
index 5dfd7a0..e2bd2bd 100644 (file)
@@ -130,7 +130,7 @@ dm_pdev_insert(const char *dev_name)
 
        if (dmp != NULL) {
                dmp->ref_cnt++;
-               dmdebug("dmp_pdev_insert pdev %s already in tree\n", dev_name);
+               dmdebug("pdev %s already in tree\n", dev_name);
                lockmgr(&dm_pdev_mutex, LK_RELEASE);
                return dmp;
        }
@@ -142,7 +142,7 @@ dm_pdev_insert(const char *dev_name)
 
        error = dm_dk_lookup(dev_name, &dmp->pdev_vnode);
        if (error) {
-               dmdebug("dk_lookup on device: %s failed with error %d!\n",
+               dmdebug("Lookup on %s failed with error %d!\n",
                    dev_name, error);
                dm_pdev_free(dmp);
                lockmgr(&dm_pdev_mutex, LK_RELEASE);
@@ -151,7 +151,7 @@ dm_pdev_insert(const char *dev_name)
        dmp->ref_cnt = 1;
 
        if (dm_pdev_get_vattr(dmp, &va) == -1) {
-               dmdebug("makeudev %s failed\n", dev_name);
+               dmdebug("getattr on %s failed\n", dev_name);
                dm_pdev_free(dmp);
                lockmgr(&dm_pdev_mutex, LK_RELEASE);
                return NULL;
@@ -169,8 +169,7 @@ dm_pdev_insert(const char *dev_name)
            (void *)&dmp->pdev_pinfo, 0, proc0.p_ucred, NULL, NULL);
        if (!error) {
                struct partinfo *dpart = &dmp->pdev_pinfo;
-               dmdebug("dmp_pdev_insert DIOCGPART "
-                       "offset=%ju size=%ju blocks=%ju blksize=%d\n",
+               dmdebug("DIOCGPART offset=%ju size=%ju blocks=%ju blksize=%d\n",
                        dpart->media_offset,
                        dpart->media_size,
                        dpart->media_blocks,
@@ -182,7 +181,7 @@ dm_pdev_insert(const char *dev_name)
        TAILQ_INSERT_TAIL(&dm_pdev_list, dmp, next_pdev);
        lockmgr(&dm_pdev_mutex, LK_RELEASE);
 
-       dmdebug("dmp_pdev_insert pdev %s %s 0x%016jx\n",
+       dmdebug("pdev %s %s 0x%016jx\n",
                dmp->name, dmp->udev_name, (uintmax_t)dmp->udev);
 
        return dmp;
index 2f13e3c..e18e70e 100644 (file)
@@ -134,7 +134,7 @@ dm_table_destroy(dm_table_head_t *head, uint8_t table_id)
 
        lockmgr(&head->table_mtx, LK_EXCLUSIVE);
 
-       dmdebug("dm_table_destroy called with %d--%d\n", table_id, head->io_cnt);
+       dmdebug("table_id=%d io_cnt=%d\n", table_id, head->io_cnt);
 
        if (table_id == DM_TABLE_ACTIVE)
                id = head->cur_active_table;
index e48c1b0..480beb2 100644 (file)
@@ -289,8 +289,8 @@ _flakey_write(dm_target_flakey_config_t *tfc, struct buf *bp)
        struct bio *bio = &bp->b_bio1;
 
        if (tfc->drop_writes) {
-               dmdebug("%s: bio=%p drop_writes offset=%ju\n",
-                       __func__, bio, bio->bio_offset);
+               dmdebug("bio=%p drop_writes offset=%ju\n",
+                       bio, bio->bio_offset);
                biodone(bio);
                return 0;
        }
@@ -326,8 +326,7 @@ _flakey_corrupt_buf(dm_target_flakey_config_t *tfc, struct bio *bio)
                return 1;
 
        bp->b_data[tfc->corrupt_buf_byte - 1] = tfc->corrupt_buf_value;
-       dmdebug("%s: bio=%p dir=%c offset=%ju Nth=%u value=%u\n",
-               __func__,
+       dmdebug("bio=%p dir=%c offset=%ju Nth=%u value=%u\n",
                bio,
                FLAKEY_CORRUPT_DIR(tfc),
                bio->bio_offset,
index a0c147a..d78dc3e 100644 (file)
@@ -247,8 +247,7 @@ dm_target_stripe_iodone(struct bio *bio)
                KKASSERT(devnr < MAX_STRIPES);
                tsc->stripe_devs[devnr].num_error++;
 
-               dmdebug("stripe_iodone: device=%d error=%d\n",
-                       devnr, bp->b_error);
+               dmdebug("device=%d error=%d\n", devnr, bp->b_error);
        }
 
        obio = pop_bio(bio);