Lines Matching refs:tfc
66 #define FLAKEY_CORRUPT_DIR(tfc) \ argument
67 ((tfc)->corrupt_buf_rw == BUF_CMD_READ ? 'r' : 'w')
135 dm_target_flakey_config_t *tfc; in dm_target_flakey_init() local
150 tfc = kmem_alloc(sizeof(dm_target_flakey_config_t), KM_SLEEP); in dm_target_flakey_init()
151 tfc->pdev = dmp; in dm_target_flakey_init()
152 tfc->offset = atoi64(argv[1]); in dm_target_flakey_init()
153 tfc->up_int = atoi64(argv[2]); in dm_target_flakey_init()
154 tfc->down_int = atoi64(argv[3]); in dm_target_flakey_init()
155 tfc->offset_time = tick; in dm_target_flakey_init()
157 if ((tfc->up_int + tfc->down_int) == 0) { in dm_target_flakey_init()
163 if (tfc->up_int + tfc->down_int < tfc->up_int) { in dm_target_flakey_init()
169 err = _init_features(tfc, argc - 4, argv + 4); in dm_target_flakey_init()
174 table_en->target_config = tfc; in dm_target_flakey_init()
178 kmem_free(tfc, sizeof(*tfc)); in dm_target_flakey_init()
183 _init_features(dm_target_flakey_config_t *tfc, int argc, char **argv) in _init_features() argument
203 tfc->drop_writes = 1; in _init_features()
223 tfc->corrupt_buf_byte = value; in _init_features()
229 tfc->corrupt_buf_rw = BUF_CMD_READ; in _init_features()
231 tfc->corrupt_buf_rw = BUF_CMD_WRITE; in _init_features()
246 tfc->corrupt_buf_value = value; in _init_features()
250 tfc->corrupt_buf_flags = atoi64(*argv++); in _init_features()
259 if (tfc->drop_writes && (tfc->corrupt_buf_rw == BUF_CMD_WRITE)) { in _init_features()
271 dm_target_flakey_config_t *tfc; in dm_target_flakey_table() local
275 tfc = target_config; in dm_target_flakey_table()
276 KASSERT(tfc != NULL); in dm_target_flakey_table()
280 drop_writes = tfc->drop_writes; in dm_target_flakey_table()
285 tfc->pdev->udev_name, tfc->offset_time, in dm_target_flakey_table()
286 tfc->up_int, tfc->down_int, in dm_target_flakey_table()
287 drop_writes + (tfc->corrupt_buf_byte > 0) * 5); in dm_target_flakey_table()
292 if (tfc->corrupt_buf_byte) in dm_target_flakey_table()
295 tfc->corrupt_buf_byte, in dm_target_flakey_table()
296 FLAKEY_CORRUPT_DIR(tfc), in dm_target_flakey_table()
297 tfc->corrupt_buf_value, in dm_target_flakey_table()
298 tfc->corrupt_buf_flags); in dm_target_flakey_table()
311 dm_target_flakey_config_t *tfc; local
316 tfc = table_en->target_config;
318 elapsed = (tick - tfc->offset_time) / hz;
319 if (elapsed % (tfc->up_int + tfc->down_int) >= tfc->up_int) {
324 return _flakey_read(tfc, bp);
326 return _flakey_write(tfc, bp);
330 _submit(tfc, bp);
336 _submit(dm_target_flakey_config_t *tfc, struct buf *bp) argument
339 bp->b_blkno += tfc->offset;
340 VOP_STRATEGY(tfc->pdev->pdev_vnode, bp);
355 dm_target_flakey_config_t *tfc; local
375 tfc = bp->b_private2;
380 if (tfc->corrupt_buf_byte && tfc->corrupt_buf_rw == BUF_CMD_READ)
381 _flakey_corrupt_buf(tfc, mbp);
382 else if (!tfc->drop_writes)
391 _flakey_read(dm_target_flakey_config_t *tfc, struct buf *bp) argument
399 if (!tfc->corrupt_buf_byte && !tfc->drop_writes) {
410 nestbuf->b_private2 = tfc;
412 _submit(tfc, nestbuf);
418 _flakey_write(dm_target_flakey_config_t *tfc, struct buf *bp) argument
421 if (tfc->drop_writes) {
427 if (tfc->corrupt_buf_byte && tfc->corrupt_buf_rw == BUF_CMD_WRITE) {
428 _flakey_corrupt_buf(tfc, bp);
429 _submit(tfc, bp);
441 _flakey_corrupt_buf(dm_target_flakey_config_t *tfc, struct buf *bp) argument
449 if (bp->b_bcount < tfc->corrupt_buf_byte)
451 if ((bp->b_flags & tfc->corrupt_buf_flags) != tfc->corrupt_buf_flags)
455 buf[tfc->corrupt_buf_byte - 1] = tfc->corrupt_buf_value;
458 bp, FLAKEY_CORRUPT_DIR(tfc), bp->b_blkno, tfc->corrupt_buf_byte,
459 tfc->corrupt_buf_value);
467 dm_target_flakey_config_t *tfc; local
470 tfc = table_en->target_config;
473 return VOP_IOCTL(tfc->pdev->pdev_vnode, DIOCCACHESYNC, &cmd,
484 dm_target_flakey_config_t *tfc = table_en->target_config; local
487 dm_pdev_decr(tfc->pdev);
489 kmem_free(tfc, sizeof(*tfc));
509 dm_target_flakey_config_t *tfc; local
514 tfc = table_en->target_config;
515 if (tfc != NULL)
516 secsize = tfc->pdev->pdev_secsize;