mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
Block layer patches
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJXPdcnAAoJEH8JsnLIjy/WPEoQAK5vlRYqvQrrevMJviT4ZPUX cGGbabOcmfTBHGAgGwRLg+vQ043Sgu14JjtNbrsoSsBwAl9eAhAVGOimiieaY3vR 35OOUxECswArJzK8I4XRx4KhI871Yq+8kHILPoXpF8L7YU38Zqa1D5z2dcOKYrL8 Oy5IEfd1+Qfpxg/txKIioP5BzKVpz3V9/8GRNo0iAl7c806NoYFpnM0TXsed9Fjr YvUn1AdGHUF0/pV6vU46Qxz4yy1Q+cuoh923z6+YvXTcwok7PbjhAQWWA0qvSTuG otnPKMPBhYa6g7XOPD9Mra986vs6vBEGiPS5uqXoM5FqxF4Hc9LIeHEr+3hb+m53 NLOmGqfct0USY9r6rXsOhZQb7nZCDuhaedv33ZfgE0T0cYxIilHs5PhgFAWfthhP aNJYlzbJUhqhTi7CJrJcFoGbNQDxux5qtlFo43M4vz/WYYDrwu8P7O3YO+sH0jU1 EXJnbtztQvwfsiIEbIzvBRQl3XD9QmCfYO3lRbOwdCnd3ZLy47E2bze4gV3DwzK7 CsBr+sa49xI8LMswPxTms+A+Inndn8O0mGI32Zi4nBKapjpy5Fb4YG6z8+WPfTKp Il1PsSgG84wm4YxGWty/UI4DoPY+hqlIIz1CNuRRNQtZTybLgNCK8ZKYbVlRppmf pGPpQ8pmqkeFLmx8hecm =ntKz -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging Block layer patches # gpg: Signature made Thu 19 May 2016 16:09:27 BST using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: (31 commits) qemu-iotests: Fix regression in 136 on aio_read invalid qemu-iotests: Simplify 109 with unaligned qemu-img compare qemu-io: Fix recent UI updates block: clarify error message for qmp-eject qemu-iotests: Some more write_zeroes tests qcow2: Fix write_zeroes with partially allocated backing file cluster qcow2: fix condition in is_zero_cluster block: Propagate AioContext change to all children block: Remove BlockDriverState.blk block: Don't return throttling info in query-named-block-nodes block: Avoid bs->blk in bdrv_next() block: Add bdrv_has_blk() block: Remove bdrv_aio_multiwrite() blockjob: Don't touch BDS iostatus blockjob: Don't set iostatus of target block: User BdrvChild callback for device name block: Use BdrvChild callbacks for change_media/resize block: Don't check throttled reqs in bdrv_requests_pending() Revert "block: Forbid I/O throttling on nodes with multiple parents for 2.6" block: Remove bdrv_move_feature_fields() ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
6bd8ab6889
37 changed files with 1157 additions and 1363 deletions
|
@ -17,6 +17,7 @@ typedef struct BlockJob BlockJob;
|
|||
typedef struct BdrvChild BdrvChild;
|
||||
typedef struct BdrvChildRole BdrvChildRole;
|
||||
typedef struct BlockJobTxn BlockJobTxn;
|
||||
typedef struct BdrvNextIterator BdrvNextIterator;
|
||||
|
||||
typedef struct BlockDriverInfo {
|
||||
/* in bytes, 0 if irrelevant */
|
||||
|
@ -187,10 +188,6 @@ void bdrv_stats_print(Monitor *mon, const QObject *data);
|
|||
void bdrv_info_stats(Monitor *mon, QObject **ret_data);
|
||||
|
||||
/* disk I/O throttling */
|
||||
void bdrv_io_limits_enable(BlockDriverState *bs, const char *group);
|
||||
void bdrv_io_limits_disable(BlockDriverState *bs);
|
||||
void bdrv_io_limits_update_group(BlockDriverState *bs, const char *group);
|
||||
|
||||
void bdrv_init(void);
|
||||
void bdrv_init_with_whitelist(void);
|
||||
bool bdrv_uses_whitelist(void);
|
||||
|
@ -333,7 +330,7 @@ void bdrv_aio_cancel(BlockAIOCB *acb);
|
|||
void bdrv_aio_cancel_async(BlockAIOCB *acb);
|
||||
|
||||
typedef struct BlockRequest {
|
||||
/* Fields to be filled by multiwrite caller */
|
||||
/* Fields to be filled by caller */
|
||||
union {
|
||||
struct {
|
||||
int64_t sector;
|
||||
|
@ -349,13 +346,10 @@ typedef struct BlockRequest {
|
|||
BlockCompletionFunc *cb;
|
||||
void *opaque;
|
||||
|
||||
/* Filled by multiwrite implementation */
|
||||
/* Filled by block layer */
|
||||
int error;
|
||||
} BlockRequest;
|
||||
|
||||
int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs,
|
||||
int num_reqs);
|
||||
|
||||
/* sg packet commands */
|
||||
int bdrv_ioctl(BlockDriverState *bs, unsigned long int req, void *buf);
|
||||
BlockAIOCB *bdrv_aio_ioctl(BlockDriverState *bs,
|
||||
|
@ -408,7 +402,7 @@ BlockDriverState *bdrv_lookup_bs(const char *device,
|
|||
Error **errp);
|
||||
bool bdrv_chain_contains(BlockDriverState *top, BlockDriverState *base);
|
||||
BlockDriverState *bdrv_next_node(BlockDriverState *bs);
|
||||
BlockDriverState *bdrv_next(BlockDriverState *bs);
|
||||
BdrvNextIterator *bdrv_next(BdrvNextIterator *it, BlockDriverState **bs);
|
||||
BlockDriverState *bdrv_next_monitor_owned(BlockDriverState *bs);
|
||||
int bdrv_is_encrypted(BlockDriverState *bs);
|
||||
int bdrv_key_required(BlockDriverState *bs);
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include "block/accounting.h"
|
||||
#include "block/block.h"
|
||||
#include "block/throttle-groups.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "qemu/coroutine.h"
|
||||
|
@ -365,6 +364,25 @@ typedef struct BdrvAioNotifier {
|
|||
struct BdrvChildRole {
|
||||
void (*inherit_options)(int *child_flags, QDict *child_options,
|
||||
int parent_flags, QDict *parent_options);
|
||||
|
||||
void (*change_media)(BdrvChild *child, bool load);
|
||||
void (*resize)(BdrvChild *child);
|
||||
|
||||
/* Returns a name that is supposedly more useful for human users than the
|
||||
* node name for identifying the node in question (in particular, a BB
|
||||
* name), or NULL if the parent can't provide a better name. */
|
||||
const char* (*get_name)(BdrvChild *child);
|
||||
|
||||
/*
|
||||
* If this pair of functions is implemented, the parent doesn't issue new
|
||||
* requests after returning from .drained_begin() until .drained_end() is
|
||||
* called.
|
||||
*
|
||||
* Note that this can be nested. If drained_begin() was called twice, new
|
||||
* I/O is allowed only after drained_end() was called twice, too.
|
||||
*/
|
||||
void (*drained_begin)(BdrvChild *child);
|
||||
void (*drained_end)(BdrvChild *child);
|
||||
};
|
||||
|
||||
extern const BdrvChildRole child_file;
|
||||
|
@ -374,6 +392,7 @@ struct BdrvChild {
|
|||
BlockDriverState *bs;
|
||||
char *name;
|
||||
const BdrvChildRole *role;
|
||||
void *opaque;
|
||||
QLIST_ENTRY(BdrvChild) next;
|
||||
QLIST_ENTRY(BdrvChild) next_parent;
|
||||
};
|
||||
|
@ -399,8 +418,6 @@ struct BlockDriverState {
|
|||
BlockDriver *drv; /* NULL means no media */
|
||||
void *opaque;
|
||||
|
||||
BlockBackend *blk; /* owning backend, if any */
|
||||
|
||||
AioContext *aio_context; /* event loop used for fd handlers, timers, etc */
|
||||
/* long-running tasks intended to always use the same AioContext as this
|
||||
* BDS may register themselves in this list to be notified of changes
|
||||
|
@ -424,19 +441,6 @@ struct BlockDriverState {
|
|||
/* number of in-flight serialising requests */
|
||||
unsigned int serialising_in_flight;
|
||||
|
||||
/* I/O throttling.
|
||||
* throttle_state tells us if this BDS has I/O limits configured.
|
||||
* io_limits_disabled tells us if they are currently being enforced */
|
||||
CoQueue throttled_reqs[2];
|
||||
unsigned int io_limits_disabled;
|
||||
|
||||
/* The following fields are protected by the ThrottleGroup lock.
|
||||
* See the ThrottleGroup documentation for details. */
|
||||
ThrottleState *throttle_state;
|
||||
ThrottleTimers throttle_timers;
|
||||
unsigned pending_reqs[2];
|
||||
QLIST_ENTRY(BlockDriverState) round_robin;
|
||||
|
||||
/* Offset after the highest byte written to */
|
||||
uint64_t wr_highest_offset;
|
||||
|
||||
|
@ -502,9 +506,6 @@ struct BlockBackendRootState {
|
|||
int open_flags;
|
||||
bool read_only;
|
||||
BlockdevDetectZeroesOptions detect_zeroes;
|
||||
|
||||
char *throttle_group;
|
||||
ThrottleState *throttle_state;
|
||||
};
|
||||
|
||||
static inline BlockDriverState *backing_bs(BlockDriverState *bs)
|
||||
|
@ -539,9 +540,6 @@ int get_tmp_filename(char *filename, int size);
|
|||
BlockDriver *bdrv_probe_all(const uint8_t *buf, int buf_size,
|
||||
const char *filename);
|
||||
|
||||
void bdrv_set_io_limits(BlockDriverState *bs,
|
||||
ThrottleConfig *cfg);
|
||||
|
||||
|
||||
/**
|
||||
* bdrv_add_before_write_notifier:
|
||||
|
@ -724,16 +722,13 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs,
|
|||
const BdrvChildRole *child_role);
|
||||
void bdrv_root_unref_child(BdrvChild *child);
|
||||
|
||||
void bdrv_no_throttling_begin(BlockDriverState *bs);
|
||||
void bdrv_no_throttling_end(BlockDriverState *bs);
|
||||
|
||||
const char *bdrv_get_parent_name(const BlockDriverState *bs);
|
||||
void blk_dev_change_media_cb(BlockBackend *blk, bool load);
|
||||
bool blk_dev_has_removable_media(BlockBackend *blk);
|
||||
bool blk_dev_has_tray(BlockBackend *blk);
|
||||
void blk_dev_eject_request(BlockBackend *blk, bool force);
|
||||
bool blk_dev_is_tray_open(BlockBackend *blk);
|
||||
bool blk_dev_is_medium_locked(BlockBackend *blk);
|
||||
void blk_dev_resize_cb(BlockBackend *blk);
|
||||
|
||||
void bdrv_set_dirty(BlockDriverState *bs, int64_t cur_sector, int nr_sectors);
|
||||
bool bdrv_requests_pending(BlockDriverState *bs);
|
||||
|
|
|
@ -383,7 +383,6 @@ void block_job_iostatus_reset(BlockJob *job);
|
|||
/**
|
||||
* block_job_error_action:
|
||||
* @job: The job to signal an error for.
|
||||
* @bs: The block device on which to set an I/O error.
|
||||
* @on_err: The error action setting.
|
||||
* @is_read: Whether the operation was a read.
|
||||
* @error: The error that was reported.
|
||||
|
@ -391,8 +390,7 @@ void block_job_iostatus_reset(BlockJob *job);
|
|||
* Report an I/O error for a block job and possibly stop the VM. Return the
|
||||
* action that was selected based on @on_err and @error.
|
||||
*/
|
||||
BlockErrorAction block_job_error_action(BlockJob *job, BlockDriverState *bs,
|
||||
BlockdevOnError on_err,
|
||||
BlockErrorAction block_job_error_action(BlockJob *job, BlockdevOnError on_err,
|
||||
int is_read, int error);
|
||||
|
||||
typedef void BlockJobDeferToMainLoopFn(BlockJob *job, void *opaque);
|
||||
|
|
|
@ -28,19 +28,19 @@
|
|||
#include "qemu/throttle.h"
|
||||
#include "block/block_int.h"
|
||||
|
||||
const char *throttle_group_get_name(BlockDriverState *bs);
|
||||
const char *throttle_group_get_name(BlockBackend *blk);
|
||||
|
||||
ThrottleState *throttle_group_incref(const char *name);
|
||||
void throttle_group_unref(ThrottleState *ts);
|
||||
|
||||
void throttle_group_config(BlockDriverState *bs, ThrottleConfig *cfg);
|
||||
void throttle_group_get_config(BlockDriverState *bs, ThrottleConfig *cfg);
|
||||
void throttle_group_config(BlockBackend *blk, ThrottleConfig *cfg);
|
||||
void throttle_group_get_config(BlockBackend *blk, ThrottleConfig *cfg);
|
||||
|
||||
void throttle_group_register_bs(BlockDriverState *bs, const char *groupname);
|
||||
void throttle_group_unregister_bs(BlockDriverState *bs);
|
||||
void throttle_group_restart_bs(BlockDriverState *bs);
|
||||
void throttle_group_register_blk(BlockBackend *blk, const char *groupname);
|
||||
void throttle_group_unregister_blk(BlockBackend *blk);
|
||||
void throttle_group_restart_blk(BlockBackend *blk);
|
||||
|
||||
void coroutine_fn throttle_group_co_io_limits_intercept(BlockDriverState *bs,
|
||||
void coroutine_fn throttle_group_co_io_limits_intercept(BlockBackend *blk,
|
||||
unsigned int bytes,
|
||||
bool is_write);
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#define BLOCK_BACKEND_H
|
||||
|
||||
#include "qemu/iov.h"
|
||||
#include "block/throttle-groups.h"
|
||||
|
||||
/*
|
||||
* TODO Have to include block/block.h for a bunch of block layer
|
||||
|
@ -59,6 +60,24 @@ typedef struct BlockDevOps {
|
|||
void (*resize_cb)(void *opaque);
|
||||
} BlockDevOps;
|
||||
|
||||
/* This struct is embedded in (the private) BlockBackend struct and contains
|
||||
* fields that must be public. This is in particular for QLIST_ENTRY() and
|
||||
* friends so that BlockBackends can be kept in lists outside block-backend.c */
|
||||
typedef struct BlockBackendPublic {
|
||||
/* I/O throttling.
|
||||
* throttle_state tells us if this BlockBackend has I/O limits configured.
|
||||
* io_limits_disabled tells us if they are currently being enforced */
|
||||
CoQueue throttled_reqs[2];
|
||||
unsigned int io_limits_disabled;
|
||||
|
||||
/* The following fields are protected by the ThrottleGroup lock.
|
||||
* See the ThrottleGroup documentation for details. */
|
||||
ThrottleState *throttle_state;
|
||||
ThrottleTimers throttle_timers;
|
||||
unsigned pending_reqs[2];
|
||||
QLIST_ENTRY(BlockBackendPublic) round_robin;
|
||||
} BlockBackendPublic;
|
||||
|
||||
BlockBackend *blk_new(Error **errp);
|
||||
BlockBackend *blk_new_with_bs(Error **errp);
|
||||
BlockBackend *blk_new_open(const char *filename, const char *reference,
|
||||
|
@ -70,13 +89,16 @@ void blk_remove_all_bs(void);
|
|||
const char *blk_name(BlockBackend *blk);
|
||||
BlockBackend *blk_by_name(const char *name);
|
||||
BlockBackend *blk_next(BlockBackend *blk);
|
||||
BlockDriverState *blk_next_root_bs(BlockDriverState *bs);
|
||||
bool monitor_add_blk(BlockBackend *blk, const char *name, Error **errp);
|
||||
void monitor_remove_blk(BlockBackend *blk);
|
||||
|
||||
BlockBackendPublic *blk_get_public(BlockBackend *blk);
|
||||
BlockBackend *blk_by_public(BlockBackendPublic *public);
|
||||
|
||||
BlockDriverState *blk_bs(BlockBackend *blk);
|
||||
void blk_remove_bs(BlockBackend *blk);
|
||||
void blk_insert_bs(BlockBackend *blk, BlockDriverState *bs);
|
||||
bool bdrv_has_blk(BlockDriverState *bs);
|
||||
|
||||
void blk_set_allow_write_beyond_eof(BlockBackend *blk, bool allow);
|
||||
void blk_iostatus_enable(BlockBackend *blk);
|
||||
|
@ -116,7 +138,6 @@ BlockAIOCB *blk_aio_discard(BlockBackend *blk,
|
|||
BlockCompletionFunc *cb, void *opaque);
|
||||
void blk_aio_cancel(BlockAIOCB *acb);
|
||||
void blk_aio_cancel_async(BlockAIOCB *acb);
|
||||
int blk_aio_multiwrite(BlockBackend *blk, BlockRequest *reqs, int num_reqs);
|
||||
int blk_ioctl(BlockBackend *blk, unsigned long int req, void *buf);
|
||||
BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned long int req, void *buf,
|
||||
BlockCompletionFunc *cb, void *opaque);
|
||||
|
@ -190,4 +211,9 @@ BlockAIOCB *blk_abort_aio_request(BlockBackend *blk,
|
|||
BlockCompletionFunc *cb,
|
||||
void *opaque, int ret);
|
||||
|
||||
void blk_set_io_limits(BlockBackend *blk, ThrottleConfig *cfg);
|
||||
void blk_io_limits_disable(BlockBackend *blk);
|
||||
void blk_io_limits_enable(BlockBackend *blk, const char *group);
|
||||
void blk_io_limits_update_group(BlockBackend *blk, const char *group);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue