Lines Matching refs:ti

40 	struct dm_target *ti;
60 static struct switch_ctx *alloc_switch_ctx(struct dm_target *ti, unsigned int nr_paths,
69 sctx->ti = ti;
72 ti->private = sctx;
77 static int alloc_region_table(struct dm_target *ti, unsigned int nr_paths)
79 struct switch_ctx *sctx = ti->private;
80 sector_t nr_regions = ti->len;
103 ti->error = "Region table too large";
113 ti->error = "Region table too large";
120 ti->error = "Cannot allocate region table";
205 static int parse_path(struct dm_arg_set *as, struct dm_target *ti)
207 struct switch_ctx *sctx = ti->private;
211 r = dm_get_device(ti, dm_shift_arg(as), dm_table_get_mode(ti->table),
214 ti->error = "Device lookup failed";
219 ti->error = "Invalid device starting offset";
220 dm_put_device(ti, sctx->path_list[sctx->nr_paths].dmdev);
232 * Destructor: Don't free the dm_target, just the ti->private data (if any).
234 static void switch_dtr(struct dm_target *ti)
236 struct switch_ctx *sctx = ti->private;
239 dm_put_device(ti, sctx->path_list[sctx->nr_paths].dmdev);
253 static int switch_ctr(struct dm_target *ti, unsigned int argc, char **argv)
269 r = dm_read_arg(_args, &as, &nr_paths, &ti->error);
273 r = dm_read_arg(_args + 1, &as, &region_size, &ti->error);
277 r = dm_read_arg_group(_args + 2, &as, &nr_optional_args, &ti->error);
283 ti->error = "Incorrect number of path arguments";
287 sctx = alloc_switch_ctx(ti, nr_paths, region_size);
289 ti->error = "Cannot allocate redirection context";
293 r = dm_set_target_max_io_len(ti, region_size);
298 r = parse_path(&as, ti);
303 r = alloc_region_table(ti, nr_paths);
310 ti->num_discard_bios = 1;
315 switch_dtr(ti);
320 static int switch_map(struct dm_target *ti, struct bio *bio)
322 struct switch_ctx *sctx = ti->private;
323 sector_t offset = dm_target_offset(ti, bio->bi_iter.bi_sector);
470 static int switch_message(struct dm_target *ti, unsigned int argc, char **argv,
475 struct switch_ctx *sctx = ti->private;
490 static void switch_status(struct dm_target *ti, status_type_t type,
493 struct switch_ctx *sctx = ti->private;
520 static int switch_prepare_ioctl(struct dm_target *ti, struct block_device **bdev)
522 struct switch_ctx *sctx = ti->private;
532 if (ti->len + sctx->path_list[path_nr].start !=
538 static int switch_iterate_devices(struct dm_target *ti,
541 struct switch_ctx *sctx = ti->private;
546 r = fn(ti, sctx->path_list[path_nr].dmdev,
547 sctx->path_list[path_nr].start, ti->len, data);