From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org
Subject: [PULL 03/28] block/rbd: bump librbd requirement to luminous release
Date: Fri, 9 Jul 2021 14:50:10 +0200 [thread overview]
Message-ID: <20210709125035.191321-4-kwolf@redhat.com> (raw)
In-Reply-To: <20210709125035.191321-1-kwolf@redhat.com>
From: Peter Lieven <pl@kamp.de>
Ceph Luminous (version 12.2.z) is almost 4 years old at this point.
Bump the requirement to get rid of the ifdef'ry in the code.
Qemu 6.1 dropped the support for RHEL-7 which was the last supported
OS that required an older librbd.
Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Message-Id: <20210702172356.11574-2-idryomov@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/rbd.c | 120 ++++------------------------------------------------
meson.build | 7 ++-
2 files changed, 13 insertions(+), 114 deletions(-)
diff --git a/block/rbd.c b/block/rbd.c
index f51adb3646..b4b928bbb9 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -55,24 +55,10 @@
* leading "\".
*/
-/* rbd_aio_discard added in 0.1.2 */
-#if LIBRBD_VERSION_CODE >= LIBRBD_VERSION(0, 1, 2)
-#define LIBRBD_SUPPORTS_DISCARD
-#else
-#undef LIBRBD_SUPPORTS_DISCARD
-#endif
-
#define OBJ_MAX_SIZE (1UL << OBJ_DEFAULT_OBJ_ORDER)
#define RBD_MAX_SNAPS 100
-/* The LIBRBD_SUPPORTS_IOVEC is defined in librbd.h */
-#ifdef LIBRBD_SUPPORTS_IOVEC
-#define LIBRBD_USE_IOVEC 1
-#else
-#define LIBRBD_USE_IOVEC 0
-#endif
-
#define RBD_ENCRYPTION_LUKS_HEADER_VERIFICATION_LEN 8
static const char rbd_luks_header_verification[
@@ -96,7 +82,6 @@ typedef struct RBDAIOCB {
BlockAIOCB common;
int64_t ret;
QEMUIOVector *qiov;
- char *bounce;
RBDAIOCmd cmd;
int error;
struct BDRVRBDState *s;
@@ -106,7 +91,6 @@ typedef struct RADOSCB {
RBDAIOCB *acb;
struct BDRVRBDState *s;
int64_t size;
- char *buf;
int64_t ret;
} RADOSCB;
@@ -354,13 +338,9 @@ static int qemu_rbd_set_keypairs(rados_t cluster, const char *keypairs_json,
static void qemu_rbd_memset(RADOSCB *rcb, int64_t offs)
{
- if (LIBRBD_USE_IOVEC) {
- RBDAIOCB *acb = rcb->acb;
- iov_memset(acb->qiov->iov, acb->qiov->niov, offs, 0,
- acb->qiov->size - offs);
- } else {
- memset(rcb->buf + offs, 0, rcb->size - offs);
- }
+ RBDAIOCB *acb = rcb->acb;
+ iov_memset(acb->qiov->iov, acb->qiov->niov, offs, 0,
+ acb->qiov->size - offs);
}
#ifdef LIBRBD_SUPPORTS_ENCRYPTION
@@ -787,13 +767,6 @@ static void qemu_rbd_complete_aio(RADOSCB *rcb)
g_free(rcb);
- if (!LIBRBD_USE_IOVEC) {
- if (acb->cmd == RBD_AIO_READ) {
- qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size);
- }
- qemu_vfree(acb->bounce);
- }
-
acb->common.cb(acb->common.opaque, (acb->ret > 0 ? 0 : acb->ret));
qemu_aio_unref(acb);
@@ -1174,28 +1147,6 @@ static void rbd_finish_aiocb(rbd_completion_t c, RADOSCB *rcb)
rbd_finish_bh, rcb);
}
-static int rbd_aio_discard_wrapper(rbd_image_t image,
- uint64_t off,
- uint64_t len,
- rbd_completion_t comp)
-{
-#ifdef LIBRBD_SUPPORTS_DISCARD
- return rbd_aio_discard(image, off, len, comp);
-#else
- return -ENOTSUP;
-#endif
-}
-
-static int rbd_aio_flush_wrapper(rbd_image_t image,
- rbd_completion_t comp)
-{
-#ifdef LIBRBD_SUPPORTS_AIO_FLUSH
- return rbd_aio_flush(image, comp);
-#else
- return -ENOTSUP;
-#endif
-}
-
static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
int64_t off,
QEMUIOVector *qiov,
@@ -1218,21 +1169,6 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
rcb = g_new(RADOSCB, 1);
- if (!LIBRBD_USE_IOVEC) {
- if (cmd == RBD_AIO_DISCARD || cmd == RBD_AIO_FLUSH) {
- acb->bounce = NULL;
- } else {
- acb->bounce = qemu_try_blockalign(bs, qiov->size);
- if (acb->bounce == NULL) {
- goto failed;
- }
- }
- if (cmd == RBD_AIO_WRITE) {
- qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size);
- }
- rcb->buf = acb->bounce;
- }
-
acb->ret = 0;
acb->error = 0;
acb->s = s;
@@ -1246,7 +1182,7 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
}
switch (cmd) {
- case RBD_AIO_WRITE: {
+ case RBD_AIO_WRITE:
/*
* RBD APIs don't allow us to write more than actual size, so in order
* to support growing images, we resize the image before write
@@ -1258,25 +1194,16 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
goto failed_completion;
}
}
-#ifdef LIBRBD_SUPPORTS_IOVEC
- r = rbd_aio_writev(s->image, qiov->iov, qiov->niov, off, c);
-#else
- r = rbd_aio_write(s->image, off, size, rcb->buf, c);
-#endif
+ r = rbd_aio_writev(s->image, qiov->iov, qiov->niov, off, c);
break;
- }
case RBD_AIO_READ:
-#ifdef LIBRBD_SUPPORTS_IOVEC
- r = rbd_aio_readv(s->image, qiov->iov, qiov->niov, off, c);
-#else
- r = rbd_aio_read(s->image, off, size, rcb->buf, c);
-#endif
+ r = rbd_aio_readv(s->image, qiov->iov, qiov->niov, off, c);
break;
case RBD_AIO_DISCARD:
- r = rbd_aio_discard_wrapper(s->image, off, size, c);
+ r = rbd_aio_discard(s->image, off, size, c);
break;
case RBD_AIO_FLUSH:
- r = rbd_aio_flush_wrapper(s->image, c);
+ r = rbd_aio_flush(s->image, c);
break;
default:
r = -EINVAL;
@@ -1291,9 +1218,6 @@ failed_completion:
rbd_aio_release(c);
failed:
g_free(rcb);
- if (!LIBRBD_USE_IOVEC) {
- qemu_vfree(acb->bounce);
- }
qemu_aio_unref(acb);
return NULL;
@@ -1319,7 +1243,6 @@ static BlockAIOCB *qemu_rbd_aio_pwritev(BlockDriverState *bs,
RBD_AIO_WRITE);
}
-#ifdef LIBRBD_SUPPORTS_AIO_FLUSH
static BlockAIOCB *qemu_rbd_aio_flush(BlockDriverState *bs,
BlockCompletionFunc *cb,
void *opaque)
@@ -1327,20 +1250,6 @@ static BlockAIOCB *qemu_rbd_aio_flush(BlockDriverState *bs,
return rbd_start_aio(bs, 0, NULL, 0, cb, opaque, RBD_AIO_FLUSH);
}
-#else
-
-static int qemu_rbd_co_flush(BlockDriverState *bs)
-{
-#if LIBRBD_VERSION_CODE >= LIBRBD_VERSION(0, 1, 1)
- /* rbd_flush added in 0.1.1 */
- BDRVRBDState *s = bs->opaque;
- return rbd_flush(s->image);
-#else
- return 0;
-#endif
-}
-#endif
-
static int qemu_rbd_getinfo(BlockDriverState *bs, BlockDriverInfo *bdi)
{
BDRVRBDState *s = bs->opaque;
@@ -1546,7 +1455,6 @@ static int qemu_rbd_snap_list(BlockDriverState *bs,
return snap_count;
}
-#ifdef LIBRBD_SUPPORTS_DISCARD
static BlockAIOCB *qemu_rbd_aio_pdiscard(BlockDriverState *bs,
int64_t offset,
int bytes,
@@ -1556,9 +1464,7 @@ static BlockAIOCB *qemu_rbd_aio_pdiscard(BlockDriverState *bs,
return rbd_start_aio(bs, offset, NULL, bytes, cb, opaque,
RBD_AIO_DISCARD);
}
-#endif
-#ifdef LIBRBD_SUPPORTS_INVALIDATE
static void coroutine_fn qemu_rbd_co_invalidate_cache(BlockDriverState *bs,
Error **errp)
{
@@ -1568,7 +1474,6 @@ static void coroutine_fn qemu_rbd_co_invalidate_cache(BlockDriverState *bs,
error_setg_errno(errp, -r, "Failed to invalidate the cache");
}
}
-#endif
static QemuOptsList qemu_rbd_create_opts = {
.name = "rbd-create-opts",
@@ -1643,23 +1548,14 @@ static BlockDriver bdrv_rbd = {
.bdrv_aio_preadv = qemu_rbd_aio_preadv,
.bdrv_aio_pwritev = qemu_rbd_aio_pwritev,
-#ifdef LIBRBD_SUPPORTS_AIO_FLUSH
.bdrv_aio_flush = qemu_rbd_aio_flush,
-#else
- .bdrv_co_flush_to_disk = qemu_rbd_co_flush,
-#endif
-
-#ifdef LIBRBD_SUPPORTS_DISCARD
.bdrv_aio_pdiscard = qemu_rbd_aio_pdiscard,
-#endif
.bdrv_snapshot_create = qemu_rbd_snap_create,
.bdrv_snapshot_delete = qemu_rbd_snap_remove,
.bdrv_snapshot_list = qemu_rbd_snap_list,
.bdrv_snapshot_goto = qemu_rbd_snap_rollback,
-#ifdef LIBRBD_SUPPORTS_INVALIDATE
.bdrv_co_invalidate_cache = qemu_rbd_co_invalidate_cache,
-#endif
.strong_runtime_opts = qemu_rbd_strong_runtime_opts,
};
diff --git a/meson.build b/meson.build
index 7e12de01be..eb362ee5eb 100644
--- a/meson.build
+++ b/meson.build
@@ -710,13 +710,16 @@ if not get_option('rbd').auto() or have_block
int main(void) {
rados_t cluster;
rados_create(&cluster, NULL);
+ #if LIBRBD_VERSION_CODE < LIBRBD_VERSION(1, 12, 0)
+ #error
+ #endif
return 0;
}''', dependencies: [librbd, librados])
rbd = declare_dependency(dependencies: [librbd, librados])
elif get_option('rbd').enabled()
- error('could not link librados')
+ error('librbd >= 1.12.0 required')
else
- warning('could not link librados, disabling')
+ warning('librbd >= 1.12.0 not found, disabling')
endif
endif
endif
--
2.31.1
next prev parent reply other threads:[~2021-07-09 12:52 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-09 12:50 [PULL 00/28] Block layer patches Kevin Wolf
2021-07-09 12:50 ` [PULL 01/28] MAINTAINERS: update block/rbd.c maintainer Kevin Wolf
2021-07-09 12:50 ` [PULL 02/28] block/rbd: Add support for rbd image encryption Kevin Wolf
2021-07-09 12:50 ` Kevin Wolf [this message]
2021-07-09 12:50 ` [PULL 04/28] block/rbd: store object_size in BDRVRBDState Kevin Wolf
2021-07-09 12:50 ` [PULL 05/28] block/rbd: update s->image_size in qemu_rbd_getlength Kevin Wolf
2021-07-09 12:50 ` [PULL 06/28] block/rbd: migrate from aio to coroutines Kevin Wolf
2021-07-09 12:50 ` [PULL 07/28] block/rbd: add write zeroes support Kevin Wolf
2021-07-09 12:50 ` [PULL 08/28] block/rbd: drop qemu_rbd_refresh_limits Kevin Wolf
2021-07-09 12:50 ` [PULL 09/28] util/uri: do not check argument of uri_free() Kevin Wolf
2021-07-09 12:50 ` [PULL 10/28] export/fuse: Pass default_permissions for mount Kevin Wolf
2021-12-24 15:04 ` Vladimir Sementsov-Ogievskiy
2022-01-03 10:04 ` Hanna Reitz
2021-07-09 12:50 ` [PULL 11/28] export/fuse: Add allow-other option Kevin Wolf
2021-07-09 12:50 ` [PULL 12/28] export/fuse: Give SET_ATTR_SIZE its own branch Kevin Wolf
2021-07-09 12:50 ` [PULL 13/28] export/fuse: Let permissions be adjustable Kevin Wolf
2021-07-09 12:50 ` [PULL 14/28] iotests/308: Test +w on read-only FUSE exports Kevin Wolf
2021-07-09 12:50 ` [PULL 15/28] iotests/fuse-allow-other: Test allow-other Kevin Wolf
2021-07-09 12:50 ` [PULL 16/28] block/rbd: fix type of task->complete Kevin Wolf
2021-07-09 12:50 ` [PULL 17/28] MAINTAINERS: add block/rbd.c reviewer Kevin Wolf
2021-07-09 12:50 ` [PULL 18/28] vhost-user: Fix backends without multiqueue support Kevin Wolf
2021-07-09 12:50 ` [PULL 19/28] blockdev: fix drive-backup transaction endless drained section Kevin Wolf
2021-07-09 12:50 ` [PULL 20/28] qcow2: Prohibit backing file changes in 'qemu-img amend' Kevin Wolf
2021-07-09 12:50 ` [PULL 21/28] qemu-img: Require -F with -b backing image Kevin Wolf
2021-07-09 12:50 ` [PULL 22/28] qemu-img: Improve error for rebase without backing format Kevin Wolf
2021-07-09 12:50 ` [PULL 23/28] qcow2: Fix dangling pointer after reopen for 'file' Kevin Wolf
2021-07-09 12:50 ` [PULL 24/28] block: Add bdrv_reopen_queue_free() Kevin Wolf
2021-07-09 12:50 ` [PULL 25/28] block: Acquire AioContexts during bdrv_reopen_multiple() Kevin Wolf
2021-07-09 12:50 ` [PULL 26/28] block: Support multiple reopening with x-blockdev-reopen Kevin Wolf
2021-07-09 12:50 ` [PULL 27/28] iotests: Test reopening multiple devices at the same time Kevin Wolf
2021-07-09 12:50 ` [PULL 28/28] block: Make blockdev-reopen stable API Kevin Wolf
2021-07-10 20:27 ` [PULL 00/28] Block layer patches Peter Maydell
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=20210709125035.191321-4-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=peter.maydell@linaro.org \
--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).