dm-mpath.c (bf661be1fcf9b1da8abc81a56ff41ce5964ce896) | dm-mpath.c (e83068a5faafb8ca65d3b58bd1e1e3959ce1ddce) |
---|---|
1/* 2 * Copyright (C) 2003 Sistina Software Limited. 3 * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include <linux/device-mapper.h> --- 76 unchanged lines hidden (view full) --- 85 86 unsigned pg_init_retries; /* Number of times to retry pg_init */ 87 unsigned pg_init_delay_msecs; /* Number of msecs before pg_init retry */ 88 89 atomic_t nr_valid_paths; /* Total number of usable paths */ 90 atomic_t pg_init_in_progress; /* Only one pg_init allowed at once */ 91 atomic_t pg_init_count; /* Number of times pg_init called */ 92 | 1/* 2 * Copyright (C) 2003 Sistina Software Limited. 3 * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include <linux/device-mapper.h> --- 76 unchanged lines hidden (view full) --- 85 86 unsigned pg_init_retries; /* Number of times to retry pg_init */ 87 unsigned pg_init_delay_msecs; /* Number of msecs before pg_init retry */ 88 89 atomic_t nr_valid_paths; /* Total number of usable paths */ 90 atomic_t pg_init_in_progress; /* Only one pg_init allowed at once */ 91 atomic_t pg_init_count; /* Number of times pg_init called */ 92 |
93 unsigned queue_mode; 94 |
|
93 /* 94 * We must use a mempool of dm_mpath_io structs so that we 95 * can resubmit bios on error. 96 */ 97 mempool_t *mpio_pool; 98 99 struct mutex work_mutex; 100 struct work_struct trigger_event; --- 25 unchanged lines hidden (view full) --- 126 127#define MPATHF_QUEUE_IO 0 /* Must we queue all I/O? */ 128#define MPATHF_QUEUE_IF_NO_PATH 1 /* Queue I/O if last path fails? */ 129#define MPATHF_SAVED_QUEUE_IF_NO_PATH 2 /* Saved state during suspension */ 130#define MPATHF_RETAIN_ATTACHED_HW_HANDLER 3 /* If there's already a hw_handler present, don't change it. */ 131#define MPATHF_PG_INIT_DISABLED 4 /* pg_init is not currently allowed */ 132#define MPATHF_PG_INIT_REQUIRED 5 /* pg_init needs calling? */ 133#define MPATHF_PG_INIT_DELAY_RETRY 6 /* Delay pg_init retry? */ | 95 /* 96 * We must use a mempool of dm_mpath_io structs so that we 97 * can resubmit bios on error. 98 */ 99 mempool_t *mpio_pool; 100 101 struct mutex work_mutex; 102 struct work_struct trigger_event; --- 25 unchanged lines hidden (view full) --- 128 129#define MPATHF_QUEUE_IO 0 /* Must we queue all I/O? */ 130#define MPATHF_QUEUE_IF_NO_PATH 1 /* Queue I/O if last path fails? */ 131#define MPATHF_SAVED_QUEUE_IF_NO_PATH 2 /* Saved state during suspension */ 132#define MPATHF_RETAIN_ATTACHED_HW_HANDLER 3 /* If there's already a hw_handler present, don't change it. */ 133#define MPATHF_PG_INIT_DISABLED 4 /* pg_init is not currently allowed */ 134#define MPATHF_PG_INIT_REQUIRED 5 /* pg_init needs calling? */ 135#define MPATHF_PG_INIT_DELAY_RETRY 6 /* Delay pg_init retry? */ |
134#define MPATHF_BIO_BASED 7 /* Device is bio-based? */ | |
135 136/*----------------------------------------------- 137 * Allocation routines 138 *-----------------------------------------------*/ 139 140static struct pgpath *alloc_pgpath(void) 141{ 142 struct pgpath *pgpath = kzalloc(sizeof(*pgpath), GFP_KERNEL); --- 43 unchanged lines hidden (view full) --- 186 ps->type->destroy(ps); 187 dm_put_path_selector(ps->type); 188 } 189 190 free_pgpaths(&pg->pgpaths, ti); 191 kfree(pg); 192} 193 | 136 137/*----------------------------------------------- 138 * Allocation routines 139 *-----------------------------------------------*/ 140 141static struct pgpath *alloc_pgpath(void) 142{ 143 struct pgpath *pgpath = kzalloc(sizeof(*pgpath), GFP_KERNEL); --- 43 unchanged lines hidden (view full) --- 187 ps->type->destroy(ps); 188 dm_put_path_selector(ps->type); 189 } 190 191 free_pgpaths(&pg->pgpaths, ti); 192 kfree(pg); 193} 194 |
194static struct multipath *alloc_multipath(struct dm_target *ti, bool use_blk_mq, 195 bool bio_based) | 195static struct multipath *alloc_multipath(struct dm_target *ti) |
196{ 197 struct multipath *m; 198 199 m = kzalloc(sizeof(*m), GFP_KERNEL); 200 if (m) { 201 INIT_LIST_HEAD(&m->priority_groups); 202 spin_lock_init(&m->lock); 203 set_bit(MPATHF_QUEUE_IO, &m->flags); 204 atomic_set(&m->nr_valid_paths, 0); 205 atomic_set(&m->pg_init_in_progress, 0); 206 atomic_set(&m->pg_init_count, 0); 207 m->pg_init_delay_msecs = DM_PG_INIT_DELAY_DEFAULT; 208 INIT_WORK(&m->trigger_event, trigger_event); 209 init_waitqueue_head(&m->pg_init_wait); 210 mutex_init(&m->work_mutex); 211 212 m->mpio_pool = NULL; | 196{ 197 struct multipath *m; 198 199 m = kzalloc(sizeof(*m), GFP_KERNEL); 200 if (m) { 201 INIT_LIST_HEAD(&m->priority_groups); 202 spin_lock_init(&m->lock); 203 set_bit(MPATHF_QUEUE_IO, &m->flags); 204 atomic_set(&m->nr_valid_paths, 0); 205 atomic_set(&m->pg_init_in_progress, 0); 206 atomic_set(&m->pg_init_count, 0); 207 m->pg_init_delay_msecs = DM_PG_INIT_DELAY_DEFAULT; 208 INIT_WORK(&m->trigger_event, trigger_event); 209 init_waitqueue_head(&m->pg_init_wait); 210 mutex_init(&m->work_mutex); 211 212 m->mpio_pool = NULL; |
213 if (!use_blk_mq && !bio_based) { 214 unsigned min_ios = dm_get_reserved_rq_based_ios(); | 213 m->queue_mode = DM_TYPE_NONE; |
215 | 214 |
216 m->mpio_pool = mempool_create_slab_pool(min_ios, _mpio_cache); 217 if (!m->mpio_pool) { 218 kfree(m); 219 return NULL; 220 } 221 } 222 223 if (bio_based) { 224 INIT_WORK(&m->process_queued_bios, process_queued_bios); 225 set_bit(MPATHF_BIO_BASED, &m->flags); 226 /* 227 * bio-based doesn't support any direct scsi_dh management; 228 * it just discovers if a scsi_dh is attached. 229 */ 230 set_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags); 231 } 232 | |
233 m->ti = ti; 234 ti->private = m; 235 } 236 237 return m; 238} 239 | 215 m->ti = ti; 216 ti->private = m; 217 } 218 219 return m; 220} 221 |
222static int alloc_multipath_stage2(struct dm_target *ti, struct multipath *m) 223{ 224 if (m->queue_mode == DM_TYPE_NONE) { 225 /* 226 * Default to request-based. 227 */ 228 if (dm_use_blk_mq(dm_table_get_md(ti->table))) 229 m->queue_mode = DM_TYPE_MQ_REQUEST_BASED; 230 else 231 m->queue_mode = DM_TYPE_REQUEST_BASED; 232 } 233 234 if (m->queue_mode == DM_TYPE_REQUEST_BASED) { 235 unsigned min_ios = dm_get_reserved_rq_based_ios(); 236 237 m->mpio_pool = mempool_create_slab_pool(min_ios, _mpio_cache); 238 if (!m->mpio_pool) 239 return -ENOMEM; 240 } 241 else if (m->queue_mode == DM_TYPE_BIO_BASED) { 242 INIT_WORK(&m->process_queued_bios, process_queued_bios); 243 /* 244 * bio-based doesn't support any direct scsi_dh management; 245 * it just discovers if a scsi_dh is attached. 246 */ 247 set_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags); 248 } 249 250 dm_table_set_type(ti->table, m->queue_mode); 251 252 return 0; 253} 254 |
|
240static void free_multipath(struct multipath *m) 241{ 242 struct priority_group *pg, *tmp; 243 244 list_for_each_entry_safe(pg, tmp, &m->priority_groups, list) { 245 list_del(&pg->list); 246 free_priority_group(pg, m->ti); 247 } --- 400 unchanged lines hidden (view full) --- 648 649 multipath_init_per_bio_data(bio, &mpio, NULL); 650 651 return __multipath_map_bio(m, bio, mpio); 652} 653 654static void process_queued_bios_list(struct multipath *m) 655{ | 255static void free_multipath(struct multipath *m) 256{ 257 struct priority_group *pg, *tmp; 258 259 list_for_each_entry_safe(pg, tmp, &m->priority_groups, list) { 260 list_del(&pg->list); 261 free_priority_group(pg, m->ti); 262 } --- 400 unchanged lines hidden (view full) --- 663 664 multipath_init_per_bio_data(bio, &mpio, NULL); 665 666 return __multipath_map_bio(m, bio, mpio); 667} 668 669static void process_queued_bios_list(struct multipath *m) 670{ |
656 if (test_bit(MPATHF_BIO_BASED, &m->flags)) | 671 if (m->queue_mode == DM_TYPE_BIO_BASED) |
657 queue_work(kmultipathd, &m->process_queued_bios); 658} 659 660static void process_queued_bios(struct work_struct *work) 661{ 662 int r; 663 unsigned long flags; 664 struct bio *bio; --- 294 unchanged lines hidden (view full) --- 959 }; 960 961 if (dm_read_arg_group(_args, as, &hw_argc, &ti->error)) 962 return -EINVAL; 963 964 if (!hw_argc) 965 return 0; 966 | 672 queue_work(kmultipathd, &m->process_queued_bios); 673} 674 675static void process_queued_bios(struct work_struct *work) 676{ 677 int r; 678 unsigned long flags; 679 struct bio *bio; --- 294 unchanged lines hidden (view full) --- 974 }; 975 976 if (dm_read_arg_group(_args, as, &hw_argc, &ti->error)) 977 return -EINVAL; 978 979 if (!hw_argc) 980 return 0; 981 |
967 if (test_bit(MPATHF_BIO_BASED, &m->flags)) { | 982 if (m->queue_mode == DM_TYPE_BIO_BASED) { |
968 dm_consume_args(as, hw_argc); 969 DMERR("bio-based multipath doesn't allow hardware handler args"); 970 return 0; 971 } 972 973 m->hw_handler_name = kstrdup(dm_shift_arg(as), GFP_KERNEL); 974 975 if (hw_argc > 1) { --- 24 unchanged lines hidden (view full) --- 1000static int parse_features(struct dm_arg_set *as, struct multipath *m) 1001{ 1002 int r; 1003 unsigned argc; 1004 struct dm_target *ti = m->ti; 1005 const char *arg_name; 1006 1007 static struct dm_arg _args[] = { | 983 dm_consume_args(as, hw_argc); 984 DMERR("bio-based multipath doesn't allow hardware handler args"); 985 return 0; 986 } 987 988 m->hw_handler_name = kstrdup(dm_shift_arg(as), GFP_KERNEL); 989 990 if (hw_argc > 1) { --- 24 unchanged lines hidden (view full) --- 1015static int parse_features(struct dm_arg_set *as, struct multipath *m) 1016{ 1017 int r; 1018 unsigned argc; 1019 struct dm_target *ti = m->ti; 1020 const char *arg_name; 1021 1022 static struct dm_arg _args[] = { |
1008 {0, 6, "invalid number of feature args"}, | 1023 {0, 8, "invalid number of feature args"}, |
1009 {1, 50, "pg_init_retries must be between 1 and 50"}, 1010 {0, 60000, "pg_init_delay_msecs must be between 0 and 60000"}, 1011 }; 1012 1013 r = dm_read_arg_group(_args, as, &argc, &ti->error); 1014 if (r) 1015 return -EINVAL; 1016 --- 23 unchanged lines hidden (view full) --- 1040 1041 if (!strcasecmp(arg_name, "pg_init_delay_msecs") && 1042 (argc >= 1)) { 1043 r = dm_read_arg(_args + 2, as, &m->pg_init_delay_msecs, &ti->error); 1044 argc--; 1045 continue; 1046 } 1047 | 1024 {1, 50, "pg_init_retries must be between 1 and 50"}, 1025 {0, 60000, "pg_init_delay_msecs must be between 0 and 60000"}, 1026 }; 1027 1028 r = dm_read_arg_group(_args, as, &argc, &ti->error); 1029 if (r) 1030 return -EINVAL; 1031 --- 23 unchanged lines hidden (view full) --- 1055 1056 if (!strcasecmp(arg_name, "pg_init_delay_msecs") && 1057 (argc >= 1)) { 1058 r = dm_read_arg(_args + 2, as, &m->pg_init_delay_msecs, &ti->error); 1059 argc--; 1060 continue; 1061 } 1062 |
1063 if (!strcasecmp(arg_name, "queue_mode") && 1064 (argc >= 1)) { 1065 const char *queue_mode_name = dm_shift_arg(as); 1066 1067 if (!strcasecmp(queue_mode_name, "bio")) 1068 m->queue_mode = DM_TYPE_BIO_BASED; 1069 else if (!strcasecmp(queue_mode_name, "rq")) 1070 m->queue_mode = DM_TYPE_REQUEST_BASED; 1071 else if (!strcasecmp(queue_mode_name, "mq")) 1072 m->queue_mode = DM_TYPE_MQ_REQUEST_BASED; 1073 else { 1074 ti->error = "Unknown 'queue_mode' requested"; 1075 r = -EINVAL; 1076 } 1077 argc--; 1078 continue; 1079 } 1080 |
|
1048 ti->error = "Unrecognised multipath feature request"; 1049 r = -EINVAL; 1050 } while (argc && !r); 1051 1052 return r; 1053} 1054 | 1081 ti->error = "Unrecognised multipath feature request"; 1082 r = -EINVAL; 1083 } while (argc && !r); 1084 1085 return r; 1086} 1087 |
1055static int __multipath_ctr(struct dm_target *ti, unsigned int argc, 1056 char **argv, bool bio_based) | 1088static int multipath_ctr(struct dm_target *ti, unsigned argc, char **argv) |
1057{ 1058 /* target arguments */ 1059 static struct dm_arg _args[] = { 1060 {0, 1024, "invalid number of priority groups"}, 1061 {0, 1024, "invalid initial priority group number"}, 1062 }; 1063 1064 int r; 1065 struct multipath *m; 1066 struct dm_arg_set as; 1067 unsigned pg_count = 0; 1068 unsigned next_pg_num; | 1089{ 1090 /* target arguments */ 1091 static struct dm_arg _args[] = { 1092 {0, 1024, "invalid number of priority groups"}, 1093 {0, 1024, "invalid initial priority group number"}, 1094 }; 1095 1096 int r; 1097 struct multipath *m; 1098 struct dm_arg_set as; 1099 unsigned pg_count = 0; 1100 unsigned next_pg_num; |
1069 bool use_blk_mq = dm_use_blk_mq(dm_table_get_md(ti->table)); | |
1070 1071 as.argc = argc; 1072 as.argv = argv; 1073 | 1101 1102 as.argc = argc; 1103 as.argv = argv; 1104 |
1074 m = alloc_multipath(ti, use_blk_mq, bio_based); | 1105 m = alloc_multipath(ti); |
1075 if (!m) { 1076 ti->error = "can't allocate multipath"; 1077 return -EINVAL; 1078 } 1079 1080 r = parse_features(&as, m); 1081 if (r) 1082 goto bad; 1083 | 1106 if (!m) { 1107 ti->error = "can't allocate multipath"; 1108 return -EINVAL; 1109 } 1110 1111 r = parse_features(&as, m); 1112 if (r) 1113 goto bad; 1114 |
1115 r = alloc_multipath_stage2(ti, m); 1116 if (r) 1117 goto bad; 1118 |
|
1084 r = parse_hw_handler(&as, m); 1085 if (r) 1086 goto bad; 1087 1088 r = dm_read_arg(_args, &as, &m->nr_priority_groups, &ti->error); 1089 if (r) 1090 goto bad; 1091 --- 33 unchanged lines hidden (view full) --- 1125 ti->error = "priority group count mismatch"; 1126 r = -EINVAL; 1127 goto bad; 1128 } 1129 1130 ti->num_flush_bios = 1; 1131 ti->num_discard_bios = 1; 1132 ti->num_write_same_bios = 1; | 1119 r = parse_hw_handler(&as, m); 1120 if (r) 1121 goto bad; 1122 1123 r = dm_read_arg(_args, &as, &m->nr_priority_groups, &ti->error); 1124 if (r) 1125 goto bad; 1126 --- 33 unchanged lines hidden (view full) --- 1160 ti->error = "priority group count mismatch"; 1161 r = -EINVAL; 1162 goto bad; 1163 } 1164 1165 ti->num_flush_bios = 1; 1166 ti->num_discard_bios = 1; 1167 ti->num_write_same_bios = 1; |
1133 if (bio_based) | 1168 if (m->queue_mode == DM_TYPE_BIO_BASED) |
1134 ti->per_io_data_size = multipath_per_bio_data_size(); | 1169 ti->per_io_data_size = multipath_per_bio_data_size(); |
1135 else if (use_blk_mq) | 1170 else if (m->queue_mode == DM_TYPE_MQ_REQUEST_BASED) |
1136 ti->per_io_data_size = sizeof(struct dm_mpath_io); 1137 1138 return 0; 1139 1140 bad: 1141 free_multipath(m); 1142 return r; 1143} 1144 | 1171 ti->per_io_data_size = sizeof(struct dm_mpath_io); 1172 1173 return 0; 1174 1175 bad: 1176 free_multipath(m); 1177 return r; 1178} 1179 |
1145static int multipath_ctr(struct dm_target *ti, unsigned argc, char **argv) 1146{ 1147 return __multipath_ctr(ti, argc, argv, false); 1148} 1149 1150static int multipath_bio_ctr(struct dm_target *ti, unsigned argc, char **argv) 1151{ 1152 return __multipath_ctr(ti, argc, argv, true); 1153} 1154 | |
1155static void multipath_wait_for_pg_init_completion(struct multipath *m) 1156{ 1157 DECLARE_WAITQUEUE(wait, current); 1158 1159 add_wait_queue(&m->pg_init_wait, &wait); 1160 1161 while (1) { 1162 set_current_state(TASK_UNINTERRUPTIBLE); --- 532 unchanged lines hidden (view full) --- 1695 /* Features */ 1696 if (type == STATUSTYPE_INFO) 1697 DMEMIT("2 %u %u ", test_bit(MPATHF_QUEUE_IO, &m->flags), 1698 atomic_read(&m->pg_init_count)); 1699 else { 1700 DMEMIT("%u ", test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags) + 1701 (m->pg_init_retries > 0) * 2 + 1702 (m->pg_init_delay_msecs != DM_PG_INIT_DELAY_DEFAULT) * 2 + | 1180static void multipath_wait_for_pg_init_completion(struct multipath *m) 1181{ 1182 DECLARE_WAITQUEUE(wait, current); 1183 1184 add_wait_queue(&m->pg_init_wait, &wait); 1185 1186 while (1) { 1187 set_current_state(TASK_UNINTERRUPTIBLE); --- 532 unchanged lines hidden (view full) --- 1720 /* Features */ 1721 if (type == STATUSTYPE_INFO) 1722 DMEMIT("2 %u %u ", test_bit(MPATHF_QUEUE_IO, &m->flags), 1723 atomic_read(&m->pg_init_count)); 1724 else { 1725 DMEMIT("%u ", test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags) + 1726 (m->pg_init_retries > 0) * 2 + 1727 (m->pg_init_delay_msecs != DM_PG_INIT_DELAY_DEFAULT) * 2 + |
1703 test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags)); | 1728 test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags) + 1729 (m->queue_mode != DM_TYPE_REQUEST_BASED) * 2); 1730 |
1704 if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) 1705 DMEMIT("queue_if_no_path "); 1706 if (m->pg_init_retries) 1707 DMEMIT("pg_init_retries %u ", m->pg_init_retries); 1708 if (m->pg_init_delay_msecs != DM_PG_INIT_DELAY_DEFAULT) 1709 DMEMIT("pg_init_delay_msecs %u ", m->pg_init_delay_msecs); 1710 if (test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags)) 1711 DMEMIT("retain_attached_hw_handler "); | 1731 if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) 1732 DMEMIT("queue_if_no_path "); 1733 if (m->pg_init_retries) 1734 DMEMIT("pg_init_retries %u ", m->pg_init_retries); 1735 if (m->pg_init_delay_msecs != DM_PG_INIT_DELAY_DEFAULT) 1736 DMEMIT("pg_init_delay_msecs %u ", m->pg_init_delay_msecs); 1737 if (test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags)) 1738 DMEMIT("retain_attached_hw_handler "); |
1739 if (m->queue_mode != DM_TYPE_REQUEST_BASED) { 1740 switch(m->queue_mode) { 1741 case DM_TYPE_BIO_BASED: 1742 DMEMIT("queue_mode bio "); 1743 break; 1744 case DM_TYPE_MQ_REQUEST_BASED: 1745 DMEMIT("queue_mode mq "); 1746 break; 1747 } 1748 } |
|
1712 } 1713 1714 if (!m->hw_handler_name || type == STATUSTYPE_INFO) 1715 DMEMIT("0 "); 1716 else 1717 DMEMIT("1 %s ", m->hw_handler_name); 1718 1719 DMEMIT("%u ", m->nr_priority_groups); --- 270 unchanged lines hidden (view full) --- 1990 return busy; 1991} 1992 1993/*----------------------------------------------------------------- 1994 * Module setup 1995 *---------------------------------------------------------------*/ 1996static struct target_type multipath_target = { 1997 .name = "multipath", | 1749 } 1750 1751 if (!m->hw_handler_name || type == STATUSTYPE_INFO) 1752 DMEMIT("0 "); 1753 else 1754 DMEMIT("1 %s ", m->hw_handler_name); 1755 1756 DMEMIT("%u ", m->nr_priority_groups); --- 270 unchanged lines hidden (view full) --- 2027 return busy; 2028} 2029 2030/*----------------------------------------------------------------- 2031 * Module setup 2032 *---------------------------------------------------------------*/ 2033static struct target_type multipath_target = { 2034 .name = "multipath", |
1998 .version = {1, 11, 0}, | 2035 .version = {1, 12, 0}, |
1999 .features = DM_TARGET_SINGLETON | DM_TARGET_IMMUTABLE, 2000 .module = THIS_MODULE, 2001 .ctr = multipath_ctr, 2002 .dtr = multipath_dtr, 2003 .map_rq = multipath_map, 2004 .clone_and_map_rq = multipath_clone_and_map, 2005 .release_clone_rq = multipath_release_clone, 2006 .rq_end_io = multipath_end_io, | 2036 .features = DM_TARGET_SINGLETON | DM_TARGET_IMMUTABLE, 2037 .module = THIS_MODULE, 2038 .ctr = multipath_ctr, 2039 .dtr = multipath_dtr, 2040 .map_rq = multipath_map, 2041 .clone_and_map_rq = multipath_clone_and_map, 2042 .release_clone_rq = multipath_release_clone, 2043 .rq_end_io = multipath_end_io, |
2007 .presuspend = multipath_presuspend, 2008 .postsuspend = multipath_postsuspend, 2009 .resume = multipath_resume, 2010 .status = multipath_status, 2011 .message = multipath_message, 2012 .prepare_ioctl = multipath_prepare_ioctl, 2013 .iterate_devices = multipath_iterate_devices, 2014 .busy = multipath_busy, 2015}; 2016 2017static struct target_type multipath_bio_target = { 2018 .name = "multipath-bio", 2019 .version = {1, 0, 0}, 2020 .module = THIS_MODULE, 2021 .ctr = multipath_bio_ctr, 2022 .dtr = multipath_dtr, | |
2023 .map = multipath_map_bio, 2024 .end_io = multipath_end_io_bio, 2025 .presuspend = multipath_presuspend, 2026 .postsuspend = multipath_postsuspend, 2027 .resume = multipath_resume, 2028 .status = multipath_status, 2029 .message = multipath_message, 2030 .prepare_ioctl = multipath_prepare_ioctl, --- 12 unchanged lines hidden (view full) --- 2043 2044 r = dm_register_target(&multipath_target); 2045 if (r < 0) { 2046 DMERR("request-based register failed %d", r); 2047 r = -EINVAL; 2048 goto bad_register_target; 2049 } 2050 | 2044 .map = multipath_map_bio, 2045 .end_io = multipath_end_io_bio, 2046 .presuspend = multipath_presuspend, 2047 .postsuspend = multipath_postsuspend, 2048 .resume = multipath_resume, 2049 .status = multipath_status, 2050 .message = multipath_message, 2051 .prepare_ioctl = multipath_prepare_ioctl, --- 12 unchanged lines hidden (view full) --- 2064 2065 r = dm_register_target(&multipath_target); 2066 if (r < 0) { 2067 DMERR("request-based register failed %d", r); 2068 r = -EINVAL; 2069 goto bad_register_target; 2070 } 2071 |
2051 r = dm_register_target(&multipath_bio_target); 2052 if (r < 0) { 2053 DMERR("bio-based register failed %d", r); 2054 r = -EINVAL; 2055 goto bad_register_bio_based_target; 2056 } 2057 | |
2058 kmultipathd = alloc_workqueue("kmpathd", WQ_MEM_RECLAIM, 0); 2059 if (!kmultipathd) { 2060 DMERR("failed to create workqueue kmpathd"); 2061 r = -ENOMEM; 2062 goto bad_alloc_kmultipathd; 2063 } 2064 2065 /* --- 10 unchanged lines hidden (view full) --- 2076 goto bad_alloc_kmpath_handlerd; 2077 } 2078 2079 return 0; 2080 2081bad_alloc_kmpath_handlerd: 2082 destroy_workqueue(kmultipathd); 2083bad_alloc_kmultipathd: | 2072 kmultipathd = alloc_workqueue("kmpathd", WQ_MEM_RECLAIM, 0); 2073 if (!kmultipathd) { 2074 DMERR("failed to create workqueue kmpathd"); 2075 r = -ENOMEM; 2076 goto bad_alloc_kmultipathd; 2077 } 2078 2079 /* --- 10 unchanged lines hidden (view full) --- 2090 goto bad_alloc_kmpath_handlerd; 2091 } 2092 2093 return 0; 2094 2095bad_alloc_kmpath_handlerd: 2096 destroy_workqueue(kmultipathd); 2097bad_alloc_kmultipathd: |
2084 dm_unregister_target(&multipath_bio_target); 2085bad_register_bio_based_target: | |
2086 dm_unregister_target(&multipath_target); 2087bad_register_target: 2088 kmem_cache_destroy(_mpio_cache); 2089 2090 return r; 2091} 2092 2093static void __exit dm_multipath_exit(void) 2094{ 2095 destroy_workqueue(kmpath_handlerd); 2096 destroy_workqueue(kmultipathd); 2097 2098 dm_unregister_target(&multipath_target); | 2098 dm_unregister_target(&multipath_target); 2099bad_register_target: 2100 kmem_cache_destroy(_mpio_cache); 2101 2102 return r; 2103} 2104 2105static void __exit dm_multipath_exit(void) 2106{ 2107 destroy_workqueue(kmpath_handlerd); 2108 destroy_workqueue(kmultipathd); 2109 2110 dm_unregister_target(&multipath_target); |
2099 dm_unregister_target(&multipath_bio_target); | |
2100 kmem_cache_destroy(_mpio_cache); 2101} 2102 2103module_init(dm_multipath_init); 2104module_exit(dm_multipath_exit); 2105 2106MODULE_DESCRIPTION(DM_NAME " multipath target"); 2107MODULE_AUTHOR("Sistina Software <dm-devel@redhat.com>"); 2108MODULE_LICENSE("GPL"); | 2111 kmem_cache_destroy(_mpio_cache); 2112} 2113 2114module_init(dm_multipath_init); 2115module_exit(dm_multipath_exit); 2116 2117MODULE_DESCRIPTION(DM_NAME " multipath target"); 2118MODULE_AUTHOR("Sistina Software <dm-devel@redhat.com>"); 2119MODULE_LICENSE("GPL"); |