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