Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] dm: improve error message consistency

Tidy device-mapper error messages to include context information
automatically.

Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Alasdair G Kergon and committed by
Linus Torvalds
72d94861 5c6bd75d

+142 -112
+28 -28
drivers/md/dm-crypt.c
··· 20 20 21 21 #include "dm.h" 22 22 23 - #define PFX "crypt: " 23 + #define DM_MSG_PREFIX "crypt" 24 24 25 25 /* 26 26 * per bio private data ··· 125 125 u8 *salt; 126 126 127 127 if (opts == NULL) { 128 - ti->error = PFX "Digest algorithm missing for ESSIV mode"; 128 + ti->error = "Digest algorithm missing for ESSIV mode"; 129 129 return -EINVAL; 130 130 } 131 131 132 132 /* Hash the cipher key with the given hash algorithm */ 133 133 hash_tfm = crypto_alloc_tfm(opts, CRYPTO_TFM_REQ_MAY_SLEEP); 134 134 if (hash_tfm == NULL) { 135 - ti->error = PFX "Error initializing ESSIV hash"; 135 + ti->error = "Error initializing ESSIV hash"; 136 136 return -EINVAL; 137 137 } 138 138 139 139 if (crypto_tfm_alg_type(hash_tfm) != CRYPTO_ALG_TYPE_DIGEST) { 140 - ti->error = PFX "Expected digest algorithm for ESSIV hash"; 140 + ti->error = "Expected digest algorithm for ESSIV hash"; 141 141 crypto_free_tfm(hash_tfm); 142 142 return -EINVAL; 143 143 } ··· 145 145 saltsize = crypto_tfm_alg_digestsize(hash_tfm); 146 146 salt = kmalloc(saltsize, GFP_KERNEL); 147 147 if (salt == NULL) { 148 - ti->error = PFX "Error kmallocing salt storage in ESSIV"; 148 + ti->error = "Error kmallocing salt storage in ESSIV"; 149 149 crypto_free_tfm(hash_tfm); 150 150 return -ENOMEM; 151 151 } ··· 159 159 CRYPTO_TFM_MODE_ECB | 160 160 CRYPTO_TFM_REQ_MAY_SLEEP); 161 161 if (essiv_tfm == NULL) { 162 - ti->error = PFX "Error allocating crypto tfm for ESSIV"; 162 + ti->error = "Error allocating crypto tfm for ESSIV"; 163 163 kfree(salt); 164 164 return -EINVAL; 165 165 } 166 166 if (crypto_tfm_alg_blocksize(essiv_tfm) 167 167 != crypto_tfm_alg_ivsize(cc->tfm)) { 168 - ti->error = PFX "Block size of ESSIV cipher does " 168 + ti->error = "Block size of ESSIV cipher does " 169 169 "not match IV size of block cipher"; 170 170 crypto_free_tfm(essiv_tfm); 171 171 kfree(salt); 172 172 return -EINVAL; 173 173 } 174 174 if (crypto_cipher_setkey(essiv_tfm, salt, saltsize) < 0) { 175 - ti->error = PFX "Failed to set key for ESSIV cipher"; 175 + ti->error = "Failed to set key for ESSIV cipher"; 176 176 crypto_free_tfm(essiv_tfm); 177 177 kfree(salt); 178 178 return -EINVAL; ··· 521 521 unsigned long long tmpll; 522 522 523 523 if (argc != 5) { 524 - ti->error = PFX "Not enough arguments"; 524 + ti->error = "Not enough arguments"; 525 525 return -EINVAL; 526 526 } 527 527 ··· 532 532 ivmode = strsep(&ivopts, ":"); 533 533 534 534 if (tmp) 535 - DMWARN(PFX "Unexpected additional cipher options"); 535 + DMWARN("Unexpected additional cipher options"); 536 536 537 537 key_size = strlen(argv[1]) >> 1; 538 538 539 539 cc = kmalloc(sizeof(*cc) + key_size * sizeof(u8), GFP_KERNEL); 540 540 if (cc == NULL) { 541 541 ti->error = 542 - PFX "Cannot allocate transparent encryption context"; 542 + "Cannot allocate transparent encryption context"; 543 543 return -ENOMEM; 544 544 } 545 545 546 546 cc->key_size = key_size; 547 547 if ((!key_size && strcmp(argv[1], "-") != 0) || 548 548 (key_size && crypt_decode_key(cc->key, argv[1], key_size) < 0)) { 549 - ti->error = PFX "Error decoding key"; 549 + ti->error = "Error decoding key"; 550 550 goto bad1; 551 551 } 552 552 ··· 562 562 else if (strcmp(chainmode, "ecb") == 0) 563 563 crypto_flags = CRYPTO_TFM_MODE_ECB; 564 564 else { 565 - ti->error = PFX "Unknown chaining mode"; 565 + ti->error = "Unknown chaining mode"; 566 566 goto bad1; 567 567 } 568 568 569 569 if (crypto_flags != CRYPTO_TFM_MODE_ECB && !ivmode) { 570 - ti->error = PFX "This chaining mode requires an IV mechanism"; 570 + ti->error = "This chaining mode requires an IV mechanism"; 571 571 goto bad1; 572 572 } 573 573 574 574 tfm = crypto_alloc_tfm(cipher, crypto_flags | CRYPTO_TFM_REQ_MAY_SLEEP); 575 575 if (!tfm) { 576 - ti->error = PFX "Error allocating crypto tfm"; 576 + ti->error = "Error allocating crypto tfm"; 577 577 goto bad1; 578 578 } 579 579 if (crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER) { 580 - ti->error = PFX "Expected cipher algorithm"; 580 + ti->error = "Expected cipher algorithm"; 581 581 goto bad2; 582 582 } 583 583 ··· 595 595 else if (strcmp(ivmode, "essiv") == 0) 596 596 cc->iv_gen_ops = &crypt_iv_essiv_ops; 597 597 else { 598 - ti->error = PFX "Invalid IV mode"; 598 + ti->error = "Invalid IV mode"; 599 599 goto bad2; 600 600 } 601 601 ··· 610 610 else { 611 611 cc->iv_size = 0; 612 612 if (cc->iv_gen_ops) { 613 - DMWARN(PFX "Selected cipher does not support IVs"); 613 + DMWARN("Selected cipher does not support IVs"); 614 614 if (cc->iv_gen_ops->dtr) 615 615 cc->iv_gen_ops->dtr(cc); 616 616 cc->iv_gen_ops = NULL; ··· 619 619 620 620 cc->io_pool = mempool_create_slab_pool(MIN_IOS, _crypt_io_pool); 621 621 if (!cc->io_pool) { 622 - ti->error = PFX "Cannot allocate crypt io mempool"; 622 + ti->error = "Cannot allocate crypt io mempool"; 623 623 goto bad3; 624 624 } 625 625 626 626 cc->page_pool = mempool_create_page_pool(MIN_POOL_PAGES, 0); 627 627 if (!cc->page_pool) { 628 - ti->error = PFX "Cannot allocate page mempool"; 628 + ti->error = "Cannot allocate page mempool"; 629 629 goto bad4; 630 630 } 631 631 632 632 if (tfm->crt_cipher.cit_setkey(tfm, cc->key, key_size) < 0) { 633 - ti->error = PFX "Error setting key"; 633 + ti->error = "Error setting key"; 634 634 goto bad5; 635 635 } 636 636 637 637 if (sscanf(argv[2], "%llu", &tmpll) != 1) { 638 - ti->error = PFX "Invalid iv_offset sector"; 638 + ti->error = "Invalid iv_offset sector"; 639 639 goto bad5; 640 640 } 641 641 cc->iv_offset = tmpll; 642 642 643 643 if (sscanf(argv[4], "%llu", &tmpll) != 1) { 644 - ti->error = PFX "Invalid device sector"; 644 + ti->error = "Invalid device sector"; 645 645 goto bad5; 646 646 } 647 647 cc->start = tmpll; 648 648 649 649 if (dm_get_device(ti, argv[3], cc->start, ti->len, 650 650 dm_table_get_mode(ti->table), &cc->dev)) { 651 - ti->error = PFX "Device lookup failed"; 651 + ti->error = "Device lookup failed"; 652 652 goto bad5; 653 653 } 654 654 ··· 657 657 *(ivopts - 1) = ':'; 658 658 cc->iv_mode = kmalloc(strlen(ivmode) + 1, GFP_KERNEL); 659 659 if (!cc->iv_mode) { 660 - ti->error = PFX "Error kmallocing iv_mode string"; 660 + ti->error = "Error kmallocing iv_mode string"; 661 661 goto bad5; 662 662 } 663 663 strcpy(cc->iv_mode, ivmode); ··· 918 918 _kcryptd_workqueue = create_workqueue("kcryptd"); 919 919 if (!_kcryptd_workqueue) { 920 920 r = -ENOMEM; 921 - DMERR(PFX "couldn't create kcryptd"); 921 + DMERR("couldn't create kcryptd"); 922 922 goto bad1; 923 923 } 924 924 925 925 r = dm_register_target(&crypt_target); 926 926 if (r < 0) { 927 - DMERR(PFX "register failed %d", r); 927 + DMERR("register failed %d", r); 928 928 goto bad2; 929 929 } 930 930 ··· 942 942 int r = dm_unregister_target(&crypt_target); 943 943 944 944 if (r < 0) 945 - DMERR(PFX "unregister failed %d", r); 945 + DMERR("unregister failed %d", r); 946 946 947 947 destroy_workqueue(_kcryptd_workqueue); 948 948 kmem_cache_destroy(_crypt_io_pool);
+21 -19
drivers/md/dm-emc.c
··· 12 12 #include <scsi/scsi.h> 13 13 #include <scsi/scsi_cmnd.h> 14 14 15 + #define DM_MSG_PREFIX "multipath emc" 16 + 15 17 struct emc_handler { 16 18 spinlock_t lock; 17 19 ··· 68 66 69 67 bio = bio_alloc(GFP_ATOMIC, 1); 70 68 if (!bio) { 71 - DMERR("dm-emc: get_failover_bio: bio_alloc() failed."); 69 + DMERR("get_failover_bio: bio_alloc() failed."); 72 70 return NULL; 73 71 } 74 72 ··· 80 78 81 79 page = alloc_page(GFP_ATOMIC); 82 80 if (!page) { 83 - DMERR("dm-emc: get_failover_bio: alloc_page() failed."); 81 + DMERR("get_failover_bio: alloc_page() failed."); 84 82 bio_put(bio); 85 83 return NULL; 86 84 } 87 85 88 86 if (bio_add_page(bio, page, data_size, 0) != data_size) { 89 - DMERR("dm-emc: get_failover_bio: alloc_page() failed."); 87 + DMERR("get_failover_bio: alloc_page() failed."); 90 88 __free_page(page); 91 89 bio_put(bio); 92 90 return NULL; ··· 105 103 /* FIXME: Figure out why it fails with GFP_ATOMIC. */ 106 104 rq = blk_get_request(q, WRITE, __GFP_WAIT); 107 105 if (!rq) { 108 - DMERR("dm-emc: get_failover_req: blk_get_request failed"); 106 + DMERR("get_failover_req: blk_get_request failed"); 109 107 return NULL; 110 108 } 111 109 ··· 162 160 163 161 bio = get_failover_bio(path, data_size); 164 162 if (!bio) { 165 - DMERR("dm-emc: emc_trespass_get: no bio"); 163 + DMERR("emc_trespass_get: no bio"); 166 164 return NULL; 167 165 } 168 166 ··· 175 173 /* get request for block layer packet command */ 176 174 rq = get_failover_req(h, bio, path); 177 175 if (!rq) { 178 - DMERR("dm-emc: emc_trespass_get: no rq"); 176 + DMERR("emc_trespass_get: no rq"); 179 177 free_bio(bio); 180 178 return NULL; 181 179 } ··· 202 200 * initial state passed into us and then get an update here. 203 201 */ 204 202 if (!q) { 205 - DMINFO("dm-emc: emc_pg_init: no queue"); 203 + DMINFO("emc_pg_init: no queue"); 206 204 goto fail_path; 207 205 } 208 206 209 207 /* FIXME: The request should be pre-allocated. */ 210 208 rq = emc_trespass_get(hwh->context, path); 211 209 if (!rq) { 212 - DMERR("dm-emc: emc_pg_init: no rq"); 210 + DMERR("emc_pg_init: no rq"); 213 211 goto fail_path; 214 212 } 215 213 216 - DMINFO("dm-emc: emc_pg_init: sending switch-over command"); 214 + DMINFO("emc_pg_init: sending switch-over command"); 217 215 elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 1); 218 216 return; 219 217 ··· 243 241 hr = 0; 244 242 short_trespass = 0; 245 243 } else if (argc != 2) { 246 - DMWARN("dm-emc hwhandler: incorrect number of arguments"); 244 + DMWARN("incorrect number of arguments"); 247 245 return -EINVAL; 248 246 } else { 249 247 if ((sscanf(argv[0], "%u", &short_trespass) != 1) 250 248 || (short_trespass > 1)) { 251 - DMWARN("dm-emc: invalid trespass mode selected"); 249 + DMWARN("invalid trespass mode selected"); 252 250 return -EINVAL; 253 251 } 254 252 255 253 if ((sscanf(argv[1], "%u", &hr) != 1) 256 254 || (hr > 1)) { 257 - DMWARN("dm-emc: invalid honor reservation flag selected"); 255 + DMWARN("invalid honor reservation flag selected"); 258 256 return -EINVAL; 259 257 } 260 258 } ··· 266 264 hwh->context = h; 267 265 268 266 if ((h->short_trespass = short_trespass)) 269 - DMWARN("dm-emc: short trespass command will be send"); 267 + DMWARN("short trespass command will be send"); 270 268 else 271 - DMWARN("dm-emc: long trespass command will be send"); 269 + DMWARN("long trespass command will be send"); 272 270 273 271 if ((h->hr = hr)) 274 - DMWARN("dm-emc: honor reservation bit will be set"); 272 + DMWARN("honor reservation bit will be set"); 275 273 else 276 - DMWARN("dm-emc: honor reservation bit will not be set (default)"); 274 + DMWARN("honor reservation bit will not be set (default)"); 277 275 278 276 return 0; 279 277 } ··· 338 336 int r = dm_register_hw_handler(&emc_hwh); 339 337 340 338 if (r < 0) 341 - DMERR("emc: register failed %d", r); 339 + DMERR("register failed %d", r); 342 340 343 - DMINFO("dm-emc version 0.0.3 loaded"); 341 + DMINFO("version 0.0.3 loaded"); 344 342 345 343 return r; 346 344 } ··· 350 348 int r = dm_unregister_hw_handler(&emc_hwh); 351 349 352 350 if (r < 0) 353 - DMERR("emc: unregister failed %d", r); 351 + DMERR("unregister failed %d", r); 354 352 } 355 353 356 354 module_init(dm_emc_init);
+2
drivers/md/dm-exception-store.c
··· 16 16 #include <linux/vmalloc.h> 17 17 #include <linux/slab.h> 18 18 19 + #define DM_MSG_PREFIX "snapshots" 20 + 19 21 /*----------------------------------------------------------------- 20 22 * Persistent snapshots, by persistent we mean that the snapshot 21 23 * will survive a reboot.
+1
drivers/md/dm-ioctl.c
··· 19 19 20 20 #include <asm/uaccess.h> 21 21 22 + #define DM_MSG_PREFIX "ioctl" 22 23 #define DM_DRIVER_EMAIL "dm-devel@redhat.com" 23 24 24 25 /*-----------------------------------------------------------------
+5 -3
drivers/md/dm-linear.c
··· 12 12 #include <linux/bio.h> 13 13 #include <linux/slab.h> 14 14 15 + #define DM_MSG_PREFIX "linear" 16 + 15 17 /* 16 18 * Linear: maps a linear range of a device. 17 19 */ ··· 31 29 unsigned long long tmp; 32 30 33 31 if (argc != 2) { 34 - ti->error = "dm-linear: Invalid argument count"; 32 + ti->error = "Invalid argument count"; 35 33 return -EINVAL; 36 34 } 37 35 ··· 113 111 int r = dm_register_target(&linear_target); 114 112 115 113 if (r < 0) 116 - DMERR("linear: register failed %d", r); 114 + DMERR("register failed %d", r); 117 115 118 116 return r; 119 117 } ··· 123 121 int r = dm_unregister_target(&linear_target); 124 122 125 123 if (r < 0) 126 - DMERR("linear: unregister failed %d", r); 124 + DMERR("unregister failed %d", r); 127 125 }
+2
drivers/md/dm-log.c
··· 12 12 #include "dm-log.h" 13 13 #include "dm-io.h" 14 14 15 + #define DM_MSG_PREFIX "mirror log" 16 + 15 17 static LIST_HEAD(_log_types); 16 18 static DEFINE_SPINLOCK(_lock); 17 19
+21 -22
drivers/md/dm-mpath.c
··· 21 21 #include <linux/workqueue.h> 22 22 #include <asm/atomic.h> 23 23 24 + #define DM_MSG_PREFIX "multipath" 24 25 #define MESG_STR(x) x, sizeof(x) 25 26 26 27 /* Path properties */ ··· 447 446 char *error; 448 447 }; 449 448 450 - #define ESTR(s) ("dm-multipath: " s) 451 - 452 449 static int read_param(struct param *param, char *str, unsigned *v, char **error) 453 450 { 454 451 if (!str || ··· 494 495 unsigned ps_argc; 495 496 496 497 static struct param _params[] = { 497 - {0, 1024, ESTR("invalid number of path selector args")}, 498 + {0, 1024, "invalid number of path selector args"}, 498 499 }; 499 500 500 501 pst = dm_get_path_selector(shift(as)); 501 502 if (!pst) { 502 - ti->error = ESTR("unknown path selector type"); 503 + ti->error = "unknown path selector type"; 503 504 return -EINVAL; 504 505 } 505 506 ··· 510 511 r = pst->create(&pg->ps, ps_argc, as->argv); 511 512 if (r) { 512 513 dm_put_path_selector(pst); 513 - ti->error = ESTR("path selector constructor failed"); 514 + ti->error = "path selector constructor failed"; 514 515 return r; 515 516 } 516 517 ··· 528 529 529 530 /* we need at least a path arg */ 530 531 if (as->argc < 1) { 531 - ti->error = ESTR("no device given"); 532 + ti->error = "no device given"; 532 533 return NULL; 533 534 } 534 535 ··· 539 540 r = dm_get_device(ti, shift(as), ti->begin, ti->len, 540 541 dm_table_get_mode(ti->table), &p->path.dev); 541 542 if (r) { 542 - ti->error = ESTR("error getting device"); 543 + ti->error = "error getting device"; 543 544 goto bad; 544 545 } 545 546 ··· 561 562 struct dm_target *ti) 562 563 { 563 564 static struct param _params[] = { 564 - {1, 1024, ESTR("invalid number of paths")}, 565 - {0, 1024, ESTR("invalid number of selector args")} 565 + {1, 1024, "invalid number of paths"}, 566 + {0, 1024, "invalid number of selector args"} 566 567 }; 567 568 568 569 int r; ··· 571 572 572 573 if (as->argc < 2) { 573 574 as->argc = 0; 574 - ti->error = ESTR("not enough priority group aruments"); 575 + ti->error = "not enough priority group aruments"; 575 576 return NULL; 576 577 } 577 578 578 579 pg = alloc_priority_group(); 579 580 if (!pg) { 580 - ti->error = ESTR("couldn't allocate priority group"); 581 + ti->error = "couldn't allocate priority group"; 581 582 return NULL; 582 583 } 583 584 pg->m = m; ··· 632 633 unsigned hw_argc; 633 634 634 635 static struct param _params[] = { 635 - {0, 1024, ESTR("invalid number of hardware handler args")}, 636 + {0, 1024, "invalid number of hardware handler args"}, 636 637 }; 637 638 638 639 r = read_param(_params, shift(as), &hw_argc, &ti->error); ··· 644 645 645 646 hwht = dm_get_hw_handler(shift(as)); 646 647 if (!hwht) { 647 - ti->error = ESTR("unknown hardware handler type"); 648 + ti->error = "unknown hardware handler type"; 648 649 return -EINVAL; 649 650 } 650 651 651 652 r = hwht->create(&m->hw_handler, hw_argc - 1, as->argv); 652 653 if (r) { 653 654 dm_put_hw_handler(hwht); 654 - ti->error = ESTR("hardware handler constructor failed"); 655 + ti->error = "hardware handler constructor failed"; 655 656 return r; 656 657 } 657 658 ··· 668 669 unsigned argc; 669 670 670 671 static struct param _params[] = { 671 - {0, 1, ESTR("invalid number of feature args")}, 672 + {0, 1, "invalid number of feature args"}, 672 673 }; 673 674 674 675 r = read_param(_params, shift(as), &argc, &ti->error); ··· 691 692 { 692 693 /* target parameters */ 693 694 static struct param _params[] = { 694 - {1, 1024, ESTR("invalid number of priority groups")}, 695 - {1, 1024, ESTR("invalid initial priority group number")}, 695 + {1, 1024, "invalid number of priority groups"}, 696 + {1, 1024, "invalid initial priority group number"}, 696 697 }; 697 698 698 699 int r; ··· 706 707 707 708 m = alloc_multipath(); 708 709 if (!m) { 709 - ti->error = ESTR("can't allocate multipath"); 710 + ti->error = "can't allocate multipath"; 710 711 return -EINVAL; 711 712 } 712 713 ··· 745 746 } 746 747 747 748 if (pg_count != m->nr_priority_groups) { 748 - ti->error = ESTR("priority group count mismatch"); 749 + ti->error = "priority group count mismatch"; 749 750 r = -EINVAL; 750 751 goto bad; 751 752 } ··· 806 807 if (!pgpath->path.is_active) 807 808 goto out; 808 809 809 - DMWARN("dm-multipath: Failing path %s.", pgpath->path.dev->name); 810 + DMWARN("Failing path %s.", pgpath->path.dev->name); 810 811 811 812 pgpath->pg->ps.type->fail_path(&pgpath->pg->ps, &pgpath->path); 812 813 pgpath->path.is_active = 0; ··· 1249 1250 r = dm_get_device(ti, argv[1], ti->begin, ti->len, 1250 1251 dm_table_get_mode(ti->table), &dev); 1251 1252 if (r) { 1252 - DMWARN("dm-multipath message: error getting device %s", 1253 + DMWARN("message: error getting device %s", 1253 1254 argv[1]); 1254 1255 return -EINVAL; 1255 1256 } ··· 1308 1309 return -ENOMEM; 1309 1310 } 1310 1311 1311 - DMINFO("dm-multipath version %u.%u.%u loaded", 1312 + DMINFO("version %u.%u.%u loaded", 1312 1313 multipath_target.version[0], multipath_target.version[1], 1313 1314 multipath_target.version[2]); 1314 1315
+13 -11
drivers/md/dm-raid1.c
··· 20 20 #include <linux/vmalloc.h> 21 21 #include <linux/workqueue.h> 22 22 23 + #define DM_MSG_PREFIX "raid1" 24 + 23 25 static struct workqueue_struct *_kmirrord_wq; 24 26 static struct work_struct _kmirrord_work; 25 27 ··· 894 892 895 893 ms = kmalloc(len, GFP_KERNEL); 896 894 if (!ms) { 897 - ti->error = "dm-mirror: Cannot allocate mirror context"; 895 + ti->error = "Cannot allocate mirror context"; 898 896 return NULL; 899 897 } 900 898 ··· 908 906 ms->default_mirror = &ms->mirror[DEFAULT_MIRROR]; 909 907 910 908 if (rh_init(&ms->rh, ms, dl, region_size, ms->nr_regions)) { 911 - ti->error = "dm-mirror: Error creating dirty region hash"; 909 + ti->error = "Error creating dirty region hash"; 912 910 kfree(ms); 913 911 return NULL; 914 912 } ··· 938 936 unsigned long long offset; 939 937 940 938 if (sscanf(argv[1], "%llu", &offset) != 1) { 941 - ti->error = "dm-mirror: Invalid offset"; 939 + ti->error = "Invalid offset"; 942 940 return -EINVAL; 943 941 } 944 942 945 943 if (dm_get_device(ti, argv[0], offset, ti->len, 946 944 dm_table_get_mode(ti->table), 947 945 &ms->mirror[mirror].dev)) { 948 - ti->error = "dm-mirror: Device lookup failure"; 946 + ti->error = "Device lookup failure"; 949 947 return -ENXIO; 950 948 } 951 949 ··· 982 980 struct dirty_log *dl; 983 981 984 982 if (argc < 2) { 985 - ti->error = "dm-mirror: Insufficient mirror log arguments"; 983 + ti->error = "Insufficient mirror log arguments"; 986 984 return NULL; 987 985 } 988 986 989 987 if (sscanf(argv[1], "%u", &param_count) != 1) { 990 - ti->error = "dm-mirror: Invalid mirror log argument count"; 988 + ti->error = "Invalid mirror log argument count"; 991 989 return NULL; 992 990 } 993 991 994 992 *args_used = 2 + param_count; 995 993 996 994 if (argc < *args_used) { 997 - ti->error = "dm-mirror: Insufficient mirror log arguments"; 995 + ti->error = "Insufficient mirror log arguments"; 998 996 return NULL; 999 997 } 1000 998 1001 999 dl = dm_create_dirty_log(argv[0], ti, param_count, argv + 2); 1002 1000 if (!dl) { 1003 - ti->error = "dm-mirror: Error creating mirror dirty log"; 1001 + ti->error = "Error creating mirror dirty log"; 1004 1002 return NULL; 1005 1003 } 1006 1004 1007 1005 if (!_check_region_size(ti, dl->type->get_region_size(dl))) { 1008 - ti->error = "dm-mirror: Invalid region size"; 1006 + ti->error = "Invalid region size"; 1009 1007 dm_destroy_dirty_log(dl); 1010 1008 return NULL; 1011 1009 } ··· 1039 1037 1040 1038 if (!argc || sscanf(argv[0], "%u", &nr_mirrors) != 1 || 1041 1039 nr_mirrors < 2 || nr_mirrors > KCOPYD_MAX_REGIONS + 1) { 1042 - ti->error = "dm-mirror: Invalid number of mirrors"; 1040 + ti->error = "Invalid number of mirrors"; 1043 1041 dm_destroy_dirty_log(dl); 1044 1042 return -EINVAL; 1045 1043 } ··· 1047 1045 argv++, argc--; 1048 1046 1049 1047 if (argc != nr_mirrors * 2) { 1050 - ti->error = "dm-mirror: Wrong number of mirror arguments"; 1048 + ti->error = "Wrong number of mirror arguments"; 1051 1049 dm_destroy_dirty_log(dl); 1052 1050 return -EINVAL; 1053 1051 }
+4 -2
drivers/md/dm-round-robin.c
··· 14 14 15 15 #include <linux/slab.h> 16 16 17 + #define DM_MSG_PREFIX "multipath round-robin" 18 + 17 19 /*----------------------------------------------------------------- 18 20 * Path-handling code, paths are held in lists 19 21 *---------------------------------------------------------------*/ ··· 193 191 int r = dm_register_path_selector(&rr_ps); 194 192 195 193 if (r < 0) 196 - DMERR("round-robin: register failed %d", r); 194 + DMERR("register failed %d", r); 197 195 198 - DMINFO("dm-round-robin version 1.0.0 loaded"); 196 + DMINFO("version 1.0.0 loaded"); 199 197 200 198 return r; 201 199 }
+6 -4
drivers/md/dm-snap.c
··· 23 23 #include "dm-bio-list.h" 24 24 #include "kcopyd.h" 25 25 26 + #define DM_MSG_PREFIX "snapshots" 27 + 26 28 /* 27 29 * The percentage increment we will wake up users at 28 30 */ ··· 119 117 _origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head), 120 118 GFP_KERNEL); 121 119 if (!_origins) { 122 - DMERR("Device mapper: Snapshot: unable to allocate memory"); 120 + DMERR("unable to allocate memory"); 123 121 return -ENOMEM; 124 122 } 125 123 ··· 414 412 int blocksize; 415 413 416 414 if (argc < 4) { 417 - ti->error = "dm-snapshot: requires exactly 4 arguments"; 415 + ti->error = "requires exactly 4 arguments"; 418 416 r = -EINVAL; 419 417 goto bad1; 420 418 } ··· 1129 1127 struct dm_dev *dev; 1130 1128 1131 1129 if (argc != 1) { 1132 - ti->error = "dm-origin: incorrect number of arguments"; 1130 + ti->error = "origin: incorrect number of arguments"; 1133 1131 return -EINVAL; 1134 1132 } 1135 1133 ··· 1238 1236 1239 1237 r = dm_register_target(&origin_target); 1240 1238 if (r < 0) { 1241 - DMERR("Device mapper: Origin: register failed %d\n", r); 1239 + DMERR("Origin target register failed %d", r); 1242 1240 goto bad1; 1243 1241 } 1244 1242
+13 -12
drivers/md/dm-stripe.c
··· 12 12 #include <linux/bio.h> 13 13 #include <linux/slab.h> 14 14 15 + #define DM_MSG_PREFIX "striped" 16 + 15 17 struct stripe { 16 18 struct dm_dev *dev; 17 19 sector_t physical_start; ··· 80 78 unsigned int i; 81 79 82 80 if (argc < 2) { 83 - ti->error = "dm-stripe: Not enough arguments"; 81 + ti->error = "Not enough arguments"; 84 82 return -EINVAL; 85 83 } 86 84 87 85 stripes = simple_strtoul(argv[0], &end, 10); 88 86 if (*end) { 89 - ti->error = "dm-stripe: Invalid stripe count"; 87 + ti->error = "Invalid stripe count"; 90 88 return -EINVAL; 91 89 } 92 90 93 91 chunk_size = simple_strtoul(argv[1], &end, 10); 94 92 if (*end) { 95 - ti->error = "dm-stripe: Invalid chunk_size"; 93 + ti->error = "Invalid chunk_size"; 96 94 return -EINVAL; 97 95 } 98 96 ··· 101 99 */ 102 100 if (!chunk_size || (chunk_size & (chunk_size - 1)) || 103 101 (chunk_size < (PAGE_SIZE >> SECTOR_SHIFT))) { 104 - ti->error = "dm-stripe: Invalid chunk size"; 102 + ti->error = "Invalid chunk size"; 105 103 return -EINVAL; 106 104 } 107 105 108 106 if (ti->len & (chunk_size - 1)) { 109 - ti->error = "dm-stripe: Target length not divisible by " 107 + ti->error = "Target length not divisible by " 110 108 "chunk size"; 111 109 return -EINVAL; 112 110 } 113 111 114 112 width = ti->len; 115 113 if (sector_div(width, stripes)) { 116 - ti->error = "dm-stripe: Target length not divisible by " 114 + ti->error = "Target length not divisible by " 117 115 "number of stripes"; 118 116 return -EINVAL; 119 117 } ··· 122 120 * Do we have enough arguments for that many stripes ? 123 121 */ 124 122 if (argc != (2 + 2 * stripes)) { 125 - ti->error = "dm-stripe: Not enough destinations " 123 + ti->error = "Not enough destinations " 126 124 "specified"; 127 125 return -EINVAL; 128 126 } 129 127 130 128 sc = alloc_context(stripes); 131 129 if (!sc) { 132 - ti->error = "dm-stripe: Memory allocation for striped context " 130 + ti->error = "Memory allocation for striped context " 133 131 "failed"; 134 132 return -ENOMEM; 135 133 } ··· 151 149 152 150 r = get_stripe(ti, sc, i, argv); 153 151 if (r < 0) { 154 - ti->error = "dm-stripe: Couldn't parse stripe " 155 - "destination"; 152 + ti->error = "Couldn't parse stripe destination"; 156 153 while (i--) 157 154 dm_put_device(ti, sc->stripe[i].dev); 158 155 kfree(sc); ··· 228 227 229 228 r = dm_register_target(&stripe_target); 230 229 if (r < 0) 231 - DMWARN("striped target registration failed"); 230 + DMWARN("target registration failed"); 232 231 233 232 return r; 234 233 } ··· 236 235 void dm_stripe_exit(void) 237 236 { 238 237 if (dm_unregister_target(&stripe_target)) 239 - DMWARN("striped target unregistration failed"); 238 + DMWARN("target unregistration failed"); 240 239 241 240 return; 242 241 }
+6 -5
drivers/md/dm-table.c
··· 17 17 #include <linux/mutex.h> 18 18 #include <asm/atomic.h> 19 19 20 + #define DM_MSG_PREFIX "table" 21 + 20 22 #define MAX_DEPTH 16 21 23 #define NODE_SIZE L1_CACHE_BYTES 22 24 #define KEYS_PER_NODE (NODE_SIZE / sizeof(sector_t)) ··· 717 715 memset(tgt, 0, sizeof(*tgt)); 718 716 719 717 if (!len) { 720 - tgt->error = "zero-length target"; 721 - DMERR("%s", tgt->error); 718 + DMERR("%s: zero-length target", dm_device_name(t->md)); 722 719 return -EINVAL; 723 720 } 724 721 725 722 tgt->type = dm_get_target_type(type); 726 723 if (!tgt->type) { 727 - tgt->error = "unknown target type"; 728 - DMERR("%s", tgt->error); 724 + DMERR("%s: %s: unknown target type", dm_device_name(t->md), 725 + type); 729 726 return -EINVAL; 730 727 } 731 728 ··· 761 760 return 0; 762 761 763 762 bad: 764 - DMERR("%s", tgt->error); 763 + DMERR("%s: %s: %s", dm_device_name(t->md), type, tgt->error); 765 764 dm_put_target_type(tgt->type); 766 765 return r; 767 766 }
+2
drivers/md/dm-target.c
··· 12 12 #include <linux/bio.h> 13 13 #include <linux/slab.h> 14 14 15 + #define DM_MSG_PREFIX "target" 16 + 15 17 struct tt_internal { 16 18 struct target_type tt; 17 19
+5 -3
drivers/md/dm-zero.c
··· 10 10 #include <linux/init.h> 11 11 #include <linux/bio.h> 12 12 13 + #define DM_MSG_PREFIX "zero" 14 + 13 15 /* 14 16 * Construct a dummy mapping that only returns zeros 15 17 */ 16 18 static int zero_ctr(struct dm_target *ti, unsigned int argc, char **argv) 17 19 { 18 20 if (argc != 0) { 19 - ti->error = "dm-zero: No arguments required"; 21 + ti->error = "No arguments required"; 20 22 return -EINVAL; 21 23 } 22 24 ··· 62 60 int r = dm_register_target(&zero_target); 63 61 64 62 if (r < 0) 65 - DMERR("zero: register failed %d", r); 63 + DMERR("register failed %d", r); 66 64 67 65 return r; 68 66 } ··· 72 70 int r = dm_unregister_target(&zero_target); 73 71 74 72 if (r < 0) 75 - DMERR("zero: unregister failed %d", r); 73 + DMERR("unregister failed %d", r); 76 74 } 77 75 78 76 module_init(dm_zero_init)
+8
drivers/md/dm.c
··· 21 21 #include <linux/hdreg.h> 22 22 #include <linux/blktrace_api.h> 23 23 24 + #define DM_MSG_PREFIX "core" 25 + 24 26 static const char *_name = DM_NAME; 25 27 26 28 static unsigned int major = 0; ··· 1109 1107 { 1110 1108 atomic_inc(&md->holders); 1111 1109 } 1110 + 1111 + const char *dm_device_name(struct mapped_device *md) 1112 + { 1113 + return md->name; 1114 + } 1115 + EXPORT_SYMBOL_GPL(dm_device_name); 1112 1116 1113 1117 void dm_put(struct mapped_device *md) 1114 1118 {
+4 -3
drivers/md/dm.h
··· 17 17 #include <linux/hdreg.h> 18 18 19 19 #define DM_NAME "device-mapper" 20 - #define DMWARN(f, x...) printk(KERN_WARNING DM_NAME ": " f "\n" , ## x) 21 - #define DMERR(f, x...) printk(KERN_ERR DM_NAME ": " f "\n" , ## x) 22 - #define DMINFO(f, x...) printk(KERN_INFO DM_NAME ": " f "\n" , ## x) 20 + 21 + #define DMERR(f, arg...) printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg) 22 + #define DMWARN(f, arg...) printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg) 23 + #define DMINFO(f, arg...) printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg) 23 24 24 25 #define DMEMIT(x...) sz += ((sz >= maxlen) ? \ 25 26 0 : scnprintf(result + sz, maxlen - sz, x))
+1
include/linux/device-mapper.h
··· 171 171 /* 172 172 * Info functions. 173 173 */ 174 + const char *dm_device_name(struct mapped_device *md); 174 175 struct gendisk *dm_disk(struct mapped_device *md); 175 176 int dm_suspended(struct mapped_device *md); 176 177