Lines Matching +full:- +full:- +full:-
11 * See the COPYING file in the top-level directory for details.
16 #include "qemu/error-report.h"
17 #include "qemu-fsdev-throttle.h"
19 #include "qemu/main-loop.h"
25 qemu_co_enter_next(&fst->throttled_reqs[false], NULL); in fsdev_throttle_read_timer_cb()
31 qemu_co_enter_next(&fst->throttled_reqs[true], NULL); in fsdev_throttle_write_timer_cb()
36 throttle_config_init(&fst->cfg); in fsdev_throttle_parse_opts()
37 fst->cfg.buckets[THROTTLE_BPS_TOTAL].avg = in fsdev_throttle_parse_opts()
38 qemu_opt_get_number(opts, "throttling.bps-total", 0); in fsdev_throttle_parse_opts()
39 fst->cfg.buckets[THROTTLE_BPS_READ].avg = in fsdev_throttle_parse_opts()
40 qemu_opt_get_number(opts, "throttling.bps-read", 0); in fsdev_throttle_parse_opts()
41 fst->cfg.buckets[THROTTLE_BPS_WRITE].avg = in fsdev_throttle_parse_opts()
42 qemu_opt_get_number(opts, "throttling.bps-write", 0); in fsdev_throttle_parse_opts()
43 fst->cfg.buckets[THROTTLE_OPS_TOTAL].avg = in fsdev_throttle_parse_opts()
44 qemu_opt_get_number(opts, "throttling.iops-total", 0); in fsdev_throttle_parse_opts()
45 fst->cfg.buckets[THROTTLE_OPS_READ].avg = in fsdev_throttle_parse_opts()
46 qemu_opt_get_number(opts, "throttling.iops-read", 0); in fsdev_throttle_parse_opts()
47 fst->cfg.buckets[THROTTLE_OPS_WRITE].avg = in fsdev_throttle_parse_opts()
48 qemu_opt_get_number(opts, "throttling.iops-write", 0); in fsdev_throttle_parse_opts()
50 fst->cfg.buckets[THROTTLE_BPS_TOTAL].max = in fsdev_throttle_parse_opts()
51 qemu_opt_get_number(opts, "throttling.bps-total-max", 0); in fsdev_throttle_parse_opts()
52 fst->cfg.buckets[THROTTLE_BPS_READ].max = in fsdev_throttle_parse_opts()
53 qemu_opt_get_number(opts, "throttling.bps-read-max", 0); in fsdev_throttle_parse_opts()
54 fst->cfg.buckets[THROTTLE_BPS_WRITE].max = in fsdev_throttle_parse_opts()
55 qemu_opt_get_number(opts, "throttling.bps-write-max", 0); in fsdev_throttle_parse_opts()
56 fst->cfg.buckets[THROTTLE_OPS_TOTAL].max = in fsdev_throttle_parse_opts()
57 qemu_opt_get_number(opts, "throttling.iops-total-max", 0); in fsdev_throttle_parse_opts()
58 fst->cfg.buckets[THROTTLE_OPS_READ].max = in fsdev_throttle_parse_opts()
59 qemu_opt_get_number(opts, "throttling.iops-read-max", 0); in fsdev_throttle_parse_opts()
60 fst->cfg.buckets[THROTTLE_OPS_WRITE].max = in fsdev_throttle_parse_opts()
61 qemu_opt_get_number(opts, "throttling.iops-write-max", 0); in fsdev_throttle_parse_opts()
63 fst->cfg.buckets[THROTTLE_BPS_TOTAL].burst_length = in fsdev_throttle_parse_opts()
64 qemu_opt_get_number(opts, "throttling.bps-total-max-length", 1); in fsdev_throttle_parse_opts()
65 fst->cfg.buckets[THROTTLE_BPS_READ].burst_length = in fsdev_throttle_parse_opts()
66 qemu_opt_get_number(opts, "throttling.bps-read-max-length", 1); in fsdev_throttle_parse_opts()
67 fst->cfg.buckets[THROTTLE_BPS_WRITE].burst_length = in fsdev_throttle_parse_opts()
68 qemu_opt_get_number(opts, "throttling.bps-write-max-length", 1); in fsdev_throttle_parse_opts()
69 fst->cfg.buckets[THROTTLE_OPS_TOTAL].burst_length = in fsdev_throttle_parse_opts()
70 qemu_opt_get_number(opts, "throttling.iops-total-max-length", 1); in fsdev_throttle_parse_opts()
71 fst->cfg.buckets[THROTTLE_OPS_READ].burst_length = in fsdev_throttle_parse_opts()
72 qemu_opt_get_number(opts, "throttling.iops-read-max-length", 1); in fsdev_throttle_parse_opts()
73 fst->cfg.buckets[THROTTLE_OPS_WRITE].burst_length = in fsdev_throttle_parse_opts()
74 qemu_opt_get_number(opts, "throttling.iops-write-max-length", 1); in fsdev_throttle_parse_opts()
75 fst->cfg.op_size = in fsdev_throttle_parse_opts()
76 qemu_opt_get_number(opts, "throttling.iops-size", 0); in fsdev_throttle_parse_opts()
78 return throttle_is_valid(&fst->cfg, errp) ? 0 : -1; in fsdev_throttle_parse_opts()
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()
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()
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()
119 if (throttle_enabled(&fst->cfg)) { in fsdev_throttle_cleanup()
120 throttle_timers_destroy(&fst->tt); in fsdev_throttle_cleanup()