Re: [Qemu-devel] [RFC v6] RBD: Add support readv,writev for rbd
Sorry, I do not know. I thought we should always add RFC all though the patch's life... What is the prefix i should add? PATH 0 ? 2017-02-24 19:42 GMT+08:00 Jeff Cody: > On Fri, Feb 24, 2017 at 02:09:31PM +0800, Jaze Lee wrote: >> 2017-02-24 11:52 GMT+08:00 Jeff Cody : >> > On Tue, Feb 21, 2017 at 02:50:03PM +0800, jaze...@gmail.com wrote: >> >> From: tianqing >> >> >> >> Rbd can do readv and writev directly, so wo do not need to transform >> >> iov to buf or vice versa any more. >> >> >> >> Signed-off-by: tianqing >> >> --- >> > >> > >> > This is marked as an RFC still - is this a series you would like to see in >> > 2.9? >> >> Yes. What should i do if i like it in 2.9 >> > > Ideally you would submit the series as a non-RFC patch (that is, it would > have progressed to a normal patch away from RFC). > > But in this case, it seems to me that this patch has progressed beyond RFC; > is there any reason it is still marked as RFC instead of just a patch? It > looks OK to me. > -- 谦谦君子
Re: [Qemu-devel] [RFC v6] RBD: Add support readv,writev for rbd
On Fri, Feb 24, 2017 at 02:09:31PM +0800, Jaze Lee wrote: > 2017-02-24 11:52 GMT+08:00 Jeff Cody: > > On Tue, Feb 21, 2017 at 02:50:03PM +0800, jaze...@gmail.com wrote: > >> From: tianqing > >> > >> Rbd can do readv and writev directly, so wo do not need to transform > >> iov to buf or vice versa any more. > >> > >> Signed-off-by: tianqing > >> --- > > > > > > This is marked as an RFC still - is this a series you would like to see in > > 2.9? > > Yes. What should i do if i like it in 2.9 > Ideally you would submit the series as a non-RFC patch (that is, it would have progressed to a normal patch away from RFC). But in this case, it seems to me that this patch has progressed beyond RFC; is there any reason it is still marked as RFC instead of just a patch? It looks OK to me.
Re: [Qemu-devel] [RFC v6] RBD: Add support readv,writev for rbd
2017-02-24 11:52 GMT+08:00 Jeff Cody: > On Tue, Feb 21, 2017 at 02:50:03PM +0800, jaze...@gmail.com wrote: >> From: tianqing >> >> Rbd can do readv and writev directly, so wo do not need to transform >> iov to buf or vice versa any more. >> >> Signed-off-by: tianqing >> --- > > > This is marked as an RFC still - is this a series you would like to see in > 2.9? Yes. What should i do if i like it in 2.9 -- 谦谦君子
Re: [Qemu-devel] [RFC v6] RBD: Add support readv,writev for rbd
On Tue, Feb 21, 2017 at 02:50:03PM +0800, jaze...@gmail.com wrote: > From: tianqing> > Rbd can do readv and writev directly, so wo do not need to transform > iov to buf or vice versa any more. > > Signed-off-by: tianqing > --- This is marked as an RFC still - is this a series you would like to see in 2.9?
[Qemu-devel] [RFC v6] RBD: Add support readv,writev for rbd
From: tianqingRbd can do readv and writev directly, so wo do not need to transform iov to buf or vice versa any more. Signed-off-by: tianqing --- block/rbd.c | 80 ++--- 1 file changed, 56 insertions(+), 24 deletions(-) diff --git a/block/rbd.c b/block/rbd.c index a57b3e3..22e8e69 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -62,6 +62,13 @@ #define RBD_MAX_SNAP_NAME_SIZE 128 #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 + typedef enum { RBD_AIO_READ, RBD_AIO_WRITE, @@ -310,6 +317,17 @@ static int qemu_rbd_set_conf(rados_t cluster, const char *conf, return ret; } +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); +} +} + static int qemu_rbd_create(const char *filename, QemuOpts *opts, Error **errp) { Error *local_err = NULL; @@ -426,11 +444,11 @@ static void qemu_rbd_complete_aio(RADOSCB *rcb) } } else { if (r < 0) { -memset(rcb->buf, 0, rcb->size); +qemu_rbd_memset(rcb, 0); acb->ret = r; acb->error = 1; } else if (r < rcb->size) { -memset(rcb->buf + r, 0, rcb->size - r); +qemu_rbd_memset(rcb, r); if (!acb->error) { acb->ret = rcb->size; } @@ -441,10 +459,13 @@ static void qemu_rbd_complete_aio(RADOSCB *rcb) g_free(rcb); -if (acb->cmd == RBD_AIO_READ) { -qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size); +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); } -qemu_vfree(acb->bounce); + acb->common.cb(acb->common.opaque, (acb->ret > 0 ? 0 : acb->ret)); qemu_aio_unref(acb); @@ -655,7 +676,6 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, RBDAIOCB *acb; RADOSCB *rcb = NULL; rbd_completion_t c; -char *buf; int r; BDRVRBDState *s = bs->opaque; @@ -664,27 +684,29 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, acb->cmd = cmd; acb->qiov = qiov; assert(!qiov || qiov->size == size); -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; + +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; -if (cmd == RBD_AIO_WRITE) { -qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size); -} - -buf = acb->bounce; - -rcb = g_new(RADOSCB, 1); rcb->acb = acb; -rcb->buf = buf; rcb->s = acb->s; rcb->size = size; r = rbd_aio_create_completion(rcb, (rbd_callback_t) rbd_finish_aiocb, ); @@ -694,10 +716,18 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, switch (cmd) { case RBD_AIO_WRITE: -r = rbd_aio_write(s->image, off, size, buf, c); +#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 break; case RBD_AIO_READ: -r = rbd_aio_read(s->image, off, size, buf, c); +#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 break; case RBD_AIO_DISCARD: r = rbd_aio_discard_wrapper(s->image, off, size, c); @@ -712,14 +742,16 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, if (r < 0) { goto failed_completion; } - return >common; failed_completion: rbd_aio_release(c); failed: g_free(rcb); -qemu_vfree(acb->bounce); +if (!LIBRBD_USE_IOVEC) { +qemu_vfree(acb->bounce); +} + qemu_aio_unref(acb); return NULL; } -- 2.10.2
Re: [Qemu-devel] [RFC v6] RBD: Add support readv,writev for rbd
On Tue, Feb 21, 2017 at 11:43:36AM +0800, jaze...@gmail.com wrote: > From: tianqing> > Rbd can do readv and writev directly, so wo do not need to transform > iov to buf or vice versa any more. > > Signed-off-by: tianqing > --- > block/rbd.c | 79 > ++--- > 1 file changed, 54 insertions(+), 25 deletions(-) > [...] > case RBD_AIO_WRITE: > -r = rbd_aio_write(s->image, off, size, buf, c); > +if(!LIBRBD_USE_IOVEC) > +r = rbd_aio_write(s->image, off, size, rcb->buf, c); > +else > +r = rbd_aio_writev(s->image, qiov->iov, qiov->niov, off, c); > break; > case RBD_AIO_READ: > -r = rbd_aio_read(s->image, off, size, buf, c); > +if(!LIBRBD_USE_IOVEC) > +r = rbd_aio_read(s->image, off, size, rcb->buf, c); > +else > +r = rbd_aio_readv(s->image, qiov->iov, qiov->niov, off, c); These will need to stay #ifdef's since they are new symbols. > break; > case RBD_AIO_DISCARD: > r = rbd_aio_discard_wrapper(s->image, off, size, c); > @@ -712,14 +740,15 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, > if (r < 0) { > goto failed_completion; > } > - > return >common; > > failed_completion: > rbd_aio_release(c); > failed: > g_free(rcb); > -qemu_vfree(acb->bounce); > +if(!LIBRBD_USE_IOVEC) > +qemu_vfree(acb->bounce); > + > qemu_aio_unref(acb); > return NULL; > } > -- > 2.10.2 > (Also code formatting as pointed out by patchew)
Re: [Qemu-devel] [RFC v6] RBD: Add support readv,writev for rbd
Hi, This series failed build test on s390x host. Please find the details below. Type: series Subject: [Qemu-devel] [RFC v6] RBD: Add support readv,writev for rbd Message-id: 20170221034336.10097-1-jaze...@gmail.com === TEST SCRIPT BEGIN === #!/bin/bash # Testing script will be invoked under the git checkout with # HEAD pointing to a commit that has the patches applied on top of "base" # branch set -e echo "=== ENV ===" env echo "=== PACKAGES ===" rpm -qa echo "=== TEST BEGIN ===" CC=$HOME/bin/cc INSTALL=$PWD/install BUILD=/var/tmp/patchew-qemu-build echo -n "Using CC: " realpath $CC test -e $BUILD && rm -rf $BUILD mkdir -p $BUILD $INSTALL SRC=$PWD cd $BUILD $SRC/configure --cc=$CC --prefix=$INSTALL make -j4 make check -j4 make install === TEST SCRIPT END === Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 From https://github.com/patchew-project/qemu * [new tag] patchew/20170221034336.10097-1-jaze...@gmail.com -> patchew/20170221034336.10097-1-jaze...@gmail.com Switched to a new branch 'test' dc83903 RBD: Add support readv,writev for rbd === OUTPUT BEGIN === === ENV === XDG_SESSION_ID=29861 SHELL=/bin/sh USER=fam PATCHEW=/home/fam/patchew/patchew-cli -s http://patchew.org --nodebug PATH=/usr/bin:/bin PWD=/var/tmp/patchew-tester-tmp-855u0v7j/src LANG=en_US.UTF-8 HOME=/home/fam SHLVL=2 LOGNAME=fam DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1012/bus XDG_RUNTIME_DIR=/run/user/1012 _=/usr/bin/env === PACKAGES === gpg-pubkey-873529b8-54e386ff xz-libs-5.2.2-2.fc24.s390x libacl-2.2.52-11.fc24.s390x libxshmfence-1.2-3.fc24.s390x cdparanoia-libs-10.2-21.fc24.s390x ustr-1.0.4-21.fc24.s390x giflib-4.1.6-15.fc24.s390x libusb-0.1.5-7.fc24.s390x trousers-lib-0.3.13-6.fc24.s390x readline-devel-6.3-8.fc24.s390x python-srpm-macros-3-10.fc25.noarch ncurses-base-6.0-6.20160709.fc25.noarch gmp-6.1.1-1.fc25.s390x chkconfig-1.8-1.fc25.s390x libidn-1.33-1.fc25.s390x file-5.28-4.fc25.s390x slang-2.3.0-7.fc25.s390x avahi-libs-0.6.32-4.fc25.s390x libsemanage-2.5-8.fc25.s390x perl-Unicode-Normalize-1.25-365.fc25.s390x perl-libnet-3.10-1.fc25.noarch perl-Thread-Queue-3.11-1.fc25.noarch perl-podlators-4.09-1.fc25.noarch jasper-libs-1.900.13-1.fc25.s390x graphite2-1.3.6-1.fc25.s390x libblkid-2.28.2-1.fc25.s390x pkgconfig-0.29.1-1.fc25.s390x dbus-python-1.2.4-2.fc25.s390x alsa-lib-1.1.1-2.fc25.s390x libgnome-keyring-3.12.0-7.fc25.s390x yum-metadata-parser-1.1.4-17.fc25.s390x python3-3.5.2-4.fc25.s390x python3-slip-dbus-0.6.4-4.fc25.noarch python2-cssselect-0.9.2-1.fc25.noarch python-backports-1.0-8.fc25.s390x python-magic-5.28-4.fc25.noarch python-pycparser-2.14-7.fc25.noarch python-fedora-0.8.0-2.fc25.noarch createrepo_c-libs-0.10.0-6.fc25.s390x initscripts-9.69-1.fc25.s390x plymouth-scripts-0.9.3-0.6.20160620git0e65b86c.fc25.s390x cronie-1.5.1-2.fc25.s390x python2-librepo-1.7.18-3.fc25.s390x wget-1.18-2.fc25.s390x python3-dnf-plugins-core-0.1.21-4.fc25.noarch at-spi2-core-2.22.0-1.fc25.s390x libXv-1.0.11-1.fc25.s390x dhcp-client-4.3.5-1.fc25.s390x python2-dnf-plugins-core-0.1.21-4.fc25.noarch parted-3.2-21.fc25.s390x python2-ndg_httpsclient-0.4.0-4.fc25.noarch bash-completion-2.4-1.fc25.noarch btrfs-progs-4.6.1-1.fc25.s390x texinfo-6.1-3.fc25.s390x perl-Filter-1.55-366.fc25.s390x flex-2.6.0-3.fc25.s390x libgcc-6.3.1-1.fc25.s390x glib2-2.50.2-1.fc25.s390x dbus-libs-1.11.8-1.fc25.s390x libgomp-6.3.1-1.fc25.s390x colord-libs-1.3.4-1.fc25.s390x perl-Encode-2.88-5.fc25.s390x gstreamer1-1.10.2-1.fc25.s390x cracklib-2.9.6-4.fc25.s390x rpm-build-libs-4.13.0-6.fc25.s390x libobjc-6.3.1-1.fc25.s390x pcre-devel-8.40-1.fc25.s390x mariadb-config-10.1.20-1.fc25.s390x gcc-6.3.1-1.fc25.s390x mesa-libGL-13.0.3-1.fc25.s390x python3-dnf-plugin-system-upgrade-0.7.1-4.fc25.noarch bind-libs-9.10.4-4.P5.fc25.s390x python-osbs-client-0.33-3.fc25.noarch NetworkManager-1.4.4-3.fc25.s390x audit-2.7.1-1.fc25.s390x glibc-static-2.24-4.fc25.s390x perl-Pod-Simple-3.35-1.fc25.noarch gdb-7.12-36.fc25.s390x python2-simplejson-3.10.0-1.fc25.s390x python3-sssdconfig-1.14.2-2.fc25.noarch texlive-lib-2016-30.20160520.fc25.s390x boost-random-1.60.0-10.fc25.s390x brltty-5.4-2.fc25.s390x libref_array-0.1.5-29.fc25.s390x librados2-10.2.4-2.fc25.s390x gnutls-dane-3.5.8-1.fc25.s390x systemtap-client-3.1-0.20160725git91bfb36.fc25.s390x libXrender-devel-0.9.10-1.fc25.s390x libXi-devel-1.7.8-2.fc25.s390x texlive-pdftex-doc-svn41149-30.fc25.noarch tcp_wrappers-7.6-83.fc25.s390x javapackages-tools-4.7.0-6.1.fc25.noarch texlive-kpathsea-bin-svn40473-30.20160520.fc25.s390x texlive-url-svn32528.3.4-30.fc25.noarch texlive-latex-fonts-svn2.0-30.fc25.noarch texlive-mptopdf-bin-svn18674.0-30.20160520.fc25.noarch texlive-underscore-svn18261.0-30.fc25.noarch texlive-subfig-svn15878.1.3-30.fc25.noarch texlive-dvipdfmx-def-svn40328-30.fc25.noarch texlive-plain-svn40274-30.fc25.noarch texlive-texlive-scripts-svn41433-30.fc25.noarch texlive-fancyref-svn15878.0.9c-30.fc25.noarch texlive-csquotes-svn39538-30.fc25.
Re: [Qemu-devel] [RFC v6] RBD: Add support readv,writev for rbd
Hi, This series seems to have some coding style problems. See output below for more information: Type: series Subject: [Qemu-devel] [RFC v6] RBD: Add support readv,writev for rbd Message-id: 20170221034336.10097-1-jaze...@gmail.com === TEST SCRIPT BEGIN === #!/bin/bash BASE=base n=1 total=$(git log --oneline $BASE.. | wc -l) failed=0 # Useful git options git config --local diff.renamelimit 0 git config --local diff.renames True commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..." if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then failed=1 echo fi n=$((n+1)) done exit $failed === TEST SCRIPT END === Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 From https://github.com/patchew-project/qemu * [new tag] patchew/20170221034336.10097-1-jaze...@gmail.com -> patchew/20170221034336.10097-1-jaze...@gmail.com Switched to a new branch 'test' dc83903 RBD: Add support readv,writev for rbd === OUTPUT BEGIN === Checking PATCH 1/1: RBD: Add support readv,writev for rbd... ERROR: space required before the open brace '{' #36: FILE: block/rbd.c:322: +if(LIBRBD_USE_IOVEC){ ERROR: space required before the open parenthesis '(' #36: FILE: block/rbd.c:322: +if(LIBRBD_USE_IOVEC){ ERROR: trailing whitespace #69: FILE: block/rbd.c:461: + $ ERROR: suspect code indent for conditional statements (4, 9) #70: FILE: block/rbd.c:462: +if(!LIBRBD_USE_IOVEC){ + if (acb->cmd == RBD_AIO_READ) { ERROR: space required before the open brace '{' #70: FILE: block/rbd.c:462: +if(!LIBRBD_USE_IOVEC){ ERROR: space required before the open parenthesis '(' #70: FILE: block/rbd.c:462: +if(!LIBRBD_USE_IOVEC){ ERROR: suspect code indent for conditional statements (9, 13) #71: FILE: block/rbd.c:463: + if (acb->cmd == RBD_AIO_READ) { + qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size); ERROR: space required before the open brace '{' #102: FILE: block/rbd.c:690: +if(!LIBRBD_USE_IOVEC){ ERROR: space required before the open parenthesis '(' #102: FILE: block/rbd.c:690: +if(!LIBRBD_USE_IOVEC){ ERROR: space required before the open parenthesis '(' #138: FILE: block/rbd.c:719: +if(!LIBRBD_USE_IOVEC) ERROR: braces {} are necessary for all arms of this statement #138: FILE: block/rbd.c:719: +if(!LIBRBD_USE_IOVEC) [...] +else [...] ERROR: space required before the open parenthesis '(' #145: FILE: block/rbd.c:725: +if(!LIBRBD_USE_IOVEC) ERROR: braces {} are necessary for all arms of this statement #145: FILE: block/rbd.c:725: +if(!LIBRBD_USE_IOVEC) [...] +else [...] ERROR: space required before the open parenthesis '(' #164: FILE: block/rbd.c:749: +if(!LIBRBD_USE_IOVEC) ERROR: braces {} are necessary for all arms of this statement #164: FILE: block/rbd.c:749: +if(!LIBRBD_USE_IOVEC) [...] total: 15 errors, 0 warnings, 146 lines checked Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. === OUTPUT END === Test command exited with code: 1 --- Email generated automatically by Patchew [http://patchew.org/]. Please send your feedback to patchew-de...@freelists.org
[Qemu-devel] [RFC v6] RBD: Add support readv,writev for rbd
From: tianqingRbd can do readv and writev directly, so wo do not need to transform iov to buf or vice versa any more. Signed-off-by: tianqing --- block/rbd.c | 79 ++--- 1 file changed, 54 insertions(+), 25 deletions(-) diff --git a/block/rbd.c b/block/rbd.c index a57b3e3..5373680 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -62,6 +62,13 @@ #define RBD_MAX_SNAP_NAME_SIZE 128 #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 + typedef enum { RBD_AIO_READ, RBD_AIO_WRITE, @@ -310,6 +317,17 @@ static int qemu_rbd_set_conf(rados_t cluster, const char *conf, return ret; } +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); +} +} + static int qemu_rbd_create(const char *filename, QemuOpts *opts, Error **errp) { Error *local_err = NULL; @@ -426,11 +444,11 @@ static void qemu_rbd_complete_aio(RADOSCB *rcb) } } else { if (r < 0) { -memset(rcb->buf, 0, rcb->size); +qemu_rbd_memset(rcb, 0); acb->ret = r; acb->error = 1; } else if (r < rcb->size) { -memset(rcb->buf + r, 0, rcb->size - r); +qemu_rbd_memset(rcb, r); if (!acb->error) { acb->ret = rcb->size; } @@ -440,11 +458,14 @@ static void qemu_rbd_complete_aio(RADOSCB *rcb) } g_free(rcb); - -if (acb->cmd == RBD_AIO_READ) { -qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size); + +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); } -qemu_vfree(acb->bounce); + acb->common.cb(acb->common.opaque, (acb->ret > 0 ? 0 : acb->ret)); qemu_aio_unref(acb); @@ -655,7 +676,6 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, RBDAIOCB *acb; RADOSCB *rcb = NULL; rbd_completion_t c; -char *buf; int r; BDRVRBDState *s = bs->opaque; @@ -664,27 +684,29 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, acb->cmd = cmd; acb->qiov = qiov; assert(!qiov || qiov->size == size); -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; + +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; -if (cmd == RBD_AIO_WRITE) { -qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size); -} - -buf = acb->bounce; - -rcb = g_new(RADOSCB, 1); rcb->acb = acb; -rcb->buf = buf; rcb->s = acb->s; rcb->size = size; r = rbd_aio_create_completion(rcb, (rbd_callback_t) rbd_finish_aiocb, ); @@ -694,10 +716,16 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, switch (cmd) { case RBD_AIO_WRITE: -r = rbd_aio_write(s->image, off, size, buf, c); +if(!LIBRBD_USE_IOVEC) +r = rbd_aio_write(s->image, off, size, rcb->buf, c); +else +r = rbd_aio_writev(s->image, qiov->iov, qiov->niov, off, c); break; case RBD_AIO_READ: -r = rbd_aio_read(s->image, off, size, buf, c); +if(!LIBRBD_USE_IOVEC) +r = rbd_aio_read(s->image, off, size, rcb->buf, c); +else +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); @@ -712,14 +740,15 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, if (r < 0) { goto failed_completion; } - return >common; failed_completion: rbd_aio_release(c); failed: g_free(rcb); -qemu_vfree(acb->bounce); +if(!LIBRBD_USE_IOVEC) +qemu_vfree(acb->bounce); + qemu_aio_unref(acb); return NULL; } -- 2.10.2