Lines Matching refs:ti
55 struct dm_target *ti) in parse_features() argument
69 if (as->argc && (r = dm_read_arg_group(_args, as, &argc, &ti->error))) in parse_features()
81 ti->error = "Insufficient feature arguments"; in parse_features()
90 ti->error = "Feature error_reads duplicated"; in parse_features()
101 ti->error = "Feature drop_writes duplicated"; in parse_features()
104 ti->error = "Feature drop_writes conflicts with feature error_writes"; in parse_features()
116 ti->error = "Feature error_writes duplicated"; in parse_features()
120 ti->error = "Feature error_writes conflicts with feature drop_writes"; in parse_features()
132 ti->error = "Feature corrupt_bio_byte duplicated"; in parse_features()
135 ti->error = "Feature corrupt_bio_byte requires 4 parameters"; in parse_features()
139 r = dm_read_arg(_args + 1, as, &fc->corrupt_bio_byte, &ti->error); in parse_features()
153 ti->error = "Invalid corrupt bio direction (r or w)"; in parse_features()
161 r = dm_read_arg(_args + 2, as, &fc->corrupt_bio_value, &ti->error); in parse_features()
173 &ti->error); in parse_features()
183 ti->error = "Feature random_read_corrupt duplicated"; in parse_features()
186 ti->error = "Feature random_read_corrupt requires a parameter"; in parse_features()
189 r = dm_read_arg(_args + 4, as, &fc->random_read_corrupt, &ti->error); in parse_features()
199 ti->error = "Feature random_write_corrupt duplicated"; in parse_features()
202 ti->error = "Feature random_write_corrupt requires a parameter"; in parse_features()
205 r = dm_read_arg(_args + 4, as, &fc->random_write_corrupt, &ti->error); in parse_features()
213 ti->error = "Unrecognised flakey feature requested"; in parse_features()
220 …ti->error = "drop_writes is incompatible with random_write_corrupt or corrupt_bio_byte with the WR… in parse_features()
226 …ti->error = "error_writes is incompatible with random_write_corrupt or corrupt_bio_byte with the W… in parse_features()
231 …ti->error = "error_reads is incompatible with random_read_corrupt or corrupt_bio_byte with the REA… in parse_features()
258 static int flakey_ctr(struct dm_target *ti, unsigned int argc, char **argv) in flakey_ctr() argument
276 ti->error = "Invalid argument count"; in flakey_ctr()
282 ti->error = "Cannot allocate context"; in flakey_ctr()
291 ti->error = "Invalid device sector"; in flakey_ctr()
296 r = dm_read_arg(_args, &as, &fc->up_interval, &ti->error); in flakey_ctr()
300 r = dm_read_arg(_args + 1, &as, &fc->down_interval, &ti->error); in flakey_ctr()
305 ti->error = "Total (up + down) interval is zero"; in flakey_ctr()
311 ti->error = "Interval overflow"; in flakey_ctr()
316 r = parse_features(&as, fc, ti); in flakey_ctr()
320 r = dm_get_device(ti, devname, dm_table_get_mode(ti->table), &fc->dev); in flakey_ctr()
322 ti->error = "Device lookup failed"; in flakey_ctr()
326 ti->num_flush_bios = 1; in flakey_ctr()
327 ti->num_discard_bios = 1; in flakey_ctr()
328 ti->per_io_data_size = sizeof(struct per_bio_data); in flakey_ctr()
329 ti->private = fc; in flakey_ctr()
337 static void flakey_dtr(struct dm_target *ti) in flakey_dtr() argument
339 struct flakey_c *fc = ti->private; in flakey_dtr()
341 dm_put_device(ti, fc->dev); in flakey_dtr()
345 static sector_t flakey_map_sector(struct dm_target *ti, sector_t bi_sector) in flakey_map_sector() argument
347 struct flakey_c *fc = ti->private; in flakey_map_sector()
349 return fc->start + dm_target_offset(ti, bi_sector); in flakey_map_sector()
352 static void flakey_map_bio(struct dm_target *ti, struct bio *bio) in flakey_map_bio() argument
354 struct flakey_c *fc = ti->private; in flakey_map_bio()
357 bio->bi_iter.bi_sector = flakey_map_sector(ti, bio->bi_iter.bi_sector); in flakey_map_bio()
428 static struct bio *clone_bio(struct dm_target *ti, struct flakey_c *fc, struct bio *bio) in clone_bio() argument
446 clone->bi_iter.bi_sector = flakey_map_sector(ti, bio->bi_iter.bi_sector); in clone_bio()
493 static int flakey_map(struct dm_target *ti, struct bio *bio) in flakey_map() argument
495 struct flakey_c *fc = ti->private; in flakey_map()
553 struct bio *clone = clone_bio(ti, fc, bio); in flakey_map()
568 flakey_map_bio(ti, bio); in flakey_map()
573 static int flakey_end_io(struct dm_target *ti, struct bio *bio, in flakey_end_io() argument
576 struct flakey_c *fc = ti->private; in flakey_end_io()
603 static void flakey_status(struct dm_target *ti, status_type_t type, in flakey_status() argument
607 struct flakey_c *fc = ti->private; in flakey_status()
654 static int flakey_prepare_ioctl(struct dm_target *ti, struct block_device **bdev, in flakey_prepare_ioctl() argument
658 struct flakey_c *fc = ti->private; in flakey_prepare_ioctl()
665 if (fc->start || ti->len != bdev_nr_sectors((*bdev))) in flakey_prepare_ioctl()
671 static int flakey_report_zones(struct dm_target *ti, in flakey_report_zones() argument
674 struct flakey_c *fc = ti->private; in flakey_report_zones()
677 flakey_map_sector(ti, args->next_sector), in flakey_report_zones()
684 static int flakey_iterate_devices(struct dm_target *ti, iterate_devices_callout_fn fn, void *data) in flakey_iterate_devices() argument
686 struct flakey_c *fc = ti->private; in flakey_iterate_devices()
688 return fn(ti, fc->dev, fc->start, ti->len, data); in flakey_iterate_devices()