10 #include <linux/ctype.h>
14 #include <linux/module.h>
15 #include <linux/slab.h>
17 #define DM_MSG_PREFIX "snapshot exception stores"
39 type = __find_exception_store_type(name);
41 if (type && !try_module_get(type->
module))
74 char *
p, *type_name_dup;
77 type = _get_exception_store_type(type_name);
83 DMERR(
"No memory left to attempt load for \"%s\"", type_name);
87 while (request_module(
"dm-exstore-%s", type_name_dup) ||
88 !(type = _get_exception_store_type(type_name))) {
89 p =
strrchr(type_name_dup,
'-');
96 DMWARN(
"Module for exstore type \"%s\" not found.", type_name);
115 if (!__find_exception_store_type(type->
name))
116 list_add(&type->
list, &_exception_store_types);
129 if (!__find_exception_store_type(type->
name)) {
143 const char *chunk_size_arg,
char **
error)
147 if (
kstrtouint(chunk_size_arg, 10, &chunk_size)) {
148 *error =
"Invalid chunk size";
166 *error =
"Chunk size is not a power of 2";
175 *error =
"Chunk size is not a multiple of device blocksize";
180 *error =
"Chunk size is too high";
202 ti->
error =
"Insufficient exception store arguments";
208 ti->
error =
"Exception store allocation failed";
212 persistent =
toupper(*argv[0]);
213 if (persistent ==
'P')
214 type = get_type(
"P");
215 else if (persistent ==
'N')
216 type = get_type(
"N");
218 ti->
error =
"Persistent flag is not P or N";
224 ti->
error =
"Exception store type not recognised";
232 r = set_chunk_size(tmp_store, argv[1], &ti->
error);
236 r = type->
ctr(tmp_store, 0, NULL);
238 ti->
error =
"Exception store type constructor failed";
256 store->
type->dtr(store);
257 put_type(store->
type);
268 DMERR(
"Unable to register transient exception store type.");
274 DMERR(
"Unable to register persistent exception store type");
275 goto persistent_fail;