From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Eric Blake <eblake@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PULL for-2.7 13/25] rbd: Switch rbd_start_aio() to byte-based
Date: Tue, 19 Jul 2016 19:48:03 +0100 [thread overview]
Message-ID: <1468954095-5159-14-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1468954095-5159-1-git-send-email-stefanha@redhat.com>
From: Eric Blake <eblake@redhat.com>
The internal function converts to byte-based before calling into
RBD code; hoist the conversion to the callers so that callers
can then be switched to byte-based themselves.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1468624988-423-8-git-send-email-eblake@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/rbd.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/block/rbd.c b/block/rbd.c
index 0a5840d..01cbb63 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -649,9 +649,9 @@ static int rbd_aio_flush_wrapper(rbd_image_t image,
}
static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
- int64_t sector_num,
+ int64_t off,
QEMUIOVector *qiov,
- int nb_sectors,
+ int64_t size,
BlockCompletionFunc *cb,
void *opaque,
RBDAIOCmd cmd)
@@ -659,7 +659,6 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
RBDAIOCB *acb;
RADOSCB *rcb = NULL;
rbd_completion_t c;
- int64_t off, size;
char *buf;
int r;
@@ -668,6 +667,7 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
acb = qemu_aio_get(&rbd_aiocb_info, bs, cb, opaque);
acb->cmd = cmd;
acb->qiov = qiov;
+ assert(!qiov || qiov->size == size);
if (cmd == RBD_AIO_DISCARD || cmd == RBD_AIO_FLUSH) {
acb->bounce = NULL;
} else {
@@ -687,9 +687,6 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
buf = acb->bounce;
- off = sector_num * BDRV_SECTOR_SIZE;
- size = nb_sectors * BDRV_SECTOR_SIZE;
-
rcb = g_new(RADOSCB, 1);
rcb->acb = acb;
rcb->buf = buf;
@@ -739,7 +736,8 @@ static BlockAIOCB *qemu_rbd_aio_readv(BlockDriverState *bs,
BlockCompletionFunc *cb,
void *opaque)
{
- return rbd_start_aio(bs, sector_num, qiov, nb_sectors, cb, opaque,
+ return rbd_start_aio(bs, sector_num << BDRV_SECTOR_BITS, qiov,
+ nb_sectors << BDRV_SECTOR_BITS, cb, opaque,
RBD_AIO_READ);
}
@@ -750,7 +748,8 @@ static BlockAIOCB *qemu_rbd_aio_writev(BlockDriverState *bs,
BlockCompletionFunc *cb,
void *opaque)
{
- return rbd_start_aio(bs, sector_num, qiov, nb_sectors, cb, opaque,
+ return rbd_start_aio(bs, sector_num << BDRV_SECTOR_BITS, qiov,
+ nb_sectors << BDRV_SECTOR_BITS, cb, opaque,
RBD_AIO_WRITE);
}
@@ -937,7 +936,8 @@ static BlockAIOCB* qemu_rbd_aio_discard(BlockDriverState *bs,
BlockCompletionFunc *cb,
void *opaque)
{
- return rbd_start_aio(bs, sector_num, NULL, nb_sectors, cb, opaque,
+ return rbd_start_aio(bs, sector_num << BDRV_SECTOR_BITS, NULL,
+ nb_sectors << BDRV_SECTOR_BITS, cb, opaque,
RBD_AIO_DISCARD);
}
#endif
--
2.7.4
next prev parent reply other threads:[~2016-07-19 18:48 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-19 18:47 [Qemu-devel] [PULL for-2.7 00/25] Block patches Stefan Hajnoczi
2016-07-19 18:47 ` [Qemu-devel] [PULL for-2.7 01/25] block: Fragment reads to max transfer length Stefan Hajnoczi
2016-07-19 18:47 ` [Qemu-devel] [PULL for-2.7 02/25] raw_bsd: Don't advertise flags not supported by protocol layer Stefan Hajnoczi
2016-07-19 18:47 ` [Qemu-devel] [PULL for-2.7 03/25] block: Fragment writes to max transfer length Stefan Hajnoczi
2016-07-19 18:47 ` [Qemu-devel] [PULL for-2.7 04/25] nbd: Rely on block layer to break up large requests Stefan Hajnoczi
2016-07-19 18:47 ` [Qemu-devel] [PULL for-2.7 05/25] nbd: Drop unused offset parameter Stefan Hajnoczi
2016-07-19 18:47 ` [Qemu-devel] [PULL for-2.7 06/25] iscsi: Rely on block layer to break up large requests Stefan Hajnoczi
2016-07-19 18:47 ` [Qemu-devel] [PULL for-2.7 07/25] block: Convert bdrv_co_discard() to byte-based Stefan Hajnoczi
2016-07-19 18:47 ` [Qemu-devel] [PULL for-2.7 08/25] block: Convert bdrv_discard() " Stefan Hajnoczi
2016-07-19 18:47 ` [Qemu-devel] [PULL for-2.7 09/25] block: Switch BlockRequest " Stefan Hajnoczi
2016-07-19 18:48 ` [Qemu-devel] [PULL for-2.7 10/25] block: Convert bdrv_aio_discard() " Stefan Hajnoczi
2016-07-19 18:48 ` [Qemu-devel] [PULL for-2.7 11/25] block: Convert BB interface to byte-based discards Stefan Hajnoczi
2016-07-19 18:48 ` [Qemu-devel] [PULL for-2.7 12/25] raw-posix: Switch paio_submit() to byte-based Stefan Hajnoczi
2016-07-19 18:48 ` Stefan Hajnoczi [this message]
2016-07-19 18:48 ` [Qemu-devel] [PULL for-2.7 14/25] block: Convert .bdrv_aio_discard() " Stefan Hajnoczi
2016-07-19 18:48 ` [Qemu-devel] [PULL for-2.7 15/25] block: Add .bdrv_co_pdiscard() driver callback Stefan Hajnoczi
2016-07-19 18:48 ` [Qemu-devel] [PULL for-2.7 16/25] blkreplay: Switch .bdrv_co_discard() to byte-based Stefan Hajnoczi
2016-07-19 18:48 ` [Qemu-devel] [PULL for-2.7 17/25] gluster: " Stefan Hajnoczi
2016-07-19 18:48 ` [Qemu-devel] [PULL for-2.7 18/25] iscsi: " Stefan Hajnoczi
2016-07-19 18:48 ` [Qemu-devel] [PULL for-2.7 19/25] nbd: " Stefan Hajnoczi
2016-07-19 18:48 ` [Qemu-devel] [PULL for-2.7 20/25] qcow2: " Stefan Hajnoczi
2016-07-19 18:48 ` [Qemu-devel] [PULL for-2.7 21/25] raw_bsd: " Stefan Hajnoczi
2016-07-19 18:48 ` [Qemu-devel] [PULL for-2.7 22/25] sheepdog: " Stefan Hajnoczi
2016-07-19 18:48 ` [Qemu-devel] [PULL for-2.7 23/25] block: Kill .bdrv_co_discard() Stefan Hajnoczi
2016-07-19 18:48 ` [Qemu-devel] [PULL for-2.7 24/25] nbd: Convert to byte-based interface Stefan Hajnoczi
2016-07-19 18:48 ` [Qemu-devel] [PULL for-2.7 25/25] raw_bsd: " Stefan Hajnoczi
2016-07-20 12:56 ` [Qemu-devel] [PULL for-2.7 00/25] Block patches Peter Maydell
2016-07-20 13:25 ` 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=1468954095-5159-14-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=eblake@redhat.com \
--cc=peter.maydell@linaro.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).