mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
block: Enable the new throttling code in the block layer.
Signed-off-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
f17cfe813c
commit
cc0681c454
5 changed files with 166 additions and 330 deletions
|
@ -107,7 +107,6 @@ void bdrv_info_stats(Monitor *mon, QObject **ret_data);
|
|||
/* disk I/O throttling */
|
||||
void bdrv_io_limits_enable(BlockDriverState *bs);
|
||||
void bdrv_io_limits_disable(BlockDriverState *bs);
|
||||
bool bdrv_io_limits_enabled(BlockDriverState *bs);
|
||||
|
||||
void bdrv_init(void);
|
||||
void bdrv_init_with_whitelist(void);
|
||||
|
|
|
@ -35,18 +35,12 @@
|
|||
#include "qemu/hbitmap.h"
|
||||
#include "block/snapshot.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/throttle.h"
|
||||
|
||||
#define BLOCK_FLAG_ENCRYPT 1
|
||||
#define BLOCK_FLAG_COMPAT6 4
|
||||
#define BLOCK_FLAG_LAZY_REFCOUNTS 8
|
||||
|
||||
#define BLOCK_IO_LIMIT_READ 0
|
||||
#define BLOCK_IO_LIMIT_WRITE 1
|
||||
#define BLOCK_IO_LIMIT_TOTAL 2
|
||||
|
||||
#define BLOCK_IO_SLICE_TIME 100000000
|
||||
#define NANOSECONDS_PER_SECOND 1000000000.0
|
||||
|
||||
#define BLOCK_OPT_SIZE "size"
|
||||
#define BLOCK_OPT_ENCRYPT "encryption"
|
||||
#define BLOCK_OPT_COMPAT6 "compat6"
|
||||
|
@ -70,17 +64,6 @@ typedef struct BdrvTrackedRequest {
|
|||
CoQueue wait_queue; /* coroutines blocked on this request */
|
||||
} BdrvTrackedRequest;
|
||||
|
||||
|
||||
typedef struct BlockIOLimit {
|
||||
int64_t bps[3];
|
||||
int64_t iops[3];
|
||||
} BlockIOLimit;
|
||||
|
||||
typedef struct BlockIOBaseValue {
|
||||
uint64_t bytes[2];
|
||||
uint64_t ios[2];
|
||||
} BlockIOBaseValue;
|
||||
|
||||
struct BlockDriver {
|
||||
const char *format_name;
|
||||
int instance_size;
|
||||
|
@ -264,13 +247,9 @@ struct BlockDriverState {
|
|||
/* number of in-flight copy-on-read requests */
|
||||
unsigned int copy_on_read_in_flight;
|
||||
|
||||
/* the time for latest disk I/O */
|
||||
int64_t slice_start;
|
||||
int64_t slice_end;
|
||||
BlockIOLimit io_limits;
|
||||
BlockIOBaseValue slice_submitted;
|
||||
CoQueue throttled_reqs;
|
||||
QEMUTimer *block_timer;
|
||||
/* I/O throttling */
|
||||
ThrottleState throttle_state;
|
||||
CoQueue throttled_reqs[2];
|
||||
bool io_limits_enabled;
|
||||
|
||||
/* I/O stats (display with "info blockstats"). */
|
||||
|
@ -312,7 +291,8 @@ struct BlockDriverState {
|
|||
int get_tmp_filename(char *filename, int size);
|
||||
|
||||
void bdrv_set_io_limits(BlockDriverState *bs,
|
||||
BlockIOLimit *io_limits);
|
||||
ThrottleConfig *cfg);
|
||||
|
||||
|
||||
/**
|
||||
* bdrv_add_before_write_notifier:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue