throttle.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. /*
  2. * QEMU throttling infrastructure
  3. *
  4. * Copyright (C) Nodalink, EURL. 2013-2014
  5. * Copyright (C) Igalia, S.L. 2015
  6. *
  7. * Authors:
  8. * Benoît Canet <benoit.canet@nodalink.com>
  9. * Alberto Garcia <berto@igalia.com>
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License as
  13. * published by the Free Software Foundation; either version 2 or
  14. * (at your option) version 3 of the License.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  23. */
  24. #include "qemu/osdep.h"
  25. #include "qapi/error.h"
  26. #include "qemu/throttle.h"
  27. #include "qemu/timer.h"
  28. #include "block/aio.h"
  29. /* This function make a bucket leak
  30. *
  31. * @bkt: the bucket to make leak
  32. * @delta_ns: the time delta
  33. */
  34. void throttle_leak_bucket(LeakyBucket *bkt, int64_t delta_ns)
  35. {
  36. double leak;
  37. /* compute how much to leak */
  38. leak = (bkt->avg * (double) delta_ns) / NANOSECONDS_PER_SECOND;
  39. /* make the bucket leak */
  40. bkt->level = MAX(bkt->level - leak, 0);
  41. /* if we allow bursts for more than one second we also need to
  42. * keep track of bkt->burst_level so the bkt->max goal per second
  43. * is attained */
  44. if (bkt->burst_length > 1) {
  45. leak = (bkt->max * (double) delta_ns) / NANOSECONDS_PER_SECOND;
  46. bkt->burst_level = MAX(bkt->burst_level - leak, 0);
  47. }
  48. }
  49. /* Calculate the time delta since last leak and make proportionals leaks
  50. *
  51. * @now: the current timestamp in ns
  52. */
  53. static void throttle_do_leak(ThrottleState *ts, int64_t now)
  54. {
  55. /* compute the time elapsed since the last leak */
  56. int64_t delta_ns = now - ts->previous_leak;
  57. int i;
  58. ts->previous_leak = now;
  59. if (delta_ns <= 0) {
  60. return;
  61. }
  62. /* make each bucket leak */
  63. for (i = 0; i < BUCKETS_COUNT; i++) {
  64. throttle_leak_bucket(&ts->cfg.buckets[i], delta_ns);
  65. }
  66. }
  67. /* do the real job of computing the time to wait
  68. *
  69. * @limit: the throttling limit
  70. * @extra: the number of operation to delay
  71. * @ret: the time to wait in ns
  72. */
  73. static int64_t throttle_do_compute_wait(double limit, double extra)
  74. {
  75. double wait = extra * NANOSECONDS_PER_SECOND;
  76. wait /= limit;
  77. return wait;
  78. }
  79. /* This function compute the wait time in ns that a leaky bucket should trigger
  80. *
  81. * @bkt: the leaky bucket we operate on
  82. * @ret: the resulting wait time in ns or 0 if the operation can go through
  83. */
  84. int64_t throttle_compute_wait(LeakyBucket *bkt)
  85. {
  86. double extra; /* the number of extra units blocking the io */
  87. double bucket_size; /* I/O before throttling to bkt->avg */
  88. double burst_bucket_size; /* Before throttling to bkt->max */
  89. if (!bkt->avg) {
  90. return 0;
  91. }
  92. if (!bkt->max) {
  93. /* If bkt->max is 0 we still want to allow short bursts of I/O
  94. * from the guest, otherwise every other request will be throttled
  95. * and performance will suffer considerably. */
  96. bucket_size = (double) bkt->avg / 10;
  97. burst_bucket_size = 0;
  98. } else {
  99. /* If we have a burst limit then we have to wait until all I/O
  100. * at burst rate has finished before throttling to bkt->avg */
  101. bucket_size = bkt->max * bkt->burst_length;
  102. burst_bucket_size = (double) bkt->max / 10;
  103. }
  104. /* If the main bucket is full then we have to wait */
  105. extra = bkt->level - bucket_size;
  106. if (extra > 0) {
  107. return throttle_do_compute_wait(bkt->avg, extra);
  108. }
  109. /* If the main bucket is not full yet we still have to check the
  110. * burst bucket in order to enforce the burst limit */
  111. if (bkt->burst_length > 1) {
  112. assert(bkt->max > 0); /* see throttle_is_valid() */
  113. extra = bkt->burst_level - burst_bucket_size;
  114. if (extra > 0) {
  115. return throttle_do_compute_wait(bkt->max, extra);
  116. }
  117. }
  118. return 0;
  119. }
  120. /* This function compute the time that must be waited while this IO
  121. *
  122. * @is_write: true if the current IO is a write, false if it's a read
  123. * @ret: time to wait
  124. */
  125. static int64_t throttle_compute_wait_for(ThrottleState *ts,
  126. bool is_write)
  127. {
  128. BucketType to_check[2][4] = { {THROTTLE_BPS_TOTAL,
  129. THROTTLE_OPS_TOTAL,
  130. THROTTLE_BPS_READ,
  131. THROTTLE_OPS_READ},
  132. {THROTTLE_BPS_TOTAL,
  133. THROTTLE_OPS_TOTAL,
  134. THROTTLE_BPS_WRITE,
  135. THROTTLE_OPS_WRITE}, };
  136. int64_t wait, max_wait = 0;
  137. int i;
  138. for (i = 0; i < 4; i++) {
  139. BucketType index = to_check[is_write][i];
  140. wait = throttle_compute_wait(&ts->cfg.buckets[index]);
  141. if (wait > max_wait) {
  142. max_wait = wait;
  143. }
  144. }
  145. return max_wait;
  146. }
  147. /* compute the timer for this type of operation
  148. *
  149. * @is_write: the type of operation
  150. * @now: the current clock timestamp
  151. * @next_timestamp: the resulting timer
  152. * @ret: true if a timer must be set
  153. */
  154. static bool throttle_compute_timer(ThrottleState *ts,
  155. bool is_write,
  156. int64_t now,
  157. int64_t *next_timestamp)
  158. {
  159. int64_t wait;
  160. /* leak proportionally to the time elapsed */
  161. throttle_do_leak(ts, now);
  162. /* compute the wait time if any */
  163. wait = throttle_compute_wait_for(ts, is_write);
  164. /* if the code must wait compute when the next timer should fire */
  165. if (wait) {
  166. *next_timestamp = now + wait;
  167. return true;
  168. }
  169. /* else no need to wait at all */
  170. *next_timestamp = now;
  171. return false;
  172. }
  173. /* Add timers to event loop */
  174. void throttle_timers_attach_aio_context(ThrottleTimers *tt,
  175. AioContext *new_context)
  176. {
  177. tt->timers[0] = aio_timer_new(new_context, tt->clock_type, SCALE_NS,
  178. tt->read_timer_cb, tt->timer_opaque);
  179. tt->timers[1] = aio_timer_new(new_context, tt->clock_type, SCALE_NS,
  180. tt->write_timer_cb, tt->timer_opaque);
  181. }
  182. /*
  183. * Initialize the ThrottleConfig structure to a valid state
  184. * @cfg: the config to initialize
  185. */
  186. void throttle_config_init(ThrottleConfig *cfg)
  187. {
  188. unsigned i;
  189. memset(cfg, 0, sizeof(*cfg));
  190. for (i = 0; i < BUCKETS_COUNT; i++) {
  191. cfg->buckets[i].burst_length = 1;
  192. }
  193. }
  194. /* To be called first on the ThrottleState */
  195. void throttle_init(ThrottleState *ts)
  196. {
  197. memset(ts, 0, sizeof(ThrottleState));
  198. throttle_config_init(&ts->cfg);
  199. }
  200. /* To be called first on the ThrottleTimers */
  201. void throttle_timers_init(ThrottleTimers *tt,
  202. AioContext *aio_context,
  203. QEMUClockType clock_type,
  204. QEMUTimerCB *read_timer_cb,
  205. QEMUTimerCB *write_timer_cb,
  206. void *timer_opaque)
  207. {
  208. memset(tt, 0, sizeof(ThrottleTimers));
  209. tt->clock_type = clock_type;
  210. tt->read_timer_cb = read_timer_cb;
  211. tt->write_timer_cb = write_timer_cb;
  212. tt->timer_opaque = timer_opaque;
  213. throttle_timers_attach_aio_context(tt, aio_context);
  214. }
  215. /* destroy a timer */
  216. static void throttle_timer_destroy(QEMUTimer **timer)
  217. {
  218. assert(*timer != NULL);
  219. timer_free(*timer);
  220. *timer = NULL;
  221. }
  222. /* Remove timers from event loop */
  223. void throttle_timers_detach_aio_context(ThrottleTimers *tt)
  224. {
  225. int i;
  226. for (i = 0; i < 2; i++) {
  227. throttle_timer_destroy(&tt->timers[i]);
  228. }
  229. }
  230. /* To be called last on the ThrottleTimers */
  231. void throttle_timers_destroy(ThrottleTimers *tt)
  232. {
  233. throttle_timers_detach_aio_context(tt);
  234. }
  235. /* is any throttling timer configured */
  236. bool throttle_timers_are_initialized(ThrottleTimers *tt)
  237. {
  238. if (tt->timers[0]) {
  239. return true;
  240. }
  241. return false;
  242. }
  243. /* Does any throttling must be done
  244. *
  245. * @cfg: the throttling configuration to inspect
  246. * @ret: true if throttling must be done else false
  247. */
  248. bool throttle_enabled(ThrottleConfig *cfg)
  249. {
  250. int i;
  251. for (i = 0; i < BUCKETS_COUNT; i++) {
  252. if (cfg->buckets[i].avg > 0) {
  253. return true;
  254. }
  255. }
  256. return false;
  257. }
  258. /* check if a throttling configuration is valid
  259. * @cfg: the throttling configuration to inspect
  260. * @ret: true if valid else false
  261. * @errp: error object
  262. */
  263. bool throttle_is_valid(ThrottleConfig *cfg, Error **errp)
  264. {
  265. int i;
  266. bool bps_flag, ops_flag;
  267. bool bps_max_flag, ops_max_flag;
  268. bps_flag = cfg->buckets[THROTTLE_BPS_TOTAL].avg &&
  269. (cfg->buckets[THROTTLE_BPS_READ].avg ||
  270. cfg->buckets[THROTTLE_BPS_WRITE].avg);
  271. ops_flag = cfg->buckets[THROTTLE_OPS_TOTAL].avg &&
  272. (cfg->buckets[THROTTLE_OPS_READ].avg ||
  273. cfg->buckets[THROTTLE_OPS_WRITE].avg);
  274. bps_max_flag = cfg->buckets[THROTTLE_BPS_TOTAL].max &&
  275. (cfg->buckets[THROTTLE_BPS_READ].max ||
  276. cfg->buckets[THROTTLE_BPS_WRITE].max);
  277. ops_max_flag = cfg->buckets[THROTTLE_OPS_TOTAL].max &&
  278. (cfg->buckets[THROTTLE_OPS_READ].max ||
  279. cfg->buckets[THROTTLE_OPS_WRITE].max);
  280. if (bps_flag || ops_flag || bps_max_flag || ops_max_flag) {
  281. error_setg(errp, "bps/iops/max total values and read/write values"
  282. " cannot be used at the same time");
  283. return false;
  284. }
  285. if (cfg->op_size &&
  286. !cfg->buckets[THROTTLE_OPS_TOTAL].avg &&
  287. !cfg->buckets[THROTTLE_OPS_READ].avg &&
  288. !cfg->buckets[THROTTLE_OPS_WRITE].avg) {
  289. error_setg(errp, "iops size requires an iops value to be set");
  290. return false;
  291. }
  292. for (i = 0; i < BUCKETS_COUNT; i++) {
  293. LeakyBucket *bkt = &cfg->buckets[i];
  294. if (bkt->avg > THROTTLE_VALUE_MAX || bkt->max > THROTTLE_VALUE_MAX) {
  295. error_setg(errp, "bps/iops/max values must be within [0, %lld]",
  296. THROTTLE_VALUE_MAX);
  297. return false;
  298. }
  299. if (!bkt->burst_length) {
  300. error_setg(errp, "the burst length cannot be 0");
  301. return false;
  302. }
  303. if (bkt->burst_length > 1 && !bkt->max) {
  304. error_setg(errp, "burst length set without burst rate");
  305. return false;
  306. }
  307. if (bkt->max && bkt->burst_length > THROTTLE_VALUE_MAX / bkt->max) {
  308. error_setg(errp, "burst length too high for this burst rate");
  309. return false;
  310. }
  311. if (bkt->max && !bkt->avg) {
  312. error_setg(errp, "bps_max/iops_max require corresponding"
  313. " bps/iops values");
  314. return false;
  315. }
  316. if (bkt->max && bkt->max < bkt->avg) {
  317. error_setg(errp, "bps_max/iops_max cannot be lower than bps/iops");
  318. return false;
  319. }
  320. }
  321. return true;
  322. }
  323. /* Used to configure the throttle
  324. *
  325. * @ts: the throttle state we are working on
  326. * @clock_type: the group's clock_type
  327. * @cfg: the config to set
  328. */
  329. void throttle_config(ThrottleState *ts,
  330. QEMUClockType clock_type,
  331. ThrottleConfig *cfg)
  332. {
  333. int i;
  334. ts->cfg = *cfg;
  335. /* Zero bucket level */
  336. for (i = 0; i < BUCKETS_COUNT; i++) {
  337. ts->cfg.buckets[i].level = 0;
  338. ts->cfg.buckets[i].burst_level = 0;
  339. }
  340. ts->previous_leak = qemu_clock_get_ns(clock_type);
  341. }
  342. /* used to get config
  343. *
  344. * @ts: the throttle state we are working on
  345. * @cfg: the config to write
  346. */
  347. void throttle_get_config(ThrottleState *ts, ThrottleConfig *cfg)
  348. {
  349. *cfg = ts->cfg;
  350. }
  351. /* Schedule the read or write timer if needed
  352. *
  353. * NOTE: this function is not unit tested due to it's usage of timer_mod
  354. *
  355. * @tt: the timers structure
  356. * @is_write: the type of operation (read/write)
  357. * @ret: true if the timer has been scheduled else false
  358. */
  359. bool throttle_schedule_timer(ThrottleState *ts,
  360. ThrottleTimers *tt,
  361. bool is_write)
  362. {
  363. int64_t now = qemu_clock_get_ns(tt->clock_type);
  364. int64_t next_timestamp;
  365. bool must_wait;
  366. must_wait = throttle_compute_timer(ts,
  367. is_write,
  368. now,
  369. &next_timestamp);
  370. /* request not throttled */
  371. if (!must_wait) {
  372. return false;
  373. }
  374. /* request throttled and timer pending -> do nothing */
  375. if (timer_pending(tt->timers[is_write])) {
  376. return true;
  377. }
  378. /* request throttled and timer not pending -> arm timer */
  379. timer_mod(tt->timers[is_write], next_timestamp);
  380. return true;
  381. }
  382. /* do the accounting for this operation
  383. *
  384. * @is_write: the type of operation (read/write)
  385. * @size: the size of the operation
  386. */
  387. void throttle_account(ThrottleState *ts, bool is_write, uint64_t size)
  388. {
  389. const BucketType bucket_types_size[2][2] = {
  390. { THROTTLE_BPS_TOTAL, THROTTLE_BPS_READ },
  391. { THROTTLE_BPS_TOTAL, THROTTLE_BPS_WRITE }
  392. };
  393. const BucketType bucket_types_units[2][2] = {
  394. { THROTTLE_OPS_TOTAL, THROTTLE_OPS_READ },
  395. { THROTTLE_OPS_TOTAL, THROTTLE_OPS_WRITE }
  396. };
  397. double units = 1.0;
  398. unsigned i;
  399. /* if cfg.op_size is defined and smaller than size we compute unit count */
  400. if (ts->cfg.op_size && size > ts->cfg.op_size) {
  401. units = (double) size / ts->cfg.op_size;
  402. }
  403. for (i = 0; i < 2; i++) {
  404. LeakyBucket *bkt;
  405. bkt = &ts->cfg.buckets[bucket_types_size[is_write][i]];
  406. bkt->level += size;
  407. if (bkt->burst_length > 1) {
  408. bkt->burst_level += size;
  409. }
  410. bkt = &ts->cfg.buckets[bucket_types_units[is_write][i]];
  411. bkt->level += units;
  412. if (bkt->burst_length > 1) {
  413. bkt->burst_level += units;
  414. }
  415. }
  416. }
  417. /* return a ThrottleConfig based on the options in a ThrottleLimits
  418. *
  419. * @arg: the ThrottleLimits object to read from
  420. * @cfg: the ThrottleConfig to edit
  421. * @errp: error object
  422. */
  423. void throttle_limits_to_config(ThrottleLimits *arg, ThrottleConfig *cfg,
  424. Error **errp)
  425. {
  426. if (arg->has_bps_total) {
  427. cfg->buckets[THROTTLE_BPS_TOTAL].avg = arg->bps_total;
  428. }
  429. if (arg->has_bps_read) {
  430. cfg->buckets[THROTTLE_BPS_READ].avg = arg->bps_read;
  431. }
  432. if (arg->has_bps_write) {
  433. cfg->buckets[THROTTLE_BPS_WRITE].avg = arg->bps_write;
  434. }
  435. if (arg->has_iops_total) {
  436. cfg->buckets[THROTTLE_OPS_TOTAL].avg = arg->iops_total;
  437. }
  438. if (arg->has_iops_read) {
  439. cfg->buckets[THROTTLE_OPS_READ].avg = arg->iops_read;
  440. }
  441. if (arg->has_iops_write) {
  442. cfg->buckets[THROTTLE_OPS_WRITE].avg = arg->iops_write;
  443. }
  444. if (arg->has_bps_total_max) {
  445. cfg->buckets[THROTTLE_BPS_TOTAL].max = arg->bps_total_max;
  446. }
  447. if (arg->has_bps_read_max) {
  448. cfg->buckets[THROTTLE_BPS_READ].max = arg->bps_read_max;
  449. }
  450. if (arg->has_bps_write_max) {
  451. cfg->buckets[THROTTLE_BPS_WRITE].max = arg->bps_write_max;
  452. }
  453. if (arg->has_iops_total_max) {
  454. cfg->buckets[THROTTLE_OPS_TOTAL].max = arg->iops_total_max;
  455. }
  456. if (arg->has_iops_read_max) {
  457. cfg->buckets[THROTTLE_OPS_READ].max = arg->iops_read_max;
  458. }
  459. if (arg->has_iops_write_max) {
  460. cfg->buckets[THROTTLE_OPS_WRITE].max = arg->iops_write_max;
  461. }
  462. if (arg->has_bps_total_max_length) {
  463. if (arg->bps_total_max_length > UINT_MAX) {
  464. error_setg(errp, "bps-total-max-length value must be in"
  465. " the range [0, %u]", UINT_MAX);
  466. return;
  467. }
  468. cfg->buckets[THROTTLE_BPS_TOTAL].burst_length = arg->bps_total_max_length;
  469. }
  470. if (arg->has_bps_read_max_length) {
  471. if (arg->bps_read_max_length > UINT_MAX) {
  472. error_setg(errp, "bps-read-max-length value must be in"
  473. " the range [0, %u]", UINT_MAX);
  474. return;
  475. }
  476. cfg->buckets[THROTTLE_BPS_READ].burst_length = arg->bps_read_max_length;
  477. }
  478. if (arg->has_bps_write_max_length) {
  479. if (arg->bps_write_max_length > UINT_MAX) {
  480. error_setg(errp, "bps-write-max-length value must be in"
  481. " the range [0, %u]", UINT_MAX);
  482. return;
  483. }
  484. cfg->buckets[THROTTLE_BPS_WRITE].burst_length = arg->bps_write_max_length;
  485. }
  486. if (arg->has_iops_total_max_length) {
  487. if (arg->iops_total_max_length > UINT_MAX) {
  488. error_setg(errp, "iops-total-max-length value must be in"
  489. " the range [0, %u]", UINT_MAX);
  490. return;
  491. }
  492. cfg->buckets[THROTTLE_OPS_TOTAL].burst_length = arg->iops_total_max_length;
  493. }
  494. if (arg->has_iops_read_max_length) {
  495. if (arg->iops_read_max_length > UINT_MAX) {
  496. error_setg(errp, "iops-read-max-length value must be in"
  497. " the range [0, %u]", UINT_MAX);
  498. return;
  499. }
  500. cfg->buckets[THROTTLE_OPS_READ].burst_length = arg->iops_read_max_length;
  501. }
  502. if (arg->has_iops_write_max_length) {
  503. if (arg->iops_write_max_length > UINT_MAX) {
  504. error_setg(errp, "iops-write-max-length value must be in"
  505. " the range [0, %u]", UINT_MAX);
  506. return;
  507. }
  508. cfg->buckets[THROTTLE_OPS_WRITE].burst_length = arg->iops_write_max_length;
  509. }
  510. if (arg->has_iops_size) {
  511. cfg->op_size = arg->iops_size;
  512. }
  513. throttle_is_valid(cfg, errp);
  514. }
  515. /* write the options of a ThrottleConfig to a ThrottleLimits
  516. *
  517. * @cfg: the ThrottleConfig to read from
  518. * @var: the ThrottleLimits to write to
  519. */
  520. void throttle_config_to_limits(ThrottleConfig *cfg, ThrottleLimits *var)
  521. {
  522. var->bps_total = cfg->buckets[THROTTLE_BPS_TOTAL].avg;
  523. var->bps_read = cfg->buckets[THROTTLE_BPS_READ].avg;
  524. var->bps_write = cfg->buckets[THROTTLE_BPS_WRITE].avg;
  525. var->iops_total = cfg->buckets[THROTTLE_OPS_TOTAL].avg;
  526. var->iops_read = cfg->buckets[THROTTLE_OPS_READ].avg;
  527. var->iops_write = cfg->buckets[THROTTLE_OPS_WRITE].avg;
  528. var->bps_total_max = cfg->buckets[THROTTLE_BPS_TOTAL].max;
  529. var->bps_read_max = cfg->buckets[THROTTLE_BPS_READ].max;
  530. var->bps_write_max = cfg->buckets[THROTTLE_BPS_WRITE].max;
  531. var->iops_total_max = cfg->buckets[THROTTLE_OPS_TOTAL].max;
  532. var->iops_read_max = cfg->buckets[THROTTLE_OPS_READ].max;
  533. var->iops_write_max = cfg->buckets[THROTTLE_OPS_WRITE].max;
  534. var->bps_total_max_length = cfg->buckets[THROTTLE_BPS_TOTAL].burst_length;
  535. var->bps_read_max_length = cfg->buckets[THROTTLE_BPS_READ].burst_length;
  536. var->bps_write_max_length = cfg->buckets[THROTTLE_BPS_WRITE].burst_length;
  537. var->iops_total_max_length = cfg->buckets[THROTTLE_OPS_TOTAL].burst_length;
  538. var->iops_read_max_length = cfg->buckets[THROTTLE_OPS_READ].burst_length;
  539. var->iops_write_max_length = cfg->buckets[THROTTLE_OPS_WRITE].burst_length;
  540. var->iops_size = cfg->op_size;
  541. var->has_bps_total = true;
  542. var->has_bps_read = true;
  543. var->has_bps_write = true;
  544. var->has_iops_total = true;
  545. var->has_iops_read = true;
  546. var->has_iops_write = true;
  547. var->has_bps_total_max = true;
  548. var->has_bps_read_max = true;
  549. var->has_bps_write_max = true;
  550. var->has_iops_total_max = true;
  551. var->has_iops_read_max = true;
  552. var->has_iops_write_max = true;
  553. var->has_bps_read_max_length = true;
  554. var->has_bps_total_max_length = true;
  555. var->has_bps_write_max_length = true;
  556. var->has_iops_total_max_length = true;
  557. var->has_iops_read_max_length = true;
  558. var->has_iops_write_max_length = true;
  559. var->has_iops_size = true;
  560. }