mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
virtio-blk: introduce multiread
this patch finally introduces multiread support to virtio-blk. While multiwrite support was there for a long time, read support was missing. The complete merge logic is moved into virtio-blk.c which has been the only user of request merging ever since. This is required to be able to merge chunks of requests and immediately invoke callbacks for those requests. Secondly, this is required to switch to direct invocation of coroutines which is planned at a later stage. The following benchmarks show the performance of running fio with 4 worker threads on a local ram disk. The numbers show the average of 10 test runs after 1 run as warmup phase. | 4k | 64k | 4k MB/s | rd seq | rd rand | rd seq | rd rand | wr seq | wr rand --------------+--------+---------+--------+---------+--------+-------- master | 1221 | 1187 | 4178 | 4114 | 1745 | 1213 multiread | 1829 | 1189 | 4639 | 4110 | 1894 | 1216 Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
454057b7d9
commit
95f7142abc
4 changed files with 218 additions and 106 deletions
|
@ -134,29 +134,32 @@ typedef struct VirtIOBlock {
|
|||
struct VirtIOBlockDataPlane *dataplane;
|
||||
} VirtIOBlock;
|
||||
|
||||
#define VIRTIO_BLK_MAX_MERGE_REQS 32
|
||||
|
||||
typedef struct MultiReqBuffer {
|
||||
BlockRequest blkreq[VIRTIO_BLK_MAX_MERGE_REQS];
|
||||
unsigned int num_writes;
|
||||
} MultiReqBuffer;
|
||||
|
||||
typedef struct VirtIOBlockReq {
|
||||
int64_t sector_num;
|
||||
VirtIOBlock *dev;
|
||||
VirtQueueElement elem;
|
||||
struct virtio_blk_inhdr *in;
|
||||
struct virtio_blk_outhdr out;
|
||||
QEMUIOVector qiov;
|
||||
struct VirtIOBlockReq *next;
|
||||
struct VirtIOBlockReq *mr_next;
|
||||
BlockAcctCookie acct;
|
||||
} VirtIOBlockReq;
|
||||
|
||||
#define VIRTIO_BLK_MAX_MERGE_REQS 32
|
||||
|
||||
typedef struct MultiReqBuffer {
|
||||
VirtIOBlockReq *reqs[VIRTIO_BLK_MAX_MERGE_REQS];
|
||||
unsigned int num_reqs;
|
||||
bool is_write;
|
||||
} MultiReqBuffer;
|
||||
|
||||
VirtIOBlockReq *virtio_blk_alloc_request(VirtIOBlock *s);
|
||||
|
||||
void virtio_blk_free_request(VirtIOBlockReq *req);
|
||||
|
||||
void virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb);
|
||||
|
||||
void virtio_submit_multiwrite(BlockBackend *blk, MultiReqBuffer *mrb);
|
||||
void virtio_blk_submit_multireq(BlockBackend *blk, MultiReqBuffer *mrb);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue