| 1 | /* |
| 2 | * Fsdev Throttle |
| 3 | * |
| 4 | * Copyright (C) 2016 Huawei Technologies Duesseldorf GmbH |
| 5 | * |
| 6 | * Author: Pradeep Jagadeesh <pradeep.jagadeesh@huawei.com> |
| 7 | * |
| 8 | * This work is licensed under the terms of the GNU GPL, version 2 or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * See the COPYING file in the top-level directory for details. |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | #ifndef QEMU_FSDEV_THROTTLE_H |
| 16 | #define QEMU_FSDEV_THROTTLE_H |
| 17 | |
| 18 | #include "qemu/coroutine.h" |
| 19 | #include "qemu/throttle.h" |
| 20 | |
| 21 | typedef struct FsThrottle { |
| 22 | ThrottleState ts; |
| 23 | ThrottleTimers tt; |
| 24 | ThrottleConfig cfg; |
| 25 | CoQueue throttled_reqs[THROTTLE_MAX]; |
| 26 | } FsThrottle; |
| 27 | |
| 28 | int fsdev_throttle_parse_opts(QemuOpts *, FsThrottle *, Error **); |
| 29 | |
| 30 | void fsdev_throttle_init(FsThrottle *); |
| 31 | |
| 32 | void coroutine_fn fsdev_co_throttle_request(FsThrottle *, ThrottleDirection , |
| 33 | struct iovec *, int); |
| 34 | |
| 35 | void fsdev_throttle_cleanup(FsThrottle *); |
| 36 | |
| 37 | #endif /* QEMU_FSDEV_THROTTLE_H */ |