block: Make blk_co_preadv/pwritev() public
Also add trace points now that the function can be directly called. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com>
This commit is contained in:
parent
b6d2e59995
commit
1e98fefd95
@ -19,6 +19,7 @@
|
|||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "qapi-event.h"
|
#include "qapi-event.h"
|
||||||
#include "qemu/id.h"
|
#include "qemu/id.h"
|
||||||
|
#include "trace.h"
|
||||||
|
|
||||||
/* Number of coroutines to reserve per attached device model */
|
/* Number of coroutines to reserve per attached device model */
|
||||||
#define COROUTINE_POOL_RESERVATION 64
|
#define COROUTINE_POOL_RESERVATION 64
|
||||||
@ -741,11 +742,15 @@ static int blk_check_request(BlockBackend *blk, int64_t sector_num,
|
|||||||
nb_sectors * BDRV_SECTOR_SIZE);
|
nb_sectors * BDRV_SECTOR_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset,
|
int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset,
|
||||||
unsigned int bytes, QEMUIOVector *qiov,
|
unsigned int bytes, QEMUIOVector *qiov,
|
||||||
BdrvRequestFlags flags)
|
BdrvRequestFlags flags)
|
||||||
{
|
{
|
||||||
int ret = blk_check_byte_request(blk, offset, bytes);
|
int ret;
|
||||||
|
|
||||||
|
trace_blk_co_preadv(blk, blk_bs(blk), offset, bytes, flags);
|
||||||
|
|
||||||
|
ret = blk_check_byte_request(blk, offset, bytes);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -758,12 +763,14 @@ static int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset,
|
|||||||
return bdrv_co_preadv(blk_bs(blk), offset, bytes, qiov, flags);
|
return bdrv_co_preadv(blk_bs(blk), offset, bytes, qiov, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset,
|
int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset,
|
||||||
unsigned int bytes, QEMUIOVector *qiov,
|
unsigned int bytes, QEMUIOVector *qiov,
|
||||||
BdrvRequestFlags flags)
|
BdrvRequestFlags flags)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
trace_blk_co_pwritev(blk, blk_bs(blk), offset, bytes, flags);
|
||||||
|
|
||||||
ret = blk_check_byte_request(blk, offset, bytes);
|
ret = blk_check_byte_request(blk, offset, bytes);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -113,6 +113,12 @@ void *blk_get_attached_dev(BlockBackend *blk);
|
|||||||
void blk_set_dev_ops(BlockBackend *blk, const BlockDevOps *ops, void *opaque);
|
void blk_set_dev_ops(BlockBackend *blk, const BlockDevOps *ops, void *opaque);
|
||||||
int blk_pread_unthrottled(BlockBackend *blk, int64_t offset, uint8_t *buf,
|
int blk_pread_unthrottled(BlockBackend *blk, int64_t offset, uint8_t *buf,
|
||||||
int count);
|
int count);
|
||||||
|
int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset,
|
||||||
|
unsigned int bytes, QEMUIOVector *qiov,
|
||||||
|
BdrvRequestFlags flags);
|
||||||
|
int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset,
|
||||||
|
unsigned int bytes, QEMUIOVector *qiov,
|
||||||
|
BdrvRequestFlags flags);
|
||||||
int blk_pwrite_zeroes(BlockBackend *blk, int64_t offset,
|
int blk_pwrite_zeroes(BlockBackend *blk, int64_t offset,
|
||||||
int count, BdrvRequestFlags flags);
|
int count, BdrvRequestFlags flags);
|
||||||
BlockAIOCB *blk_aio_pwrite_zeroes(BlockBackend *blk, int64_t offset,
|
BlockAIOCB *blk_aio_pwrite_zeroes(BlockBackend *blk, int64_t offset,
|
||||||
|
@ -61,6 +61,10 @@ virtio_console_chr_event(unsigned int port, int event) "port %u, event %d"
|
|||||||
bdrv_open_common(void *bs, const char *filename, int flags, const char *format_name) "bs %p filename \"%s\" flags %#x format_name \"%s\""
|
bdrv_open_common(void *bs, const char *filename, int flags, const char *format_name) "bs %p filename \"%s\" flags %#x format_name \"%s\""
|
||||||
bdrv_lock_medium(void *bs, bool locked) "bs %p locked %d"
|
bdrv_lock_medium(void *bs, bool locked) "bs %p locked %d"
|
||||||
|
|
||||||
|
# block/block-backend.c
|
||||||
|
blk_co_preadv(void *blk, void *bs, int64_t offset, unsigned int bytes, int flags) "blk %p bs %p offset %"PRId64" bytes %u flags %x"
|
||||||
|
blk_co_pwritev(void *blk, void *bs, int64_t offset, unsigned int bytes, int flags) "blk %p bs %p offset %"PRId64" bytes %u flags %x"
|
||||||
|
|
||||||
# block/io.c
|
# block/io.c
|
||||||
bdrv_aio_discard(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p"
|
bdrv_aio_discard(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p"
|
||||||
bdrv_aio_flush(void *bs, void *opaque) "bs %p opaque %p"
|
bdrv_aio_flush(void *bs, void *opaque) "bs %p opaque %p"
|
||||||
|
Loading…
Reference in New Issue
Block a user