xref: /openbmc/qemu/include/block/throttle-groups.h (revision 973f2ddf7b48c27aa8642047796cca3bec0b48d8)
12ff1f2e3SAlberto Garcia /*
22ff1f2e3SAlberto Garcia  * QEMU block throttling group infrastructure
32ff1f2e3SAlberto Garcia  *
42ff1f2e3SAlberto Garcia  * Copyright (C) Nodalink, EURL. 2014
52ff1f2e3SAlberto Garcia  * Copyright (C) Igalia, S.L. 2015
62ff1f2e3SAlberto Garcia  *
72ff1f2e3SAlberto Garcia  * Authors:
82ff1f2e3SAlberto Garcia  *   Benoît Canet <benoit.canet@nodalink.com>
92ff1f2e3SAlberto Garcia  *   Alberto Garcia <berto@igalia.com>
102ff1f2e3SAlberto Garcia  *
112ff1f2e3SAlberto Garcia  * This program is free software; you can redistribute it and/or
122ff1f2e3SAlberto Garcia  * modify it under the terms of the GNU General Public License as
132ff1f2e3SAlberto Garcia  * published by the Free Software Foundation; either version 2 or
142ff1f2e3SAlberto Garcia  * (at your option) version 3 of the License.
152ff1f2e3SAlberto Garcia  *
162ff1f2e3SAlberto Garcia  * This program is distributed in the hope that it will be useful,
172ff1f2e3SAlberto Garcia  * but WITHOUT ANY WARRANTY; without even the implied warranty of
182ff1f2e3SAlberto Garcia  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
192ff1f2e3SAlberto Garcia  * GNU General Public License for more details.
202ff1f2e3SAlberto Garcia  *
212ff1f2e3SAlberto Garcia  * You should have received a copy of the GNU General Public License
222ff1f2e3SAlberto Garcia  * along with this program; if not, see <http://www.gnu.org/licenses/>.
232ff1f2e3SAlberto Garcia  */
242ff1f2e3SAlberto Garcia 
252ff1f2e3SAlberto Garcia #ifndef THROTTLE_GROUPS_H
262ff1f2e3SAlberto Garcia #define THROTTLE_GROUPS_H
272ff1f2e3SAlberto Garcia 
282ff1f2e3SAlberto Garcia #include "qemu/throttle.h"
292ff1f2e3SAlberto Garcia #include "block/block_int.h"
302ff1f2e3SAlberto Garcia 
312ff1f2e3SAlberto Garcia const char *throttle_group_get_name(BlockDriverState *bs);
322ff1f2e3SAlberto Garcia 
33*973f2ddfSMax Reitz ThrottleState *throttle_group_incref(const char *name);
34*973f2ddfSMax Reitz void throttle_group_unref(ThrottleState *ts);
35*973f2ddfSMax Reitz 
362ff1f2e3SAlberto Garcia void throttle_group_config(BlockDriverState *bs, ThrottleConfig *cfg);
372ff1f2e3SAlberto Garcia void throttle_group_get_config(BlockDriverState *bs, ThrottleConfig *cfg);
382ff1f2e3SAlberto Garcia 
392ff1f2e3SAlberto Garcia void throttle_group_register_bs(BlockDriverState *bs, const char *groupname);
402ff1f2e3SAlberto Garcia void throttle_group_unregister_bs(BlockDriverState *bs);
412ff1f2e3SAlberto Garcia 
4276f4afb4SAlberto Garcia void coroutine_fn throttle_group_co_io_limits_intercept(BlockDriverState *bs,
4376f4afb4SAlberto Garcia                                                         unsigned int bytes,
4476f4afb4SAlberto Garcia                                                         bool is_write);
4576f4afb4SAlberto Garcia 
46db628338SAlberto Garcia void throttle_group_lock(BlockDriverState *bs);
47db628338SAlberto Garcia void throttle_group_unlock(BlockDriverState *bs);
48db628338SAlberto Garcia 
492ff1f2e3SAlberto Garcia #endif
50