diff options
author | Fam Zheng <famz@redhat.com> | 2018-01-16 14:08:56 +0800 |
---|---|---|
committer | Fam Zheng <famz@redhat.com> | 2018-02-08 09:22:03 +0800 |
commit | 23d0ba9319f182e258f480bafb7de9f79fb6e0e9 (patch) | |
tree | 7e34126e19e9622444f720e5c89dbfd94cbc3cd8 /block | |
parent | bdd6a90a9e5fe22201dce84aea60ac08197e2c63 (diff) | |
download | qemu-23d0ba9319f182e258f480bafb7de9f79fb6e0e9.zip qemu-23d0ba9319f182e258f480bafb7de9f79fb6e0e9.tar.gz qemu-23d0ba9319f182e258f480bafb7de9f79fb6e0e9.tar.bz2 |
block: Introduce buf register API
Allow block driver to map and unmap a buffer for later I/O, as a performance
hint.
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20180116060901.17413-5-famz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/block-backend.c | 10 | ||||
-rw-r--r-- | block/io.c | 24 |
2 files changed, 34 insertions, 0 deletions
diff --git a/block/block-backend.c b/block/block-backend.c index baef8e7..f66349c 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -2096,3 +2096,13 @@ static void blk_root_drained_end(BdrvChild *child) } } } + +void blk_register_buf(BlockBackend *blk, void *host, size_t size) +{ + bdrv_register_buf(blk_bs(blk), host, size); +} + +void blk_unregister_buf(BlockBackend *blk, void *host) +{ + bdrv_unregister_buf(blk_bs(blk), host); +} @@ -2825,3 +2825,27 @@ void bdrv_io_unplug(BlockDriverState *bs) bdrv_io_unplug(child->bs); } } + +void bdrv_register_buf(BlockDriverState *bs, void *host, size_t size) +{ + BdrvChild *child; + + if (bs->drv && bs->drv->bdrv_register_buf) { + bs->drv->bdrv_register_buf(bs, host, size); + } + QLIST_FOREACH(child, &bs->children, next) { + bdrv_register_buf(child->bs, host, size); + } +} + +void bdrv_unregister_buf(BlockDriverState *bs, void *host) +{ + BdrvChild *child; + + if (bs->drv && bs->drv->bdrv_unregister_buf) { + bs->drv->bdrv_unregister_buf(bs, host); + } + QLIST_FOREACH(child, &bs->children, next) { + bdrv_unregister_buf(child->bs, host); + } +} |