Lines Matching refs:fst

24     FsThrottle *fst = opaque;  in fsdev_throttle_read_timer_cb()  local
25 qemu_co_enter_next(&fst->throttled_reqs[false], NULL); in fsdev_throttle_read_timer_cb()
30 FsThrottle *fst = opaque; in fsdev_throttle_write_timer_cb() local
31 qemu_co_enter_next(&fst->throttled_reqs[true], NULL); in fsdev_throttle_write_timer_cb()
34 int fsdev_throttle_parse_opts(QemuOpts *opts, FsThrottle *fst, Error **errp) in fsdev_throttle_parse_opts() argument
36 throttle_config_init(&fst->cfg); in fsdev_throttle_parse_opts()
37 fst->cfg.buckets[THROTTLE_BPS_TOTAL].avg = in fsdev_throttle_parse_opts()
39 fst->cfg.buckets[THROTTLE_BPS_READ].avg = in fsdev_throttle_parse_opts()
41 fst->cfg.buckets[THROTTLE_BPS_WRITE].avg = in fsdev_throttle_parse_opts()
43 fst->cfg.buckets[THROTTLE_OPS_TOTAL].avg = in fsdev_throttle_parse_opts()
45 fst->cfg.buckets[THROTTLE_OPS_READ].avg = in fsdev_throttle_parse_opts()
47 fst->cfg.buckets[THROTTLE_OPS_WRITE].avg = in fsdev_throttle_parse_opts()
50 fst->cfg.buckets[THROTTLE_BPS_TOTAL].max = in fsdev_throttle_parse_opts()
52 fst->cfg.buckets[THROTTLE_BPS_READ].max = in fsdev_throttle_parse_opts()
54 fst->cfg.buckets[THROTTLE_BPS_WRITE].max = in fsdev_throttle_parse_opts()
56 fst->cfg.buckets[THROTTLE_OPS_TOTAL].max = in fsdev_throttle_parse_opts()
58 fst->cfg.buckets[THROTTLE_OPS_READ].max = in fsdev_throttle_parse_opts()
60 fst->cfg.buckets[THROTTLE_OPS_WRITE].max = in fsdev_throttle_parse_opts()
63 fst->cfg.buckets[THROTTLE_BPS_TOTAL].burst_length = in fsdev_throttle_parse_opts()
65 fst->cfg.buckets[THROTTLE_BPS_READ].burst_length = in fsdev_throttle_parse_opts()
67 fst->cfg.buckets[THROTTLE_BPS_WRITE].burst_length = in fsdev_throttle_parse_opts()
69 fst->cfg.buckets[THROTTLE_OPS_TOTAL].burst_length = in fsdev_throttle_parse_opts()
71 fst->cfg.buckets[THROTTLE_OPS_READ].burst_length = in fsdev_throttle_parse_opts()
73 fst->cfg.buckets[THROTTLE_OPS_WRITE].burst_length = in fsdev_throttle_parse_opts()
75 fst->cfg.op_size = in fsdev_throttle_parse_opts()
78 return throttle_is_valid(&fst->cfg, errp) ? 0 : -1; in fsdev_throttle_parse_opts()
81 void fsdev_throttle_init(FsThrottle *fst) in fsdev_throttle_init() argument
83 if (throttle_enabled(&fst->cfg)) { in fsdev_throttle_init()
84 throttle_init(&fst->ts); in fsdev_throttle_init()
85 throttle_timers_init(&fst->tt, in fsdev_throttle_init()
90 fst); in fsdev_throttle_init()
91 throttle_config(&fst->ts, QEMU_CLOCK_REALTIME, &fst->cfg); in fsdev_throttle_init()
92 qemu_co_queue_init(&fst->throttled_reqs[0]); in fsdev_throttle_init()
93 qemu_co_queue_init(&fst->throttled_reqs[1]); in fsdev_throttle_init()
97 void coroutine_fn fsdev_co_throttle_request(FsThrottle *fst, in fsdev_co_throttle_request() argument
102 if (throttle_enabled(&fst->cfg)) { in fsdev_co_throttle_request()
103 if (throttle_schedule_timer(&fst->ts, &fst->tt, direction) || in fsdev_co_throttle_request()
104 !qemu_co_queue_empty(&fst->throttled_reqs[direction])) { in fsdev_co_throttle_request()
105 qemu_co_queue_wait(&fst->throttled_reqs[direction], NULL); in fsdev_co_throttle_request()
108 throttle_account(&fst->ts, direction, iov_size(iov, iovcnt)); in fsdev_co_throttle_request()
110 if (!qemu_co_queue_empty(&fst->throttled_reqs[direction]) && in fsdev_co_throttle_request()
111 !throttle_schedule_timer(&fst->ts, &fst->tt, direction)) { in fsdev_co_throttle_request()
112 qemu_co_queue_next(&fst->throttled_reqs[direction]); in fsdev_co_throttle_request()
117 void fsdev_throttle_cleanup(FsThrottle *fst) in fsdev_throttle_cleanup() argument
119 if (throttle_enabled(&fst->cfg)) { in fsdev_throttle_cleanup()
120 throttle_timers_destroy(&fst->tt); in fsdev_throttle_cleanup()