Add some more trace functions to the IO path. Signed-off-by: David Edmondson <david.edmond...@oracle.com> --- block/curl.c | 10 +++++++++- block/io.c | 4 ++++ block/linux-aio.c | 6 ++++++ block/trace-events | 13 ++++++++++++- 4 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/block/curl.c b/block/curl.c index d0c74d7de5..d2f4de46c9 100644 --- a/block/curl.c +++ b/block/curl.c @@ -299,6 +299,8 @@ static bool curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len, { char *buf = state->orig_buf + (start - state->buf_start); + trace_curl_pending_hit(qemu_coroutine_self(), + start, len); qemu_iovec_from_buf(acb->qiov, 0, buf, clamped_len); if (clamped_len < len) { qemu_iovec_memset(acb->qiov, clamped_len, 0, len - clamped_len); @@ -316,6 +318,8 @@ static bool curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len, { int j; + trace_curl_pending_piggyback(qemu_coroutine_self(), + start, len); acb->start = start - state->buf_start; acb->end = acb->start + clamped_len; @@ -328,6 +332,8 @@ static bool curl_find_buf(BDRVCURLState *s, uint64_t start, uint64_t len, } } + trace_curl_pending_miss(qemu_coroutine_self(), start, len); + return false; } @@ -894,7 +900,7 @@ static void curl_setup_preadv(BlockDriverState *bs, CURLAIOCB *acb) snprintf(state->range, 127, "%" PRIu64 "-%" PRIu64, s->offset + start, s->offset + end); - trace_curl_setup_preadv(acb->bytes, start, state->range); + trace_curl_setup_preadv(qemu_coroutine_self(), start, acb->bytes); curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range); if (curl_multi_add_handle(s->multi, state->curl) != CURLM_OK) { @@ -923,10 +929,12 @@ static int coroutine_fn curl_co_preadv(BlockDriverState *bs, .bytes = bytes }; + trace_curl_co_preadv(qemu_coroutine_self(), offset, bytes); curl_setup_preadv(bs, &acb); while (acb.ret == -EINPROGRESS) { qemu_coroutine_yield(); } + trace_curl_co_preadv_done(qemu_coroutine_self()); return acb.ret; } diff --git a/block/io.c b/block/io.c index ad3a51ed53..f816a46bf0 100644 --- a/block/io.c +++ b/block/io.c @@ -1194,6 +1194,8 @@ static int coroutine_fn bdrv_driver_pwritev(BlockDriverState *bs, return -ENOMEDIUM; } + trace_bdrv_driver_pwritev(qemu_coroutine_self(), offset, bytes); + if (drv->bdrv_co_pwritev_part) { ret = drv->bdrv_co_pwritev_part(bs, offset, bytes, qiov, qiov_offset, flags & bs->supported_write_flags); @@ -1253,6 +1255,8 @@ emulate_flags: qemu_iovec_destroy(&local_qiov); } + trace_bdrv_driver_pwritev_done(qemu_coroutine_self()); + return ret; } diff --git a/block/linux-aio.c b/block/linux-aio.c index 3c0527c2bf..811e9ff94c 100644 --- a/block/linux-aio.c +++ b/block/linux-aio.c @@ -15,6 +15,7 @@ #include "qemu/event_notifier.h" #include "qemu/coroutine.h" #include "qapi/error.h" +#include "trace.h" #include <libaio.h> @@ -391,6 +392,8 @@ int coroutine_fn laio_co_submit(BlockDriverState *bs, LinuxAioState *s, int fd, .qiov = qiov, }; + trace_laio_co_submit(qemu_coroutine_self(), offset, qiov->size); + ret = laio_do_submit(fd, &laiocb, offset, type); if (ret < 0) { return ret; @@ -399,6 +402,9 @@ int coroutine_fn laio_co_submit(BlockDriverState *bs, LinuxAioState *s, int fd, if (laiocb.ret == -EINPROGRESS) { qemu_coroutine_yield(); } + + trace_laio_co_submit_done(qemu_coroutine_self()); + return laiocb.ret; } diff --git a/block/trace-events b/block/trace-events index 9158335061..0b52d2ca1d 100644 --- a/block/trace-events +++ b/block/trace-events @@ -17,6 +17,8 @@ bdrv_co_pwrite_zeroes(void *bs, int64_t offset, int count, int flags) "bs %p off bdrv_co_do_copy_on_readv(void *bs, int64_t offset, unsigned int bytes, int64_t cluster_offset, int64_t cluster_bytes) "bs %p offset %"PRId64" bytes %u cluster_offset %"PRId64" cluster_bytes %"PRId64 bdrv_co_copy_range_from(void *src, uint64_t src_offset, void *dst, uint64_t dst_offset, uint64_t bytes, int read_flags, int write_flags) "src %p offset %"PRIu64" dst %p offset %"PRIu64" bytes %"PRIu64" rw flags 0x%x 0x%x" bdrv_co_copy_range_to(void *src, uint64_t src_offset, void *dst, uint64_t dst_offset, uint64_t bytes, int read_flags, int write_flags) "src %p offset %"PRIu64" dst %p offset %"PRIu64" bytes %"PRIu64" rw flags 0x%x 0x%x" +bdrv_driver_pwritev(void *co, uint64_t offset, uint64_t bytes) "co %p writes 0x%"PRIx64" + 0x%"PRIx64 +bdrv_driver_pwritev_done(void *co) "co %p done" # stream.c stream_one_iteration(void *s, int64_t offset, uint64_t bytes, int is_allocated) "s %p offset %" PRId64 " bytes %" PRIu64 " is_allocated %d" @@ -196,7 +198,12 @@ curl_sock_cb(int action, int fd) "sock action %d on fd %d" curl_read_cb(size_t realsize) "just reading %zu bytes" curl_open(const char *file) "opening %s" curl_open_size(uint64_t size) "size = %" PRIu64 -curl_setup_preadv(uint64_t bytes, uint64_t start, const char *range) "reading %" PRIu64 " at %" PRIu64 " (%s)" +curl_co_preadv(void *co, uint64_t offset, uint64_t bytes) "co %p requests 0x%" PRIx64 " + 0x%" PRIx64 +curl_co_preadv_done(void *co) "co %p done" +curl_setup_preadv(void *co, uint64_t offset, uint64_t bytes) "co %p requests 0x%" PRIx64 " + 0x%" PRIx64 +curl_pending_hit(void *co, uint64_t start, uint64_t len) "co %p finds 0x%" PRIx64 " + 0x%" PRIx64 +curl_pending_piggyback(void *co, uint64_t start, uint64_t len) "co %p pending 0x%" PRIx64 " + 0x%" PRIx64 +curl_pending_miss(void *co, uint64_t start, uint64_t len) "co %p misses 0x%" PRIx64 " + 0x%" PRIx64 curl_close(void) "close" # file-posix.c @@ -222,3 +229,7 @@ sheepdog_snapshot_create_inode(const char *name, uint32_t snap, uint32_t vdi) "s # ssh.c sftp_error(const char *op, const char *ssh_err, int ssh_err_code, int sftp_err_code) "%s failed: %s (libssh error code: %d, sftp error code: %d)" + +# linux-aio.c +laio_co_submit(void *co, uint64_t offset, uint64_t bytes) "co %p writes 0x%"PRIx64" + 0x%"PRIx64 +laio_co_submit_done(void *co) "co %p done" -- 2.27.0