mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
rbd: Switch rbd_start_aio() to byte-based
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>
This commit is contained in:
parent
36e3b2e733
commit
7bbca9e290
1 changed files with 9 additions and 9 deletions
18
block/rbd.c
18
block/rbd.c
|
@ -649,9 +649,9 @@ static int rbd_aio_flush_wrapper(rbd_image_t image,
|
||||||
}
|
}
|
||||||
|
|
||||||
static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
|
static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
|
||||||
int64_t sector_num,
|
int64_t off,
|
||||||
QEMUIOVector *qiov,
|
QEMUIOVector *qiov,
|
||||||
int nb_sectors,
|
int64_t size,
|
||||||
BlockCompletionFunc *cb,
|
BlockCompletionFunc *cb,
|
||||||
void *opaque,
|
void *opaque,
|
||||||
RBDAIOCmd cmd)
|
RBDAIOCmd cmd)
|
||||||
|
@ -659,7 +659,6 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
|
||||||
RBDAIOCB *acb;
|
RBDAIOCB *acb;
|
||||||
RADOSCB *rcb = NULL;
|
RADOSCB *rcb = NULL;
|
||||||
rbd_completion_t c;
|
rbd_completion_t c;
|
||||||
int64_t off, size;
|
|
||||||
char *buf;
|
char *buf;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -668,6 +667,7 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
|
||||||
acb = qemu_aio_get(&rbd_aiocb_info, bs, cb, opaque);
|
acb = qemu_aio_get(&rbd_aiocb_info, bs, cb, opaque);
|
||||||
acb->cmd = cmd;
|
acb->cmd = cmd;
|
||||||
acb->qiov = qiov;
|
acb->qiov = qiov;
|
||||||
|
assert(!qiov || qiov->size == size);
|
||||||
if (cmd == RBD_AIO_DISCARD || cmd == RBD_AIO_FLUSH) {
|
if (cmd == RBD_AIO_DISCARD || cmd == RBD_AIO_FLUSH) {
|
||||||
acb->bounce = NULL;
|
acb->bounce = NULL;
|
||||||
} else {
|
} else {
|
||||||
|
@ -687,9 +687,6 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
|
||||||
|
|
||||||
buf = acb->bounce;
|
buf = acb->bounce;
|
||||||
|
|
||||||
off = sector_num * BDRV_SECTOR_SIZE;
|
|
||||||
size = nb_sectors * BDRV_SECTOR_SIZE;
|
|
||||||
|
|
||||||
rcb = g_new(RADOSCB, 1);
|
rcb = g_new(RADOSCB, 1);
|
||||||
rcb->acb = acb;
|
rcb->acb = acb;
|
||||||
rcb->buf = buf;
|
rcb->buf = buf;
|
||||||
|
@ -739,7 +736,8 @@ static BlockAIOCB *qemu_rbd_aio_readv(BlockDriverState *bs,
|
||||||
BlockCompletionFunc *cb,
|
BlockCompletionFunc *cb,
|
||||||
void *opaque)
|
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);
|
RBD_AIO_READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -750,7 +748,8 @@ static BlockAIOCB *qemu_rbd_aio_writev(BlockDriverState *bs,
|
||||||
BlockCompletionFunc *cb,
|
BlockCompletionFunc *cb,
|
||||||
void *opaque)
|
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);
|
RBD_AIO_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -937,7 +936,8 @@ static BlockAIOCB* qemu_rbd_aio_discard(BlockDriverState *bs,
|
||||||
BlockCompletionFunc *cb,
|
BlockCompletionFunc *cb,
|
||||||
void *opaque)
|
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);
|
RBD_AIO_DISCARD);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue