struct bow_context *bc;
struct bow_range *br;
int ret;
- struct mapped_device *md = dm_table_get_md(ti->table);
if (argc < 1) {
ti->error = "Invalid argument count";
}
init_completion(&bc->kobj_holder.completion);
- ret = kobject_init_and_add(&bc->kobj_holder.kobj, &bow_ktype,
- &disk_to_dev(dm_disk(md))->kobj, "%s",
- "bow");
- if (ret) {
- ti->error = "Cannot create sysfs node";
- goto bad;
- }
-
mutex_init(&bc->ranges_lock);
bc->ranges = RB_ROOT;
bc->bufio = dm_bufio_client_create(bc->dev->bdev, bc->block_size, 1, 0,
return ret;
}
+void dm_bow_resume(struct dm_target *ti)
+{
+ struct mapped_device *md = dm_table_get_md(ti->table);
+ struct bow_context *bc = ti->private;
+ int ret;
+
+ if (bc->kobj_holder.kobj.state_initialized)
+ return;
+
+ ret = kobject_init_and_add(&bc->kobj_holder.kobj, &bow_ktype,
+ &disk_to_dev(dm_disk(md))->kobj, "%s",
+ "bow");
+ if (ret)
+ ti->error = "Cannot create sysfs node";
+}
+
/****** Handle writes ******/
static int prepare_unchanged_range(struct bow_context *bc, struct bow_range *br,
.version = {1, 2, 0},
.module = THIS_MODULE,
.ctr = dm_bow_ctr,
+ .resume = dm_bow_resume,
.dtr = dm_bow_dtr,
.map = dm_bow_map,
.status = dm_bow_status,