Lines Matching refs:ti

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