Skip to contentSkip to conversation

pkg-config and discard support for gluster driver

RFC PATCH New Bharata B Rao 6 participants 14 messages Jul 12, 2013 – Jul 23, 2013 Block layer

lore
Share & tools
lore
#0 lore raw

cover pkg-config and discard support for gluster driver

Hi,

This is a patchset that achieves the following:

- Use pkg-config to configure GlusterFS driver in QEMU.
- Enable discard support in GlusterFS driver.

Regards,
Bharata.

#1 lore raw

RFC PATCH 1/2 gluster: Use pkg-config to configure GlusterFS block driver

gluster: Use pkg-config to configure GlusterFS block driver

Use pkg-config to determine the version and library dependency for GlusterFS block driver.

---
 configure |   20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
configure +7 -13
index cb0f870..76adcb1 100755
@@ -2566,23 +2566,17 @@ fi
 ##########################################
 # glusterfs probe
 if test "$glusterfs" != "no" ; then
-  cat > $TMPC <<EOF
-#include <glusterfs/api/glfs.h>
-int main(void) {
-    (void) glfs_new("volume");
-    return 0;
-}
-EOF
-  glusterfs_libs="-lgfapi -lgfrpc -lgfxdr"
-  if compile_prog "" "$glusterfs_libs" ; then
-    glusterfs=yes
-    libs_tools="$glusterfs_libs $libs_tools"
-    libs_softmmu="$glusterfs_libs $libs_softmmu"
+  if $pkg_config --atleast-version=3 glusterfs-api >/dev/null 2>&1; then
+    glusterfs="yes"
+    glusterfs_cflags=`$pkg_config --cflags glusterfs-api 2>/dev/null`
+    glusterfs_libs=`$pkg_config --libs glusterfs-api 2>/dev/null`
+    CFLAGS="$CFLAGS $glusterfs_cflags"
+    LIBS="$LIBS $glusterfs_libs"
   else
     if test "$glusterfs" = "yes" ; then
       feature_not_found "GlusterFS backend support"
     fi
-    glusterfs=no
+    glusterfs="no"
   fi
 fi
 
#2 lore raw

Re: [Qemu-devel] [RFC PATCH v1 1/2] gluster: Use pkg-config to configure GlusterFS block driver

Quoted 1 line · Bharata B Rao

gluster: Use pkg-config to configure GlusterFS block driver

The commit message is duplicated in the commit description.

Quoted 19 lines

Use pkg-config to determine the version and library dependency for GlusterFS block driver.

---
 configure |   20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
configure +0 -3
index cb0f870..76adcb1 100755
@@ -2566,23 +2566,17 @@ fi
 ##########################################
 # glusterfs probe
 if test "$glusterfs" != "no" ; then
-  cat > $TMPC <<EOF
-#include <glusterfs/api/glfs.h>
-int main(void) {

configure fi · line 2569

Quoted 10 lines
configure +1 -9
-    (void) glfs_new("volume");
-    return 0;
-}
-EOF
-  glusterfs_libs="-lgfapi -lgfrpc -lgfxdr"
-  if compile_prog "" "$glusterfs_libs" ; then
-    glusterfs=yes
-    libs_tools="$glusterfs_libs $libs_tools"
-    libs_softmmu="$glusterfs_libs $libs_softmmu"
+  if $pkg_config --atleast-version=3 glusterfs-api >/dev/null 2>&1; then

gfapi was added in Gluster 3.4. Is --atleast-version=3 sufficient?

#3 lore raw

Re: [Qemu-devel] [RFC PATCH v1 1/2] gluster: Use pkg-config to configure GlusterFS block driver

Quoted 28 lines · Stefan Hajnoczi
Quoted 1 line · Bharata B Rao

gluster: Use pkg-config to configure GlusterFS block driver

The commit message is duplicated in the commit description.

Quoted 23 lines

Use pkg-config to determine the version and library dependency for GlusterFS block driver.

---
  configure |   20 +++++++-------------
  1 file changed, 7 insertions(+), 13 deletions(-)
configure +0 -7
index cb0f870..76adcb1 100755
@@ -2566,23 +2566,17 @@ fi
  ##########################################
  # glusterfs probe
  if test "$glusterfs" != "no" ; then
-  cat > $TMPC <<EOF
-#include <glusterfs/api/glfs.h>
-int main(void) {
-    (void) glfs_new("volume");
-    return 0;
-}
-EOF
Quoted 9 lines

configure fi · line 2569

Quoted 6 lines
configure +1 -5
-  glusterfs_libs="-lgfapi -lgfrpc -lgfxdr"
-  if compile_prog "" "$glusterfs_libs" ; then
-    glusterfs=yes
-    libs_tools="$glusterfs_libs $libs_tools"
-    libs_softmmu="$glusterfs_libs $libs_softmmu"
+  if $pkg_config --atleast-version=3 glusterfs-api >/dev/null 2>&1; then

gfapi was added in Gluster 3.4. Is --atleast-version=3 sufficient?

--atleast-version=3 is the api version (not release version). 3 is sufficient for basic qemu integration. 5 and above has fallocate/discard.

Avati

#4 lore raw

Re: [Qemu-devel] [RFC PATCH v1 1/2] gluster: Use pkg-config to configure GlusterFS block driver

In reply to Bharata B Rao

Am 12.07.2013 um 08:58 hat Bharata B Rao geschrieben:

Quoted 26 lines

gluster: Use pkg-config to configure GlusterFS block driver

Use pkg-config to determine the version and library dependency for GlusterFS block driver.

---
 configure |   20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
configure +0 -8
index cb0f870..76adcb1 100755
@@ -2566,23 +2566,17 @@ fi
 ##########################################
 # glusterfs probe
 if test "$glusterfs" != "no" ; then
-  cat > $TMPC <<EOF
-#include <glusterfs/api/glfs.h>
-int main(void) {
-    (void) glfs_new("volume");
-    return 0;
-}
-EOF
-  glusterfs_libs="-lgfapi -lgfrpc -lgfxdr"

configure fi · line 2574

Quoted 10 lines
configure +6 -4
-  if compile_prog "" "$glusterfs_libs" ; then
-    glusterfs=yes
-    libs_tools="$glusterfs_libs $libs_tools"
-    libs_softmmu="$glusterfs_libs $libs_softmmu"
+  if $pkg_config --atleast-version=3 glusterfs-api >/dev/null 2>&1; then
+    glusterfs="yes"
+    glusterfs_cflags=`$pkg_config --cflags glusterfs-api 2>/dev/null`
+    glusterfs_libs=`$pkg_config --libs glusterfs-api 2>/dev/null`
+    CFLAGS="$CFLAGS $glusterfs_cflags"
+    LIBS="$LIBS $glusterfs_libs"

Why do you switch from libs_tools/libs_softmmu to LIBS? If I understand it right, this means that you now link the library to linux-user targets as well, but I can't see how they need it.

Kevin

#5 lore raw

Re: [Qemu-devel] [RFC PATCH v1 1/2] gluster: Use pkg-config to configure GlusterFS block driver

Quoted 12 lines · Kevin Wolf

configure fi · line 2574

Quoted 11 lines
configure +6 -5
-  glusterfs_libs="-lgfapi -lgfrpc -lgfxdr"
-  if compile_prog "" "$glusterfs_libs" ; then
-    glusterfs=yes
-    libs_tools="$glusterfs_libs $libs_tools"
-    libs_softmmu="$glusterfs_libs $libs_softmmu"
+  if $pkg_config --atleast-version=3 glusterfs-api >/dev/null 2>&1; then
+    glusterfs="yes"
+    glusterfs_cflags=`$pkg_config --cflags glusterfs-api 2>/dev/null`
+    glusterfs_libs=`$pkg_config --libs glusterfs-api 2>/dev/null`
+    CFLAGS="$CFLAGS $glusterfs_cflags"
+    LIBS="$LIBS $glusterfs_libs"
Quoted 3 lines

Why do you switch from libs_tools/libs_softmmu to LIBS? If I understand it right, this means that you now link the library to linux-user targets as well, but I can't see how they need it.

Copied from some other backend and didn't realize that I ended up considering linux-user target also. Will change this and send v2.

Regards,
Bharata.

#6 lore raw

Re: [Qemu-devel] [RFC PATCH v1 1/2] gluster: Use pkg-config to configure GlusterFS block driver

In reply to Bharata B Rao
Quoted 26 lines · Bharata B Rao

gluster: Use pkg-config to configure GlusterFS block driver

Use pkg-config to determine the version and library dependency for GlusterFS block driver.

---
 configure |   20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
configure +0 -8
index cb0f870..76adcb1 100755
@@ -2566,23 +2566,17 @@ fi
 ##########################################
 # glusterfs probe
 if test "$glusterfs" != "no" ; then
-  cat > $TMPC <<EOF
-#include <glusterfs/api/glfs.h>
-int main(void) {
-    (void) glfs_new("volume");
-    return 0;
-}
-EOF
-  glusterfs_libs="-lgfapi -lgfrpc -lgfxdr"

configure fi · line 2574

Quoted 10 lines
configure +6 -4
-  if compile_prog "" "$glusterfs_libs" ; then
-    glusterfs=yes
-    libs_tools="$glusterfs_libs $libs_tools"
-    libs_softmmu="$glusterfs_libs $libs_softmmu"
+  if $pkg_config --atleast-version=3 glusterfs-api >/dev/null 2>&1; then
+    glusterfs="yes"
+    glusterfs_cflags=`$pkg_config --cflags glusterfs-api 2>/dev/null`
+    glusterfs_libs=`$pkg_config --libs glusterfs-api 2>/dev/null`
+    CFLAGS="$CFLAGS $glusterfs_cflags"
+    LIBS="$LIBS $glusterfs_libs"

The glusterfs v 3.4 RPMs in Fedora do not include any pkg-config files. So with this change now in GIT, QEMU no longer detects support for glusterfs even though it is present.

Has the min required glusterfs been increased to a new 3.5 version which does include pkg-config support ? If not, then I think this patch needs to be reverted, so that it does a non-pkg-config based check for glusterfs.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#7 lore raw

Re: [Qemu-devel] [RFC PATCH v1 1/2] gluster: Use pkg-config to configure GlusterFS block driver

Quoted 42 lines · Daniel P. Berrange
Quoted 26 lines · Bharata B Rao

gluster: Use pkg-config to configure GlusterFS block driver

Use pkg-config to determine the version and library dependency for GlusterFS block driver.

---
  configure |   20 +++++++-------------
  1 file changed, 7 insertions(+), 13 deletions(-)
configure +0 -8
index cb0f870..76adcb1 100755
@@ -2566,23 +2566,17 @@ fi
  ##########################################
  # glusterfs probe
  if test "$glusterfs" != "no" ; then
-  cat > $TMPC <<EOF
-#include <glusterfs/api/glfs.h>
-int main(void) {
-    (void) glfs_new("volume");
-    return 0;
-}
-EOF
-  glusterfs_libs="-lgfapi -lgfrpc -lgfxdr"

configure fi · line 2574

Quoted 10 lines
configure +6 -4
-  if compile_prog "" "$glusterfs_libs" ; then
-    glusterfs=yes
-    libs_tools="$glusterfs_libs $libs_tools"
-    libs_softmmu="$glusterfs_libs $libs_softmmu"
+  if $pkg_config --atleast-version=3 glusterfs-api >/dev/null 2>&1; then
+    glusterfs="yes"
+    glusterfs_cflags=`$pkg_config --cflags glusterfs-api 2>/dev/null`
+    glusterfs_libs=`$pkg_config --libs glusterfs-api 2>/dev/null`
+    CFLAGS="$CFLAGS $glusterfs_cflags"
+    LIBS="$LIBS $glusterfs_libs"

The glusterfs v 3.4 RPMs in Fedora do not include any pkg-config files. So with this change now in GIT, QEMU no longer detects support for glusterfs even though it is present.

Quoted 8 lines

Has the min required glusterfs been increased to a new 3.5 version which does include pkg-config support ? If not, then I think this patch needs to be reverted, so that it does a non-pkg-config based check for glusterfs.

Regards,
Daniel

Copying Kaleb.

We should just include the pkg-config file in the Fedora RPM for glusterfs if it already isn't.

Avati

#8 lore raw

Re: [Qemu-devel] [RFC PATCH v1 1/2] gluster: Use pkg-config to configure GlusterFS block driver

Quoted 48 lines · Anand Avati
Quoted 47 lines · Daniel P. Berrange
Quoted 26 lines · Bharata B Rao

gluster: Use pkg-config to configure GlusterFS block driver

Use pkg-config to determine the version and library dependency for GlusterFS block driver.

---
 configure |   20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
configure +0 -8
index cb0f870..76adcb1 100755
@@ -2566,23 +2566,17 @@ fi
 ##########################################
 # glusterfs probe
 if test "$glusterfs" != "no" ; then
-  cat > $TMPC <<EOF
-#include <glusterfs/api/glfs.h>
-int main(void) {
-    (void) glfs_new("volume");
-    return 0;
-}
-EOF
-  glusterfs_libs="-lgfapi -lgfrpc -lgfxdr"

configure fi · line 2574

Quoted 10 lines
configure +6 -4
-  if compile_prog "" "$glusterfs_libs" ; then
-    glusterfs=yes
-    libs_tools="$glusterfs_libs $libs_tools"
-    libs_softmmu="$glusterfs_libs $libs_softmmu"
+  if $pkg_config --atleast-version=3 glusterfs-api >/dev/null 2>&1; then
+    glusterfs="yes"
+    glusterfs_cflags=`$pkg_config --cflags glusterfs-api 2>/dev/null`
+    glusterfs_libs=`$pkg_config --libs glusterfs-api 2>/dev/null`
+    CFLAGS="$CFLAGS $glusterfs_cflags"
+    LIBS="$LIBS $glusterfs_libs"

The glusterfs v 3.4 RPMs in Fedora do not include any pkg-config files. So with this change now in GIT, QEMU no longer detects support for glusterfs even though it is present.

Has the min required glusterfs been increased to a new 3.5 version which does include pkg-config support ? If not, then I think this patch needs to be reverted, so that it does a non-pkg-config based check for glusterfs.

Quoted 8 lines
Quoted 3 lines

Regards,
Daniel

Copying Kaleb.

We should just include the pkg-config file in the Fedora RPM for glusterfs if it already isn't.

That doesn't help anyone trying to build QEMU with gluster support on all the existing released distros which lack the pkg-config files.

If you really want a pkg-config file check for glusterfs in QEMU, then it must at least fallback to probing the non-pkg-config way to support existing deployed distros.

Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#9 lore raw

Re: [Qemu-devel] [RFC PATCH v1 1/2] gluster: Use pkg-config to configure GlusterFS block driver

In reply to Anand Avati
Quoted 49 lines · Anand Avati
Quoted 48 lines · Daniel P. Berrange
Quoted 32 lines · Bharata B Rao

gluster: Use pkg-config to configure GlusterFS block driver

Use pkg-config to determine the version and library dependency for GlusterFS block driver.

---
  configure |   20 +++++++-------------
  1 file changed, 7 insertions(+), 13 deletions(-)
configure +1 -12
index cb0f870..76adcb1 100755
@@ -2566,23 +2566,17 @@ fi
  ##########################################
  # glusterfs probe
  if test "$glusterfs" != "no" ; then
-  cat > $TMPC <<EOF
-#include <glusterfs/api/glfs.h>
-int main(void) {
-    (void) glfs_new("volume");
-    return 0;
-}
-EOF
-  glusterfs_libs="-lgfapi -lgfrpc -lgfxdr"
-  if compile_prog "" "$glusterfs_libs" ; then
-    glusterfs=yes
-    libs_tools="$glusterfs_libs $libs_tools"
-    libs_softmmu="$glusterfs_libs $libs_softmmu"
+  if $pkg_config --atleast-version=3 glusterfs-api >/dev/null 2>&1;

then

configure fi · line 2574

Quoted 5 lines
configure +5 -0
+    glusterfs="yes"
+    glusterfs_cflags=`$pkg_config --cflags glusterfs-api 2>/dev/null`
+    glusterfs_libs=`$pkg_config --libs glusterfs-api 2>/dev/null`
+    CFLAGS="$CFLAGS $glusterfs_cflags"
+    LIBS="$LIBS $glusterfs_libs"

The glusterfs v 3.4 RPMs in Fedora do not include any pkg-config files. So with this change now in GIT, QEMU no longer detects support for glusterfs even though it is present.

Has the min required glusterfs been increased to a new 3.5 version which does include pkg-config support ? If not, then I think this patch needs to be reverted, so that it does a non-pkg-config based check for glusterfs.

Quoted 8 lines
Quoted 3 lines

Regards,
Daniel

Copying Kaleb.

We should just include the pkg-config file in the Fedora RPM for glusterfs if it already isn't.

It's in the glusterfs-api-devel rpm:

% rpm -ql glusterfs-api-devel
/usr/include/glusterfs/api/glfs.h
/usr/lib64/libgfapi.so
/usr/lib64/pkgconfig/glusterfs-api.pc

--

Kaleb

#10 lore raw

Re: [Qemu-devel] [RFC PATCH v1 1/2] gluster: Use pkg-config to configure GlusterFS block driver

Quoted 59 lines · Kaleb KEITHLEY
Quoted 49 lines · Anand Avati
Quoted 48 lines · Daniel P. Berrange
Quoted 32 lines · Bharata B Rao

gluster: Use pkg-config to configure GlusterFS block driver

Use pkg-config to determine the version and library dependency for GlusterFS block driver.

---
 configure |   20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
configure +1 -12
index cb0f870..76adcb1 100755
@@ -2566,23 +2566,17 @@ fi
 ##########################################
 # glusterfs probe
 if test "$glusterfs" != "no" ; then
-  cat > $TMPC <<EOF
-#include <glusterfs/api/glfs.h>
-int main(void) {
-    (void) glfs_new("volume");
-    return 0;
-}
-EOF
-  glusterfs_libs="-lgfapi -lgfrpc -lgfxdr"
-  if compile_prog "" "$glusterfs_libs" ; then
-    glusterfs=yes
-    libs_tools="$glusterfs_libs $libs_tools"
-    libs_softmmu="$glusterfs_libs $libs_softmmu"
+  if $pkg_config --atleast-version=3 glusterfs-api >/dev/null 2>&1;

then

configure fi · line 2574

Quoted 5 lines
configure +5 -0
+    glusterfs="yes"
+    glusterfs_cflags=`$pkg_config --cflags glusterfs-api 2>/dev/null`
+    glusterfs_libs=`$pkg_config --libs glusterfs-api 2>/dev/null`
+    CFLAGS="$CFLAGS $glusterfs_cflags"
+    LIBS="$LIBS $glusterfs_libs"

The glusterfs v 3.4 RPMs in Fedora do not include any pkg-config files. So with this change now in GIT, QEMU no longer detects support for glusterfs even though it is present.

Has the min required glusterfs been increased to a new 3.5 version which does include pkg-config support ? If not, then I think this patch needs to be reverted, so that it does a non-pkg-config based check for glusterfs.

Quoted 8 lines
Quoted 3 lines

Regards,
Daniel

Copying Kaleb.

We should just include the pkg-config file in the Fedora RPM for glusterfs if it already isn't.

Quoted 6 lines

It's in the glusterfs-api-devel rpm:

% rpm -ql glusterfs-api-devel
/usr/include/glusterfs/api/glfs.h
/usr/lib64/libgfapi.so
/usr/lib64/pkgconfig/glusterfs-api.pc

Oooh, not the main glusterfs-devel RPM. Ok, ignore my earlier message

Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#11 lore raw

RFC PATCH 2/2 gluster: Add discard support for GlusterFS block driver

In reply to Bharata B Rao

gluster: Add discard support for GlusterFS block driver.

Implement bdrv_aio_discard for gluster.

---
 block/gluster.c |   45 +++++++++++++++++++++++++++++++++++++++++++++
 configure       |    8 ++++++++
 2 files changed, 53 insertions(+)
block/gluster.c +45 -0
index 61424bc..6de418c 100644
@@ -532,6 +532,39 @@ out:
     return NULL;
 }
 
+#ifdef CONFIG_GLUSTERFS_DISCARD
+static BlockDriverAIOCB *qemu_gluster_aio_discard(BlockDriverState *bs,
+        int64_t sector_num, int nb_sectors, BlockDriverCompletionFunc *cb,
+        void *opaque)
+{
+    int ret;
+    GlusterAIOCB *acb;
+    BDRVGlusterState *s = bs->opaque;
+    size_t size;
+    off_t offset;
+
+    offset = sector_num * BDRV_SECTOR_SIZE;
+    size = nb_sectors * BDRV_SECTOR_SIZE;
+
+    acb = qemu_aio_get(&gluster_aiocb_info, bs, cb, opaque);
+    acb->size = 0;
+    acb->ret = 0;
+    acb->finished = NULL;
+    s->qemu_aio_count++;
+
+    ret = glfs_discard_async(s->fd, offset, size, &gluster_finish_aiocb, acb);
+    if (ret < 0) {
+        goto out;
+    }
+    return &acb->common;
+
+out:
+    s->qemu_aio_count--;
+    qemu_aio_release(acb);
+    return NULL;
+}
+#endif
+
 static int64_t qemu_gluster_getlength(BlockDriverState *bs)
 {
     BDRVGlusterState *s = bs->opaque;
@@ -602,6 +635,9 @@ static BlockDriver bdrv_gluster = {
     .bdrv_aio_writev              = qemu_gluster_aio_writev,
     .bdrv_aio_flush               = qemu_gluster_aio_flush,
     .bdrv_has_zero_init           = qemu_gluster_has_zero_init,
+#ifdef CONFIG_GLUSTERFS_DISCARD
+    .bdrv_aio_discard             = qemu_gluster_aio_discard,
+#endif
     .create_options               = qemu_gluster_create_options,
 };
 
@@ -618,6 +654,9 @@ static BlockDriver bdrv_gluster_tcp = {
     .bdrv_aio_writev              = qemu_gluster_aio_writev,
     .bdrv_aio_flush               = qemu_gluster_aio_flush,
     .bdrv_has_zero_init           = qemu_gluster_has_zero_init,
+#ifdef CONFIG_GLUSTERFS_DISCARD
+    .bdrv_aio_discard             = qemu_gluster_aio_discard,
+#endif
     .create_options               = qemu_gluster_create_options,
 };
 
@@ -634,6 +673,9 @@ static BlockDriver bdrv_gluster_unix = {
     .bdrv_aio_writev              = qemu_gluster_aio_writev,
     .bdrv_aio_flush               = qemu_gluster_aio_flush,
     .bdrv_has_zero_init           = qemu_gluster_has_zero_init,
+#ifdef CONFIG_GLUSTERFS_DISCARD
+    .bdrv_aio_discard             = qemu_gluster_aio_discard,
+#endif
     .create_options               = qemu_gluster_create_options,
 };
 
@@ -650,6 +692,9 @@ static BlockDriver bdrv_gluster_rdma = {
     .bdrv_aio_writev              = qemu_gluster_aio_writev,
     .bdrv_aio_flush               = qemu_gluster_aio_flush,
     .bdrv_has_zero_init           = qemu_gluster_has_zero_init,
+#ifdef CONFIG_GLUSTERFS_DISCARD
+    .bdrv_aio_discard             = qemu_gluster_aio_discard,
+#endif
     .create_options               = qemu_gluster_create_options,
 };
 
configure +8 -0
index 76adcb1..7f90882 100755
@@ -237,6 +237,7 @@ libiscsi=""
 coroutine=""
 seccomp=""
 glusterfs=""
+glusterfs_discard="no"
 virtio_blk_data_plane=""
 gtk=""
 gtkabi="2.0"
@@ -2572,6 +2573,9 @@ if test "$glusterfs" != "no" ; then
     glusterfs_libs=`$pkg_config --libs glusterfs-api 2>/dev/null`
     CFLAGS="$CFLAGS $glusterfs_cflags"
     LIBS="$LIBS $glusterfs_libs"
+    if $pkg_config --atleast-version=5 glusterfs-api >/dev/null 2>&1; then
+      glusterfs_discard="yes"
+    fi
   else
     if test "$glusterfs" = "yes" ; then
       feature_not_found "GlusterFS backend support"
@@ -3959,6 +3963,10 @@ if test "$glusterfs" = "yes" ; then
   echo "CONFIG_GLUSTERFS=y" >> $config_host_mak
 fi
 
+if test "$glusterfs_discard" = "yes" ; then
+  echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
+fi
+
 if test "$libssh2" = "yes" ; then
   echo "CONFIG_LIBSSH2=y" >> $config_host_mak
 fi
#12 lore raw

Re: [Qemu-devel] [RFC PATCH v1 2/2] gluster: Add discard support for GlusterFS block driver

Quoted 1 line · Bharata B Rao

gluster: Add discard support for GlusterFS block driver.

Commit message duplicated into commit description.