From nobody Tue Nov 18 09:20:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609088190; cv=none; d=zohomail.com; s=zohoarc; b=ZXnhptw9n7KrXGkxGDMF3wnV57S2/LKLgSU9iaPahgwFUoP+SItETXGzjl+b4VburJiWrrhSSfNSjKyVBw0ux5ZUH5evwfAKCnMobwwC9A/QzDG2c8/Xiix7IYh5iL/EifhjM1ObAQ3C2EbXn77eBzyuNaeTvt/8I/OTPs5Jd8M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609088190; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=ndAXxwGPcePzn4LF+3eGPa6DhHdr9VyZS1h1od17fIY=; b=ca8fNiPguSH+v9CW7Fwcb1nVeUEGthnt2QC6UWLGXxv4Bvn94zUTaVlYOHZT/7GsufZmVY3e0Lh1uluHDTVoH/dxAv0PKDNvU8bLCU1fduBRndGNYH56aWOMyDP5hqFGWyZcIFPB98f/U9qU7DgPuagUvzaJjyH216I/UVaa3XA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609088190086909.8735213731326; Sun, 27 Dec 2020 08:56:30 -0800 (PST) Received: from localhost ([::1]:49638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktZLJ-00046Y-CK for importer@patchew.org; Sun, 27 Dec 2020 11:56:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktZIt-0002VW-3M for qemu-devel@nongnu.org; Sun, 27 Dec 2020 11:53:59 -0500 Received: from kerio.kamp.de ([195.62.97.192]:34018) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktZIq-0007ZP-Kd for qemu-devel@nongnu.org; Sun, 27 Dec 2020 11:53:58 -0500 Received: from submission.kamp.de ([195.62.97.28]) by kerio.kamp.de with ESMTPS (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256 bits)) for qemu-devel@nongnu.org; Sun, 27 Dec 2020 17:42:42 +0100 Received: (qmail 22368 invoked from network); 27 Dec 2020 16:42:44 -0000 Received: from lieven-pc.kamp-intra.net (HELO lieven-pc) (relay@kamp.de@::ffff:172.21.12.60) by submission.kamp.de with ESMTPS (DHE-RSA-AES256-GCM-SHA384 encrypted) ESMTPA; 27 Dec 2020 16:42:44 -0000 Received: by lieven-pc (Postfix, from userid 1060) id 5536513D855; Sun, 27 Dec 2020 17:42:44 +0100 (CET) X-Footer: a2FtcC5kZQ== From: Peter Lieven To: qemu-block@nongnu.org Subject: [PATCH 1/7] block/rbd: bump librbd requirement to luminous release Date: Sun, 27 Dec 2020 17:42:30 +0100 Message-Id: <20201227164236.10143-2-pl@kamp.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201227164236.10143-1-pl@kamp.de> References: <20201227164236.10143-1-pl@kamp.de> Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.62.97.192; envelope-from=pl@kamp.de; helo=kerio.kamp.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Peter Lieven , qemu-devel@nongnu.org, ct@flyingcircus.io, mreitz@redhat.com, dillaman@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" even luminous (version 12.2) is unmaintained for over 3 years now. Bump the requirement to get rid of the ifdef'ry in the code. Signed-off-by: Peter Lieven --- block/rbd.c | 120 ++++------------------------------------------------ configure | 7 +-- 2 files changed, 12 insertions(+), 115 deletions(-) diff --git a/block/rbd.c b/block/rbd.c index 9bd2bce716..650e27c351 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -55,24 +55,10 @@ * leading "\". */ =20 -/* rbd_aio_discard added in 0.1.2 */ -#if LIBRBD_VERSION_CODE >=3D LIBRBD_VERSION(0, 1, 2) -#define LIBRBD_SUPPORTS_DISCARD -#else -#undef LIBRBD_SUPPORTS_DISCARD -#endif - #define OBJ_MAX_SIZE (1UL << OBJ_DEFAULT_OBJ_ORDER) =20 #define RBD_MAX_SNAPS 100 =20 -/* 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 - typedef enum { RBD_AIO_READ, RBD_AIO_WRITE, @@ -84,7 +70,6 @@ typedef struct RBDAIOCB { BlockAIOCB common; int64_t ret; QEMUIOVector *qiov; - char *bounce; RBDAIOCmd cmd; int error; struct BDRVRBDState *s; @@ -94,7 +79,6 @@ typedef struct RADOSCB { RBDAIOCB *acb; struct BDRVRBDState *s; int64_t size; - char *buf; int64_t ret; } RADOSCB; =20 @@ -332,13 +316,9 @@ static int qemu_rbd_set_keypairs(rados_t cluster, cons= t char *keypairs_json, =20 static void qemu_rbd_memset(RADOSCB *rcb, int64_t offs) { - if (LIBRBD_USE_IOVEC) { - RBDAIOCB *acb =3D 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 =3D rcb->acb; + iov_memset(acb->qiov->iov, acb->qiov->niov, offs, 0, + acb->qiov->size - offs); } =20 /* FIXME Deprecate and remove keypairs or make it available in QMP. */ @@ -493,13 +473,6 @@ static void qemu_rbd_complete_aio(RADOSCB *rcb) =20 g_free(rcb); =20 - if (!LIBRBD_USE_IOVEC) { - if (acb->cmd =3D=3D 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)); =20 qemu_aio_unref(acb); @@ -866,28 +839,6 @@ static void rbd_finish_aiocb(rbd_completion_t c, RADOS= CB *rcb) rbd_finish_bh, rcb); } =20 -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, @@ -910,21 +861,6 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, =20 rcb =3D g_new(RADOSCB, 1); =20 - if (!LIBRBD_USE_IOVEC) { - if (cmd =3D=3D RBD_AIO_DISCARD || cmd =3D=3D RBD_AIO_FLUSH) { - acb->bounce =3D NULL; - } else { - acb->bounce =3D qemu_try_blockalign(bs, qiov->size); - if (acb->bounce =3D=3D NULL) { - goto failed; - } - } - if (cmd =3D=3D RBD_AIO_WRITE) { - qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size); - } - rcb->buf =3D acb->bounce; - } - acb->ret =3D 0; acb->error =3D 0; acb->s =3D s; @@ -938,7 +874,7 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, } =20 switch (cmd) { - case RBD_AIO_WRITE: { + case RBD_AIO_WRITE: /* * RBD APIs don't allow us to write more than actual size, so in o= rder * to support growing images, we resize the image before write @@ -950,25 +886,16 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, goto failed_completion; } } -#ifdef LIBRBD_SUPPORTS_IOVEC - r =3D rbd_aio_writev(s->image, qiov->iov, qiov->niov, off, c); -#else - r =3D rbd_aio_write(s->image, off, size, rcb->buf, c); -#endif + r =3D rbd_aio_writev(s->image, qiov->iov, qiov->niov, off, c); break; - } case RBD_AIO_READ: -#ifdef LIBRBD_SUPPORTS_IOVEC - r =3D rbd_aio_readv(s->image, qiov->iov, qiov->niov, off, c); -#else - r =3D rbd_aio_read(s->image, off, size, rcb->buf, c); -#endif + r =3D rbd_aio_readv(s->image, qiov->iov, qiov->niov, off, c); break; case RBD_AIO_DISCARD: - r =3D rbd_aio_discard_wrapper(s->image, off, size, c); + r =3D rbd_aio_discard(s->image, off, size, c); break; case RBD_AIO_FLUSH: - r =3D rbd_aio_flush_wrapper(s->image, c); + r =3D rbd_aio_flush(s->image, c); break; default: r =3D -EINVAL; @@ -983,9 +910,6 @@ failed_completion: rbd_aio_release(c); failed: g_free(rcb); - if (!LIBRBD_USE_IOVEC) { - qemu_vfree(acb->bounce); - } =20 qemu_aio_unref(acb); return NULL; @@ -1011,7 +935,6 @@ static BlockAIOCB *qemu_rbd_aio_pwritev(BlockDriverSta= te *bs, RBD_AIO_WRITE); } =20 -#ifdef LIBRBD_SUPPORTS_AIO_FLUSH static BlockAIOCB *qemu_rbd_aio_flush(BlockDriverState *bs, BlockCompletionFunc *cb, void *opaque) @@ -1019,20 +942,6 @@ static BlockAIOCB *qemu_rbd_aio_flush(BlockDriverStat= e *bs, return rbd_start_aio(bs, 0, NULL, 0, cb, opaque, RBD_AIO_FLUSH); } =20 -#else - -static int qemu_rbd_co_flush(BlockDriverState *bs) -{ -#if LIBRBD_VERSION_CODE >=3D LIBRBD_VERSION(0, 1, 1) - /* rbd_flush added in 0.1.1 */ - BDRVRBDState *s =3D bs->opaque; - return rbd_flush(s->image); -#else - return 0; -#endif -} -#endif - static int qemu_rbd_getinfo(BlockDriverState *bs, BlockDriverInfo *bdi) { BDRVRBDState *s =3D bs->opaque; @@ -1198,7 +1107,6 @@ static int qemu_rbd_snap_list(BlockDriverState *bs, return snap_count; } =20 -#ifdef LIBRBD_SUPPORTS_DISCARD static BlockAIOCB *qemu_rbd_aio_pdiscard(BlockDriverState *bs, int64_t offset, int bytes, @@ -1208,9 +1116,7 @@ static BlockAIOCB *qemu_rbd_aio_pdiscard(BlockDriverS= tate *bs, return rbd_start_aio(bs, offset, NULL, bytes, cb, opaque, RBD_AIO_DISCARD); } -#endif =20 -#ifdef LIBRBD_SUPPORTS_INVALIDATE static void coroutine_fn qemu_rbd_co_invalidate_cache(BlockDriverState *bs, Error **errp) { @@ -1220,7 +1126,6 @@ static void coroutine_fn qemu_rbd_co_invalidate_cache= (BlockDriverState *bs, error_setg_errno(errp, -r, "Failed to invalidate the cache"); } } -#endif =20 static QemuOptsList qemu_rbd_create_opts =3D { .name =3D "rbd-create-opts", @@ -1278,23 +1183,14 @@ static BlockDriver bdrv_rbd =3D { .bdrv_aio_preadv =3D qemu_rbd_aio_preadv, .bdrv_aio_pwritev =3D qemu_rbd_aio_pwritev, =20 -#ifdef LIBRBD_SUPPORTS_AIO_FLUSH .bdrv_aio_flush =3D qemu_rbd_aio_flush, -#else - .bdrv_co_flush_to_disk =3D qemu_rbd_co_flush, -#endif - -#ifdef LIBRBD_SUPPORTS_DISCARD .bdrv_aio_pdiscard =3D qemu_rbd_aio_pdiscard, -#endif =20 .bdrv_snapshot_create =3D qemu_rbd_snap_create, .bdrv_snapshot_delete =3D qemu_rbd_snap_remove, .bdrv_snapshot_list =3D qemu_rbd_snap_list, .bdrv_snapshot_goto =3D qemu_rbd_snap_rollback, -#ifdef LIBRBD_SUPPORTS_INVALIDATE .bdrv_co_invalidate_cache =3D qemu_rbd_co_invalidate_cache, -#endif =20 .strong_runtime_opts =3D qemu_rbd_strong_runtime_opts, }; diff --git a/configure b/configure index c228f7c21e..e07f80cab4 100755 --- a/configure +++ b/configure @@ -3663,8 +3663,9 @@ if test "$rbd" !=3D "no" ; then #include #include int main(void) { - rados_t cluster; - rados_create(&cluster, NULL); +#if LIBRBD_VERSION_CODE < LIBRBD_VERSION(1, 12, 0) +#error +#endif return 0; } EOF @@ -3673,7 +3674,7 @@ EOF rbd=3Dyes else if test "$rbd" =3D "yes" ; then - feature_not_found "rados block device" "Install librbd/ceph devel" + feature_not_found "rados block device" "Install librbd/ceph devel (>= =3D 12.0.0)" fi rbd=3Dno fi --=20 2.17.1