As it stands today, btrfs-progs won't build if the installed
kernel headers don't define FIEMAP_EXTENT_SHARED.

But that doesn't tell us anything about the capabilities of
the /running/ kernel - so just define it locally if not found
in the fiemap header, and allow the build to proceed.

If run against an old kernel, worst case scenario is that
no shared extents will be reported via the du command.

Signed-off-by: Eric Sandeen <>

you can take it or leave it, but I had this locally 
anyway, so if it's helpful here you go :)

diff --git a/cmds-fi-du.c b/cmds-fi-du.c
index a5b66e6..fa8f421 100644
--- a/cmds-fi-du.c
+++ b/cmds-fi-du.c
@@ -29,6 +29,11 @@
 #include <linux/fs.h>
 #include <linux/fiemap.h>
+/* Appeared upstream in 2.6.33 */
+#define FIEMAP_EXTENT_SHARED 0x00002000
 #include "utils.h"
 #include "commands.h"
 #include "kerncompat.h"
diff --git a/ b/
index 8fd8f42..9b87b24 100644
--- a/
+++ b/
@@ -144,8 +144,6 @@ if test "$DISABLE_BTRFSCONVERT" = 0 && test "x$convertfs" = 
"x"; then
        AC_MSG_ERROR([no filesystems for convert, use --disable-convert 
-AX_CHECK_DEFINE([linux/fiemap.h], [FIEMAP_EXTENT_SHARED], [],
-               [AC_MSG_ERROR([no definition of FIEMAP_EXTENT_SHARED found])])
 dnl Define <NAME>_LIBS= and <NAME>_CFLAGS= by pkg-config

To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to
More majordomo info at

Reply via email to