Message ID | 20210126112540.11880-2-pl@kamp.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | block/rbd: migrate to coroutines and add write zeroes support | expand |
Am 26.01.2021 um 12:25 hat Peter Lieven geschrieben: > 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 <pl@kamp.de> > diff --git a/meson.build b/meson.build > index 5943aa8a51..02d263ad33 100644 > --- a/meson.build > +++ b/meson.build > @@ -691,19 +691,24 @@ if not get_option('rbd').auto() or have_block > required: get_option('rbd'), > kwargs: static_kwargs) > if librados.found() and librbd.found() > - if cc.links(''' > + result = cc.run(''' Doesn't running compiled binaries break cross compilation? > #include <stdio.h> > #include <rbd/librbd.h> > int main(void) { > rados_t cluster; > rados_create(&cluster, NULL); > + rados_shutdown(cluster); > + #if LIBRBD_VERSION_CODE < LIBRBD_VERSION(1, 12, 0) > + return 1; > + #endif > return 0; Would #error achieve what you want without running the binary? But most, if not all, other version checks use pkg-config instead of trying to compile code, so that's probably what we should be doing here, too. > - }''', dependencies: [librbd, librados]) > + }''', dependencies: [librbd, librados], name: 'librbd version check') > + if result.compiled() and result.returncode() == 0 > rbd = declare_dependency(dependencies: [librbd, librados]) > elif get_option('rbd').enabled() > - error('could not link librados') > + error('librados/librbd >= 12.0.0 required') > else > - warning('could not link librados, disabling') > + warning('librados/librbd >= 12.0.0 not found, disabling rbd support') > endif > endif > endif Kevin
On Mon, Feb 15, 2021 at 11:11:23AM +0100, Kevin Wolf wrote: > Am 26.01.2021 um 12:25 hat Peter Lieven geschrieben: > > 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 <pl@kamp.de> > > > diff --git a/meson.build b/meson.build > > index 5943aa8a51..02d263ad33 100644 > > --- a/meson.build > > +++ b/meson.build > > @@ -691,19 +691,24 @@ if not get_option('rbd').auto() or have_block > > required: get_option('rbd'), > > kwargs: static_kwargs) > > if librados.found() and librbd.found() > > - if cc.links(''' > > + result = cc.run(''' > > Doesn't running compiled binaries break cross compilation? > > > #include <stdio.h> > > #include <rbd/librbd.h> > > int main(void) { > > rados_t cluster; > > rados_create(&cluster, NULL); > > + rados_shutdown(cluster); > > + #if LIBRBD_VERSION_CODE < LIBRBD_VERSION(1, 12, 0) > > + return 1; > > + #endif > > return 0; > > Would #error achieve what you want without running the binary? > > But most, if not all, other version checks use pkg-config instead of > trying to compile code, so that's probably what we should be doing here, > too. Yep, for something that is merely a version number check there's no need to compile anything. pkg-config can just validate the version straightup. > > > - }''', dependencies: [librbd, librados]) > > + }''', dependencies: [librbd, librados], name: 'librbd version check') > > + if result.compiled() and result.returncode() == 0 > > rbd = declare_dependency(dependencies: [librbd, librados]) > > elif get_option('rbd').enabled() > > - error('could not link librados') > > + error('librados/librbd >= 12.0.0 required') > > else > > - warning('could not link librados, disabling') > > + warning('librados/librbd >= 12.0.0 not found, disabling rbd support') > > endif > > endif > > endif Regards, Daniel
On Tue, Jan 26, 2021 at 12:25:34PM +0100, Peter Lieven wrote: > 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. We have clear rules on when we bump minimum versions, determined by the OS platforms we target: https://qemu.readthedocs.io/en/latest/system/build-platforms.html At this time RHEL-7 is usually the oldest platform, and it builds with RBD 10.2.5, so we can't bump the version to 12.2. I'm afraid this patch has to be dropped. Regards, Daniel
Am 15.02.21 um 11:24 schrieb Daniel P. Berrangé: > On Tue, Jan 26, 2021 at 12:25:34PM +0100, Peter Lieven wrote: >> 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. > We have clear rules on when we bump minimum versions, determined by > the OS platforms we target: > > https://qemu.readthedocs.io/en/latest/system/build-platforms.html > > At this time RHEL-7 is usually the oldest platform, and it > builds with RBD 10.2.5, so we can't bump the version to 12.2. > > I'm afraid this patch has to be dropped. I have asked exactly this question before I started work on this series and got reply from Jason that he sees no problem in bumping to a release which is already unmaintained for 3 years. If qemu 6.0 is required to build on RHEL-7 than I am afraid we can abandon the whole series. Peter
Am 15.02.21 um 11:19 schrieb Daniel P. Berrangé: > On Mon, Feb 15, 2021 at 11:11:23AM +0100, Kevin Wolf wrote: >> Am 26.01.2021 um 12:25 hat Peter Lieven geschrieben: >>> 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 <pl@kamp.de> >>> diff --git a/meson.build b/meson.build >>> index 5943aa8a51..02d263ad33 100644 >>> --- a/meson.build >>> +++ b/meson.build >>> @@ -691,19 +691,24 @@ if not get_option('rbd').auto() or have_block >>> required: get_option('rbd'), >>> kwargs: static_kwargs) >>> if librados.found() and librbd.found() >>> - if cc.links(''' >>> + result = cc.run(''' >> Doesn't running compiled binaries break cross compilation? >> >>> #include <stdio.h> >>> #include <rbd/librbd.h> >>> int main(void) { >>> rados_t cluster; >>> rados_create(&cluster, NULL); >>> + rados_shutdown(cluster); >>> + #if LIBRBD_VERSION_CODE < LIBRBD_VERSION(1, 12, 0) >>> + return 1; >>> + #endif >>> return 0; >> Would #error achieve what you want without running the binary? >> >> But most, if not all, other version checks use pkg-config instead of >> trying to compile code, so that's probably what we should be doing here, >> too. > Yep, for something that is merely a version number check there's no > need to compile anything. pkg-config can just validate the version > straightup. I would have loved to, but at least the Ubuntu/Debian packages do not contain pkg-config files. I can switch to #error, of course. My initial version of the patch distinguished between can't compile and version is too old. With #error we just can say doesn't compile, but I think this would be ok. Peter
On Mon, Feb 15, 2021 at 12:32:24PM +0100, Peter Lieven wrote: > Am 15.02.21 um 11:24 schrieb Daniel P. Berrangé: > > On Tue, Jan 26, 2021 at 12:25:34PM +0100, Peter Lieven wrote: > > > 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. > > We have clear rules on when we bump minimum versions, determined by > > the OS platforms we target: > > > > https://qemu.readthedocs.io/en/latest/system/build-platforms.html > > > > At this time RHEL-7 is usually the oldest platform, and it > > builds with RBD 10.2.5, so we can't bump the version to 12.2. > > > > I'm afraid this patch has to be dropped. > > > I have asked exactly this question before I started work on this series and got reply > > from Jason that he sees no problem in bumping to a release which is already unmaintained > > for 3 years. I'm afraid Jason is wrong here. It doesn't matter what the upstream consider the support status to be. QEMU targets what the OS vendors ship, and they still consider this to be a supported version. Regards, Daniel
Am 15.02.21 um 12:41 schrieb Daniel P. Berrangé: > On Mon, Feb 15, 2021 at 12:32:24PM +0100, Peter Lieven wrote: >> Am 15.02.21 um 11:24 schrieb Daniel P. Berrangé: >>> On Tue, Jan 26, 2021 at 12:25:34PM +0100, Peter Lieven wrote: >>>> 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. >>> We have clear rules on when we bump minimum versions, determined by >>> the OS platforms we target: >>> >>> https://qemu.readthedocs.io/en/latest/system/build-platforms.html >>> >>> At this time RHEL-7 is usually the oldest platform, and it >>> builds with RBD 10.2.5, so we can't bump the version to 12.2. >>> >>> I'm afraid this patch has to be dropped. >> >> I have asked exactly this question before I started work on this series and got reply >> >> from Jason that he sees no problem in bumping to a release which is already unmaintained >> >> for 3 years. > I'm afraid Jason is wrong here. It doesn't matter what the upstream > consider the support status to be. QEMU targets what the OS vendors > ship, and they still consider this to be a supported version. Okay, but the whole coroutine stuff would get a total mess with all the ifdef'ry. Would it be an option to make a big ifdef in the rbd driver? One with old code for < 12.0.0 and one with new code for >= 12.0.0? Peter
On Mon, Feb 15, 2021 at 12:45:01PM +0100, Peter Lieven wrote: > Am 15.02.21 um 12:41 schrieb Daniel P. Berrangé: > > On Mon, Feb 15, 2021 at 12:32:24PM +0100, Peter Lieven wrote: > > > Am 15.02.21 um 11:24 schrieb Daniel P. Berrangé: > > > > On Tue, Jan 26, 2021 at 12:25:34PM +0100, Peter Lieven wrote: > > > > > 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. > > > > We have clear rules on when we bump minimum versions, determined by > > > > the OS platforms we target: > > > > > > > > https://qemu.readthedocs.io/en/latest/system/build-platforms.html > > > > > > > > At this time RHEL-7 is usually the oldest platform, and it > > > > builds with RBD 10.2.5, so we can't bump the version to 12.2. > > > > > > > > I'm afraid this patch has to be dropped. > > > > > > I have asked exactly this question before I started work on this series and got reply > > > > > > from Jason that he sees no problem in bumping to a release which is already unmaintained > > > > > > for 3 years. > > I'm afraid Jason is wrong here. It doesn't matter what the upstream > > consider the support status to be. QEMU targets what the OS vendors > > ship, and they still consider this to be a supported version. > > > Okay, but the whole coroutine stuff would get a total mess with all the ifdef'ry. Doesn't seem like the write zeros code is adding much more comapred to the ifdefs that already exist... > Would it be an option to make a big ifdef in the rbd driver? One with old code for < 12.0.0 and one > > with new code for >= 12.0.0? ..but I don't have a strong opinion on that, since I'm not maintaining this driver. BTW, we will be free to drop RHEL-7 in the next development cycle of QEMU, starting after the forthcoming 6.0.0 release is out, as it will fall out of our OS support matrix. Regards, Daniel
Am 15.02.21 um 12:51 schrieb Daniel P. Berrangé: > On Mon, Feb 15, 2021 at 12:45:01PM +0100, Peter Lieven wrote: >> Am 15.02.21 um 12:41 schrieb Daniel P. Berrangé: >>> On Mon, Feb 15, 2021 at 12:32:24PM +0100, Peter Lieven wrote: >>>> Am 15.02.21 um 11:24 schrieb Daniel P. Berrangé: >>>>> On Tue, Jan 26, 2021 at 12:25:34PM +0100, Peter Lieven wrote: >>>>>> 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. >>>>> We have clear rules on when we bump minimum versions, determined by >>>>> the OS platforms we target: >>>>> >>>>> https://qemu.readthedocs.io/en/latest/system/build-platforms.html >>>>> >>>>> At this time RHEL-7 is usually the oldest platform, and it >>>>> builds with RBD 10.2.5, so we can't bump the version to 12.2. >>>>> >>>>> I'm afraid this patch has to be dropped. >>>> I have asked exactly this question before I started work on this series and got reply >>>> >>>> from Jason that he sees no problem in bumping to a release which is already unmaintained >>>> >>>> for 3 years. >>> I'm afraid Jason is wrong here. It doesn't matter what the upstream >>> consider the support status to be. QEMU targets what the OS vendors >>> ship, and they still consider this to be a supported version. >> >> Okay, but the whole coroutine stuff would get a total mess with all the ifdef'ry. > Doesn't seem like the write zeros code is adding much more comapred to > the ifdefs that already exist... Yes, I don't like it as well, but write zeroes support was only added in Nautilus (14.x) and the thick provisioning that Jason asked me to add came only with Octopus (15.x). > > >> Would it be an option to make a big ifdef in the rbd driver? One with old code for < 12.0.0 and one >> >> with new code for >= 12.0.0? > ..but I don't have a strong opinion on that, since I'm not maintaining this > driver. > > > BTW, we will be free to drop RHEL-7 in the next development cycle of > QEMU, starting after the forthcoming 6.0.0 release is out, as it will > fall out of our OS support matrix. Thanks for that hint. I would say lets hold this series back until Qemu 6.1. Where can I find the OS support matrix for 6.1 - maybe we can bump the requirement to nautilus to reduce the ifdef'ry further. Peter
On Mon, Feb 15, 2021 at 12:55:24PM +0100, Peter Lieven wrote: > Am 15.02.21 um 12:51 schrieb Daniel P. Berrangé: > > On Mon, Feb 15, 2021 at 12:45:01PM +0100, Peter Lieven wrote: > > > Am 15.02.21 um 12:41 schrieb Daniel P. Berrangé: > > > > On Mon, Feb 15, 2021 at 12:32:24PM +0100, Peter Lieven wrote: > > > > > Am 15.02.21 um 11:24 schrieb Daniel P. Berrangé: > > > > > > On Tue, Jan 26, 2021 at 12:25:34PM +0100, Peter Lieven wrote: > > > > > > > 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. > > > > > > We have clear rules on when we bump minimum versions, determined by > > > > > > the OS platforms we target: > > > > > > > > > > > > https://qemu.readthedocs.io/en/latest/system/build-platforms.html > > > > > > > > > > > > At this time RHEL-7 is usually the oldest platform, and it > > > > > > builds with RBD 10.2.5, so we can't bump the version to 12.2. > > > > > > > > > > > > I'm afraid this patch has to be dropped. > > > > > I have asked exactly this question before I started work on this series and got reply > > > > > > > > > > from Jason that he sees no problem in bumping to a release which is already unmaintained > > > > > > > > > > for 3 years. > > > > I'm afraid Jason is wrong here. It doesn't matter what the upstream > > > > consider the support status to be. QEMU targets what the OS vendors > > > > ship, and they still consider this to be a supported version. > > > > > > Okay, but the whole coroutine stuff would get a total mess with all the ifdef'ry. > > Doesn't seem like the write zeros code is adding much more comapred to > > the ifdefs that already exist... > > > Yes, I don't like it as well, but write zeroes support was only added in Nautilus (14.x) and the thick provisioning > > that Jason asked me to add came only with Octopus (15.x). > > > > > > > > > Would it be an option to make a big ifdef in the rbd driver? One with old code for < 12.0.0 and one > > > > > > with new code for >= 12.0.0? > > ..but I don't have a strong opinion on that, since I'm not maintaining this > > driver. > > > > > > BTW, we will be free to drop RHEL-7 in the next development cycle of > > QEMU, starting after the forthcoming 6.0.0 release is out, as it will > > fall out of our OS support matrix. > > > Thanks for that hint. I would say lets hold this series back until Qemu 6.1. > > Where can I find the OS support matrix for 6.1 - maybe we can bump the requirement to nautilus to > > reduce the ifdef'ry further. The rules are documented here: https://qemu.readthedocs.io/en/latest/system/build-platforms.html RHEL-7 falls out because in May it will be 2 years since RHEL-8 came out and thus "The project aims to support the most recent major version at all times. Support for the previous major version will be dropped 2 years after the new major version is released or when the vendor itself drops support, whichever comes first." someone has todo the investigation to find out versions across the distros. Regards, Daniel
Am 15.02.2021 um 12:45 hat Peter Lieven geschrieben: > Am 15.02.21 um 12:41 schrieb Daniel P. Berrangé: > > On Mon, Feb 15, 2021 at 12:32:24PM +0100, Peter Lieven wrote: > > > Am 15.02.21 um 11:24 schrieb Daniel P. Berrangé: > > > > On Tue, Jan 26, 2021 at 12:25:34PM +0100, Peter Lieven wrote: > > > > > 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. > > > > We have clear rules on when we bump minimum versions, determined by > > > > the OS platforms we target: > > > > > > > > https://qemu.readthedocs.io/en/latest/system/build-platforms.html > > > > > > > > At this time RHEL-7 is usually the oldest platform, and it > > > > builds with RBD 10.2.5, so we can't bump the version to 12.2. > > > > > > > > I'm afraid this patch has to be dropped. > > > > > > I have asked exactly this question before I started work on this series and got reply > > > > > > from Jason that he sees no problem in bumping to a release which is already unmaintained > > > > > > for 3 years. > > I'm afraid Jason is wrong here. It doesn't matter what the upstream > > consider the support status to be. QEMU targets what the OS vendors > > ship, and they still consider this to be a supported version. > > > Okay, but the whole coroutine stuff would get a total mess with all > the ifdef'ry. Hm, but how are these ifdefs even related to the coroutine conversation? It's a bit more code that you're moving around, but shouldn't it be unchanged from the old code, just moving from an AIO callback to a coroutine? Or am I missing some complications? > Would it be an option to make a big ifdef in the rbd driver? One with > old code for < 12.0.0 and one > > with new code for >= 12.0.0? I don't think this is a good idea, this would be a huge mess to maintain. The conversion is probably a good idea in general, simply because it's more in line with the rest of the block layer, but I don't think it adds anything per se, so it's hard to justify such duplication with the benefits it brings. Kevin
Am 15.02.2021 um 12:34 hat Peter Lieven geschrieben: > Am 15.02.21 um 11:19 schrieb Daniel P. Berrangé: > > On Mon, Feb 15, 2021 at 11:11:23AM +0100, Kevin Wolf wrote: > > > Am 26.01.2021 um 12:25 hat Peter Lieven geschrieben: > > > > 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 <pl@kamp.de> > > > > diff --git a/meson.build b/meson.build > > > > index 5943aa8a51..02d263ad33 100644 > > > > --- a/meson.build > > > > +++ b/meson.build > > > > @@ -691,19 +691,24 @@ if not get_option('rbd').auto() or have_block > > > > required: get_option('rbd'), > > > > kwargs: static_kwargs) > > > > if librados.found() and librbd.found() > > > > - if cc.links(''' > > > > + result = cc.run(''' > > > Doesn't running compiled binaries break cross compilation? > > > > > > > #include <stdio.h> > > > > #include <rbd/librbd.h> > > > > int main(void) { > > > > rados_t cluster; > > > > rados_create(&cluster, NULL); > > > > + rados_shutdown(cluster); > > > > + #if LIBRBD_VERSION_CODE < LIBRBD_VERSION(1, 12, 0) > > > > + return 1; > > > > + #endif > > > > return 0; > > > Would #error achieve what you want without running the binary? > > > > > > But most, if not all, other version checks use pkg-config instead of > > > trying to compile code, so that's probably what we should be doing here, > > > too. > > Yep, for something that is merely a version number check there's no > > need to compile anything. pkg-config can just validate the version > > straightup. > > > I would have loved to, but at least the Ubuntu/Debian packages do not > contain pkg-config files. Oh. That's a shame. > I can switch to #error, of course. My initial version of the patch > distinguished between can't compile and version is too old. With > #error we just can say doesn't compile, but I think this would be ok. Yes, I think #error and a less specific message is better than breaking cross compilation. Maybe also add a comment as to why we can't use pkg-config so that others won't take it as an example where pkg-config would work. Kevin
Am 15.02.21 um 13:13 schrieb Kevin Wolf: > Am 15.02.2021 um 12:45 hat Peter Lieven geschrieben: >> Am 15.02.21 um 12:41 schrieb Daniel P. Berrangé: >>> On Mon, Feb 15, 2021 at 12:32:24PM +0100, Peter Lieven wrote: >>>> Am 15.02.21 um 11:24 schrieb Daniel P. Berrangé: >>>>> On Tue, Jan 26, 2021 at 12:25:34PM +0100, Peter Lieven wrote: >>>>>> 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. >>>>> We have clear rules on when we bump minimum versions, determined by >>>>> the OS platforms we target: >>>>> >>>>> https://qemu.readthedocs.io/en/latest/system/build-platforms.html >>>>> >>>>> At this time RHEL-7 is usually the oldest platform, and it >>>>> builds with RBD 10.2.5, so we can't bump the version to 12.2. >>>>> >>>>> I'm afraid this patch has to be dropped. >>>> I have asked exactly this question before I started work on this series and got reply >>>> >>>> from Jason that he sees no problem in bumping to a release which is already unmaintained >>>> >>>> for 3 years. >>> I'm afraid Jason is wrong here. It doesn't matter what the upstream >>> consider the support status to be. QEMU targets what the OS vendors >>> ship, and they still consider this to be a supported version. >> >> Okay, but the whole coroutine stuff would get a total mess with all >> the ifdef'ry. > Hm, but how are these ifdefs even related to the coroutine conversation? > It's a bit more code that you're moving around, but shouldn't it be > unchanged from the old code, just moving from an AIO callback to a > coroutine? Or am I missing some complications? No, the ifdef's only come back in for the write zeroes part. > >> Would it be an option to make a big ifdef in the rbd driver? One with >> old code for < 12.0.0 and one >> >> with new code for >= 12.0.0? > I don't think this is a good idea, this would be a huge mess to > maintain. > > The conversion is probably a good idea in general, simply because it's > more in line with the rest of the block layer, but I don't think it adds > anything per se, so it's hard to justify such duplication with the > benefits it brings. I would wait for Jasons comment on the rbd part of the series and then spin a V3 with a for-6.1 tag. Peter
On Mon, Feb 15, 2021 at 8:29 AM Peter Lieven <pl@kamp.de> wrote: > > Am 15.02.21 um 13:13 schrieb Kevin Wolf: > > Am 15.02.2021 um 12:45 hat Peter Lieven geschrieben: > >> Am 15.02.21 um 12:41 schrieb Daniel P. Berrangé: > >>> On Mon, Feb 15, 2021 at 12:32:24PM +0100, Peter Lieven wrote: > >>>> Am 15.02.21 um 11:24 schrieb Daniel P. Berrangé: > >>>>> On Tue, Jan 26, 2021 at 12:25:34PM +0100, Peter Lieven wrote: > >>>>>> 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. > >>>>> We have clear rules on when we bump minimum versions, determined by > >>>>> the OS platforms we target: > >>>>> > >>>>> https://qemu.readthedocs.io/en/latest/system/build-platforms.html > >>>>> > >>>>> At this time RHEL-7 is usually the oldest platform, and it > >>>>> builds with RBD 10.2.5, so we can't bump the version to 12.2. > >>>>> > >>>>> I'm afraid this patch has to be dropped. > >>>> I have asked exactly this question before I started work on this series and got reply > >>>> > >>>> from Jason that he sees no problem in bumping to a release which is already unmaintained > >>>> > >>>> for 3 years. > >>> I'm afraid Jason is wrong here. It doesn't matter what the upstream > >>> consider the support status to be. QEMU targets what the OS vendors > >>> ship, and they still consider this to be a supported version. > >> > >> Okay, but the whole coroutine stuff would get a total mess with all > >> the ifdef'ry. > > Hm, but how are these ifdefs even related to the coroutine conversation? > > It's a bit more code that you're moving around, but shouldn't it be > > unchanged from the old code, just moving from an AIO callback to a > > coroutine? Or am I missing some complications? > > > No, the ifdef's only come back in for the write zeroes part. > > > > > >> Would it be an option to make a big ifdef in the rbd driver? One with > >> old code for < 12.0.0 and one > >> > >> with new code for >= 12.0.0? > > I don't think this is a good idea, this would be a huge mess to > > maintain. > > > > The conversion is probably a good idea in general, simply because it's > > more in line with the rest of the block layer, but I don't think it adds > > anything per se, so it's hard to justify such duplication with the > > benefits it brings. > > > I would wait for Jasons comment on the rbd part of the series and then spin a V3 > > with a for-6.1 tag. Sorry for the long delay -- I was delayed from being out-of-town. I've reviewed and play-tested the patches and it looks good for me. I'll wait for V3 before adding my official review. > > > Peter >
diff --git a/block/rbd.c b/block/rbd.c index 9071a00e3f..a191c74619 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 - 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; @@ -332,13 +316,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); } /* FIXME Deprecate and remove keypairs or make it available in QMP. */ @@ -493,13 +473,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); @@ -866,28 +839,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, @@ -910,21 +861,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; @@ -938,7 +874,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 @@ -950,25 +886,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; @@ -983,9 +910,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; @@ -1011,7 +935,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) @@ -1019,20 +942,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; @@ -1198,7 +1107,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, @@ -1208,9 +1116,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) { @@ -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 static QemuOptsList qemu_rbd_create_opts = { .name = "rbd-create-opts", @@ -1278,23 +1183,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 5943aa8a51..02d263ad33 100644 --- a/meson.build +++ b/meson.build @@ -691,19 +691,24 @@ if not get_option('rbd').auto() or have_block required: get_option('rbd'), kwargs: static_kwargs) if librados.found() and librbd.found() - if cc.links(''' + result = cc.run(''' #include <stdio.h> #include <rbd/librbd.h> int main(void) { rados_t cluster; rados_create(&cluster, NULL); + rados_shutdown(cluster); + #if LIBRBD_VERSION_CODE < LIBRBD_VERSION(1, 12, 0) + return 1; + #endif return 0; - }''', dependencies: [librbd, librados]) + }''', dependencies: [librbd, librados], name: 'librbd version check') + if result.compiled() and result.returncode() == 0 rbd = declare_dependency(dependencies: [librbd, librados]) elif get_option('rbd').enabled() - error('could not link librados') + error('librados/librbd >= 12.0.0 required') else - warning('could not link librados, disabling') + warning('librados/librbd >= 12.0.0 not found, disabling rbd support') endif endif endif
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 <pl@kamp.de> --- block/rbd.c | 120 ++++------------------------------------------------ meson.build | 13 ++++-- 2 files changed, 17 insertions(+), 116 deletions(-)