diff options
author | Alasdair G Kergon <agk@redhat.com> | 2006-06-26 03:27:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 12:58:36 -0400 |
commit | 72d9486169a2a8353e022813185ba2f32d7dde69 (patch) | |
tree | 2fe6c382feb3f21d829abf543c54be486007557c /drivers/md/dm-raid1.c | |
parent | 5c6bd75d06db512515a3781aa97e42df2faf0815 (diff) |
[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>
Diffstat (limited to 'drivers/md/dm-raid1.c')
-rw-r--r-- | drivers/md/dm-raid1.c | 24 |
1 files changed, 13 insertions, 11 deletions
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 | } |