Lines Matching refs:ti

39 	struct dm_target *ti;
59 static struct switch_ctx *alloc_switch_ctx(struct dm_target *ti, unsigned nr_paths,
68 sctx->ti = ti;
71 ti->private = sctx;
76 static int alloc_region_table(struct dm_target *ti, unsigned nr_paths)
78 struct switch_ctx *sctx = ti->private;
79 sector_t nr_regions = ti->len;
102 ti->error = "Region table too large";
112 ti->error = "Region table too large";
119 ti->error = "Cannot allocate region table";
204 static int parse_path(struct dm_arg_set *as, struct dm_target *ti)
206 struct switch_ctx *sctx = ti->private;
210 r = dm_get_device(ti, dm_shift_arg(as), dm_table_get_mode(ti->table),
213 ti->error = "Device lookup failed";
218 ti->error = "Invalid device starting offset";
219 dm_put_device(ti, sctx->path_list[sctx->nr_paths].dmdev);
231 * Destructor: Don't free the dm_target, just the ti->private data (if any).
233 static void switch_dtr(struct dm_target *ti)
235 struct switch_ctx *sctx = ti->private;
238 dm_put_device(ti, sctx->path_list[sctx->nr_paths].dmdev);
252 static int switch_ctr(struct dm_target *ti, unsigned argc, char **argv)
268 r = dm_read_arg(_args, &as, &nr_paths, &ti->error);
272 r = dm_read_arg(_args + 1, &as, &region_size, &ti->error);
276 r = dm_read_arg_group(_args + 2, &as, &nr_optional_args, &ti->error);
282 ti->error = "Incorrect number of path arguments";
286 sctx = alloc_switch_ctx(ti, nr_paths, region_size);
288 ti->error = "Cannot allocate redirection context";
292 r = dm_set_target_max_io_len(ti, region_size);
297 r = parse_path(&as, ti);
302 r = alloc_region_table(ti, nr_paths);
309 ti->num_discard_bios = 1;
314 switch_dtr(ti);
319 static int switch_map(struct dm_target *ti, struct bio *bio)
321 struct switch_ctx *sctx = ti->private;
322 sector_t offset = dm_target_offset(ti, bio->bi_iter.bi_sector);
469 static int switch_message(struct dm_target *ti, unsigned argc, char **argv,
474 struct switch_ctx *sctx = ti->private;
489 static void switch_status(struct dm_target *ti, status_type_t type,
492 struct switch_ctx *sctx = ti->private;
515 static int switch_prepare_ioctl(struct dm_target *ti, struct block_device **bdev)
517 struct switch_ctx *sctx = ti->private;
527 if (ti->len + sctx->path_list[path_nr].start !=
533 static int switch_iterate_devices(struct dm_target *ti,
536 struct switch_ctx *sctx = ti->private;
541 r = fn(ti, sctx->path_list[path_nr].dmdev,
542 sctx->path_list[path_nr].start, ti->len, data);