qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, mreitz@redhat.com, berto@igalia.com,
	jcody@redhat.com, jsnow@redhat.com, qemu-devel@nongnu.org,
	eblake@redhat.com
Subject: [Qemu-devel] [PATCH v3 06/15] block: Make blk_co_preadv/pwritev() public
Date: Wed, 25 May 2016 14:29:14 +0200	[thread overview]
Message-ID: <1464179363-19821-7-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1464179363-19821-1-git-send-email-kwolf@redhat.com>

Also add trace points now that the function can be directly called.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/block-backend.c          | 21 ++++++++++++++-------
 include/sysemu/block-backend.h |  6 ++++++
 trace-events                   |  4 ++++
 3 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index c8b13f1..34500e6 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -19,6 +19,7 @@
 #include "sysemu/sysemu.h"
 #include "qapi-event.h"
 #include "qemu/id.h"
+#include "trace.h"
 
 /* Number of coroutines to reserve per attached device model */
 #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);
 }
 
-static int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset,
-                                      unsigned int bytes, QEMUIOVector *qiov,
-                                      BdrvRequestFlags flags)
+int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset,
+                               unsigned int bytes, QEMUIOVector *qiov,
+                               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) {
         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);
 }
 
-static int coroutine_fn blk_co_pwritev(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 ret;
 
+    trace_blk_co_pwritev(blk, blk_bs(blk), offset, bytes, flags);
+
     ret = blk_check_byte_request(blk, offset, bytes);
     if (ret < 0) {
         return ret;
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index 9571726..c04af8e 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -113,6 +113,12 @@ void *blk_get_attached_dev(BlockBackend *blk);
 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 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 count, BdrvRequestFlags flags);
 BlockAIOCB *blk_aio_pwrite_zeroes(BlockBackend *blk, int64_t offset,
diff --git a/trace-events b/trace-events
index b53c354..5d431bd 100644
--- a/trace-events
+++ b/trace-events
@@ -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_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
 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"
-- 
1.8.3.1

  parent reply	other threads:[~2016-05-25 12:29 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25 12:29 [Qemu-devel] [PATCH v3 00/15] block jobs: Convert I/O to BlockBackend Kevin Wolf
2016-05-25 12:29 ` [Qemu-devel] [PATCH v3 01/15] block: Rename blk_write_zeroes() Kevin Wolf
2016-05-25 14:40   ` Max Reitz
2016-05-25 12:29 ` [Qemu-devel] [PATCH v3 02/15] block: keep a list of block jobs Kevin Wolf
2016-05-25 12:29 ` [Qemu-devel] [PATCH v3 03/15] block: Cancel jobs first in bdrv_close_all() Kevin Wolf
2016-05-25 14:44   ` Max Reitz
2016-05-25 12:29 ` [Qemu-devel] [PATCH v3 04/15] block: Default to enabled write cache in blk_new() Kevin Wolf
2016-05-25 12:29 ` [Qemu-devel] [PATCH v3 05/15] block: Convert block job core to BlockBackend Kevin Wolf
2016-05-25 14:51   ` Max Reitz
2016-05-25 12:29 ` Kevin Wolf [this message]
2016-05-25 13:41   ` [Qemu-devel] [PATCH v3 06/15] block: Make blk_co_preadv/pwritev() public Alberto Garcia
2016-05-25 14:08   ` Eric Blake
2016-05-25 14:54   ` Max Reitz
2016-05-25 12:29 ` [Qemu-devel] [PATCH v3 07/15] stream: Use BlockBackend for I/O Kevin Wolf
2016-05-25 14:56   ` Max Reitz
2016-05-25 12:29 ` [Qemu-devel] [PATCH v3 08/15] mirror: Allow target that already has a BlockBackend Kevin Wolf
2016-05-25 12:29 ` [Qemu-devel] [PATCH v3 09/15] mirror: Use BlockBackend for I/O Kevin Wolf
2016-05-25 15:02   ` Max Reitz
2016-05-25 12:29 ` [Qemu-devel] [PATCH v3 10/15] backup: Don't leak BackupBlockJob in error path Kevin Wolf
2016-05-25 12:29 ` [Qemu-devel] [PATCH v3 11/15] backup: Pack Notifier within BackupBlockJob Kevin Wolf
2016-05-25 12:29 ` [Qemu-devel] [PATCH v3 12/15] backup: Remove bs parameter from backup_do_cow() Kevin Wolf
2016-05-25 12:29 ` [Qemu-devel] [PATCH v3 13/15] backup: Use BlockBackend for I/O Kevin Wolf
2016-05-25 15:17   ` Max Reitz
2016-05-25 12:29 ` [Qemu-devel] [PATCH v3 14/15] commit: " Kevin Wolf
2016-05-25 15:19   ` Max Reitz
2016-05-25 12:29 ` [Qemu-devel] [PATCH v3 15/15] blockjob: Remove BlockJob.bs Kevin Wolf
2016-05-25 15:21   ` Max Reitz
2016-05-25 15:48   ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464179363-19821-7-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=berto@igalia.com \
    --cc=eblake@redhat.com \
    --cc=jcody@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).