Lines Matching refs:ti
39 struct dm_target *ti; member
59 static struct switch_ctx *alloc_switch_ctx(struct dm_target *ti, unsigned 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 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()
104 ti->error = "Region table too large"; in alloc_region_table()
113 ti->error = "Region table too large"; in alloc_region_table()
119 ti->error = "Cannot allocate region table"; in alloc_region_table()
204 static int parse_path(struct dm_arg_set *as, struct dm_target *ti) in parse_path() argument
206 struct switch_ctx *sctx = ti->private; in parse_path()
210 r = dm_get_device(ti, dm_shift_arg(as), dm_table_get_mode(ti->table), in parse_path()
213 ti->error = "Device lookup failed"; in parse_path()
218 ti->error = "Invalid device starting offset"; in parse_path()
219 dm_put_device(ti, sctx->path_list[sctx->nr_paths].dmdev); in parse_path()
233 static void switch_dtr(struct dm_target *ti) in switch_dtr() argument
235 struct switch_ctx *sctx = ti->private; in switch_dtr()
238 dm_put_device(ti, sctx->path_list[sctx->nr_paths].dmdev); in switch_dtr()
252 static int switch_ctr(struct dm_target *ti, unsigned argc, char **argv) in switch_ctr() argument
268 r = dm_read_arg(_args, &as, &nr_paths, &ti->error); in switch_ctr()
272 r = dm_read_arg(_args + 1, &as, ®ion_size, &ti->error); in switch_ctr()
276 r = dm_read_arg_group(_args + 2, &as, &nr_optional_args, &ti->error); in switch_ctr()
282 ti->error = "Incorrect number of path arguments"; in switch_ctr()
286 sctx = alloc_switch_ctx(ti, nr_paths, region_size); in switch_ctr()
288 ti->error = "Cannot allocate redirection context"; in switch_ctr()
292 r = dm_set_target_max_io_len(ti, region_size); in switch_ctr()
297 r = parse_path(&as, ti); in switch_ctr()
302 r = alloc_region_table(ti, nr_paths); in switch_ctr()
309 ti->num_discard_bios = 1; in switch_ctr()
314 switch_dtr(ti); in switch_ctr()
319 static int switch_map(struct dm_target *ti, struct bio *bio) in switch_map() argument
321 struct switch_ctx *sctx = ti->private; in switch_map()
322 sector_t offset = dm_target_offset(ti, bio->bi_iter.bi_sector); in switch_map()
469 static int switch_message(struct dm_target *ti, unsigned argc, char **argv) in switch_message() argument
473 struct switch_ctx *sctx = ti->private; in switch_message()
488 static void switch_status(struct dm_target *ti, status_type_t type, in switch_status() argument
491 struct switch_ctx *sctx = ti->private; in switch_status()
514 static int switch_ioctl(struct dm_target *ti, unsigned cmd, in switch_ioctl() argument
517 struct switch_ctx *sctx = ti->private; in switch_ioctl()
531 if (ti->len + sctx->path_list[path_nr].start != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT) in switch_ioctl()
537 static int switch_iterate_devices(struct dm_target *ti, in switch_iterate_devices() argument
540 struct switch_ctx *sctx = ti->private; in switch_iterate_devices()
545 r = fn(ti, sctx->path_list[path_nr].dmdev, in switch_iterate_devices()
546 sctx->path_list[path_nr].start, ti->len, data); in switch_iterate_devices()