All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com,
	mreitz@redhat.com
Subject: [Qemu-devel] [PATCH 4/8] block: Pull up blk_read_unthrottled() implementation
Date: Tue,  8 Mar 2016 13:47:49 +0100	[thread overview]
Message-ID: <1457441273-29821-5-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1457441273-29821-1-git-send-email-kwolf@redhat.com>

Use blk_read(), so that it goes through blk_co_preadv() like all read
requests from the BB to the BDS.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/block-backend.c | 12 ++++++++++--
 block/io.c            | 14 --------------
 include/block/block.h |  2 --
 3 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index e159647..4fd0545 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -793,12 +793,20 @@ int blk_read(BlockBackend *blk, int64_t sector_num, uint8_t *buf,
 int blk_read_unthrottled(BlockBackend *blk, int64_t sector_num, uint8_t *buf,
                          int nb_sectors)
 {
-    int ret = blk_check_request(blk, sector_num, nb_sectors);
+    BlockDriverState *bs = blk_bs(blk);
+    bool enabled;
+    int ret;
+
+    ret = blk_check_request(blk, sector_num, nb_sectors);
     if (ret < 0) {
         return ret;
     }
 
-    return bdrv_read_unthrottled(blk_bs(blk), sector_num, buf, nb_sectors);
+    enabled = bs->io_limits_enabled;
+    bs->io_limits_enabled = false;
+    ret = blk_read(blk, sector_num, buf, nb_sectors);
+    bs->io_limits_enabled = enabled;
+    return ret;
 }
 
 int blk_write(BlockBackend *blk, int64_t sector_num, const uint8_t *buf,
diff --git a/block/io.c b/block/io.c
index aa8537c..41d954ca 100644
--- a/block/io.c
+++ b/block/io.c
@@ -615,20 +615,6 @@ int bdrv_read(BlockDriverState *bs, int64_t sector_num,
     return bdrv_rw_co(bs, sector_num, buf, nb_sectors, false, 0);
 }
 
-/* Just like bdrv_read(), but with I/O throttling temporarily disabled */
-int bdrv_read_unthrottled(BlockDriverState *bs, int64_t sector_num,
-                          uint8_t *buf, int nb_sectors)
-{
-    bool enabled;
-    int ret;
-
-    enabled = bs->io_limits_enabled;
-    bs->io_limits_enabled = false;
-    ret = bdrv_read(bs, sector_num, buf, nb_sectors);
-    bs->io_limits_enabled = enabled;
-    return ret;
-}
-
 /* Return < 0 if error. Important errors are:
   -EIO         generic I/O error (may happen for all errors)
   -ENOMEDIUM   No media inserted.
diff --git a/include/block/block.h b/include/block/block.h
index d2e1a51..3a78414 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -227,8 +227,6 @@ void bdrv_reopen_commit(BDRVReopenState *reopen_state);
 void bdrv_reopen_abort(BDRVReopenState *reopen_state);
 int bdrv_read(BlockDriverState *bs, int64_t sector_num,
               uint8_t *buf, int nb_sectors);
-int bdrv_read_unthrottled(BlockDriverState *bs, int64_t sector_num,
-                          uint8_t *buf, int nb_sectors);
 int bdrv_write(BlockDriverState *bs, int64_t sector_num,
                const uint8_t *buf, int nb_sectors);
 int bdrv_write_zeroes(BlockDriverState *bs, int64_t sector_num,
-- 
1.8.3.1

  parent reply	other threads:[~2016-03-08 12:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-08 12:47 [Qemu-devel] [PATCH 0/8] block: Introduce common read/write function Kevin Wolf
2016-03-08 12:47 ` [Qemu-devel] [PATCH 1/8] block: Use BdrvChild in BlockBackend Kevin Wolf
2016-03-08 12:47 ` [Qemu-devel] [PATCH 2/8] block: Use blk_co_preadv() for blk_read() Kevin Wolf
2016-03-08 12:47 ` [Qemu-devel] [PATCH 3/8] block: Use blk_co_pwritev() for blk_write() Kevin Wolf
2016-03-08 12:47 ` Kevin Wolf [this message]
2016-03-08 12:47 ` [Qemu-devel] [PATCH 5/8] block: Use blk_co_pwritev() in blk_write_zeroes() Kevin Wolf
2016-03-08 12:47 ` [Qemu-devel] [PATCH 6/8] block: Use blk_prw() in blk_pread()/blk_pwrite() Kevin Wolf
2016-03-08 12:47 ` [Qemu-devel] [PATCH 7/8] block: Use blk_aio_prwv() for aio_read/write/write_zeroes Kevin Wolf
2016-03-08 12:47 ` [Qemu-devel] [PATCH 8/8] block: Use blk_co_pwritev() in blk_co_write_zeroes() Kevin Wolf
2016-03-17 14:08 ` [Qemu-devel] [PATCH 0/8] block: Introduce common read/write function Kevin Wolf
2016-03-17 14:35 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi

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=1457441273-29821-5-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.