Lines Matching refs:ti

47 			  struct dm_target *ti)  in parse_features()  argument
64 r = dm_read_arg_group(_args, as, &argc, &ti->error); in parse_features()
77 ti->error = "Feature drop_writes duplicated"; in parse_features()
89 ti->error = "Feature corrupt_bio_byte requires parameters"; in parse_features()
93 r = dm_read_arg(_args + 1, as, &fc->corrupt_bio_byte, &ti->error); in parse_features()
107 ti->error = "Invalid corrupt bio direction (r or w)"; in parse_features()
115 r = dm_read_arg(_args + 2, as, &fc->corrupt_bio_value, &ti->error); in parse_features()
123 r = dm_read_arg(_args + 3, as, &fc->corrupt_bio_flags, &ti->error); in parse_features()
131 ti->error = "Unrecognised flakey feature requested"; in parse_features()
136 ti->error = "drop_writes is incompatible with corrupt_bio_byte with the WRITE flag set"; in parse_features()
155 static int flakey_ctr(struct dm_target *ti, unsigned int argc, char **argv) in flakey_ctr() argument
173 ti->error = "Invalid argument count"; in flakey_ctr()
179 ti->error = "Cannot allocate context"; in flakey_ctr()
187 ti->error = "Invalid device sector"; in flakey_ctr()
192 r = dm_read_arg(_args, &as, &fc->up_interval, &ti->error); in flakey_ctr()
196 r = dm_read_arg(_args, &as, &fc->down_interval, &ti->error); in flakey_ctr()
201 ti->error = "Total (up + down) interval is zero"; in flakey_ctr()
206 ti->error = "Interval overflow"; in flakey_ctr()
210 r = parse_features(&as, fc, ti); in flakey_ctr()
214 if (dm_get_device(ti, devname, dm_table_get_mode(ti->table), &fc->dev)) { in flakey_ctr()
215 ti->error = "Device lookup failed"; in flakey_ctr()
219 ti->num_flush_bios = 1; in flakey_ctr()
220 ti->num_discard_bios = 1; in flakey_ctr()
221 ti->per_bio_data_size = sizeof(struct per_bio_data); in flakey_ctr()
222 ti->private = fc; in flakey_ctr()
230 static void flakey_dtr(struct dm_target *ti) in flakey_dtr() argument
232 struct flakey_c *fc = ti->private; in flakey_dtr()
234 dm_put_device(ti, fc->dev); in flakey_dtr()
238 static sector_t flakey_map_sector(struct dm_target *ti, sector_t bi_sector) in flakey_map_sector() argument
240 struct flakey_c *fc = ti->private; in flakey_map_sector()
242 return fc->start + dm_target_offset(ti, bi_sector); in flakey_map_sector()
245 static void flakey_map_bio(struct dm_target *ti, struct bio *bio) in flakey_map_bio() argument
247 struct flakey_c *fc = ti->private; in flakey_map_bio()
252 flakey_map_sector(ti, bio->bi_iter.bi_sector); in flakey_map_bio()
274 static int flakey_map(struct dm_target *ti, struct bio *bio) in flakey_map() argument
276 struct flakey_c *fc = ti->private; in flakey_map()
319 flakey_map_bio(ti, bio); in flakey_map()
324 static int flakey_end_io(struct dm_target *ti, struct bio *bio, int error) in flakey_end_io() argument
326 struct flakey_c *fc = ti->private; in flakey_end_io()
341 static void flakey_status(struct dm_target *ti, status_type_t type, in flakey_status() argument
345 struct flakey_c *fc = ti->private; in flakey_status()
374 static int flakey_ioctl(struct dm_target *ti, unsigned int cmd, unsigned long arg) in flakey_ioctl() argument
376 struct flakey_c *fc = ti->private; in flakey_ioctl()
384 ti->len != i_size_read(dev->bdev->bd_inode) >> SECTOR_SHIFT) in flakey_ioctl()
390 static int flakey_merge(struct dm_target *ti, struct bvec_merge_data *bvm, in flakey_merge() argument
393 struct flakey_c *fc = ti->private; in flakey_merge()
400 bvm->bi_sector = flakey_map_sector(ti, bvm->bi_sector); in flakey_merge()
405 static int flakey_iterate_devices(struct dm_target *ti, iterate_devices_callout_fn fn, void *data) in flakey_iterate_devices() argument
407 struct flakey_c *fc = ti->private; in flakey_iterate_devices()
409 return fn(ti, fc->dev, fc->start, ti->len, data); in flakey_iterate_devices()