Whamcloud - gitweb
LU-1812 fsfilt: ext4_free_blocks() has changed slightly
authorJames Simmons <uja.ornl@gmail.com>
Thu, 28 Mar 2013 17:52:54 +0000 (13:52 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 2 Apr 2013 18:41:29 +0000 (14:41 -0400)
ext4_free_blocks() now takes a buffer_head and explicit flags instead
of just metadata.  Test the presence of the buffer_head argument to
determine which ext4_free_blocks() is available.

see kernel commit e6362609b6c71c5b802026be9cf263bbdd67a50e

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Change-Id: I925df73a054613469866ec025ae412ead0ce9e56
Reviewed-on: http://review.whamcloud.com/4991
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Hudson
Reviewed-by: Christopher J. Morrone <chris.morrone.llnl@gmail.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
ldiskfs/config/ldiskfs-build.m4
ldiskfs/configure.ac
ldiskfs/ldiskfs/ldiskfs_config.h.in
lustre/lvfs/fsfilt_ext3.c

index 0f35f2a..d87e9f8 100644 (file)
@@ -706,6 +706,24 @@ fi
 AC_SUBST(LDISKFS_SERIES)
 ])
 
 AC_SUBST(LDISKFS_SERIES)
 ])
 
+#
+# 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
+#
+AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD],
+[AC_MSG_CHECKING([if ext4_free_blocks needs struct buffer_head])
+ LB_LINUX_TRY_COMPILE([
+       #include <linux/fs.h>
+       #include "$EXT_DIR/ext4.h"
+],[
+       ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
+],[
+       AC_MSG_RESULT([yes])
+       AC_DEFINE(HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD, 1,
+                 [ext4_free_blocks do not require struct buffer_head])
+],[
+       AC_MSG_RESULT([no])
+])
+])
 
 #
 # LDISKFS_AC_PATCH_PROGRAM
 
 #
 # LDISKFS_AC_PATCH_PROGRAM
index cd8bc7c..0ef1c1d 100644 (file)
@@ -66,8 +66,6 @@ AC_ARG_ENABLE([server],
        ])
 AC_MSG_RESULT([$enable_server])
 
        ])
 AC_MSG_RESULT([$enable_server])
 
-LB_CONFIG_HEADERS
-
 LDISKFSDIR="$PWD/ldiskfs"
 AC_SUBST(LDISKFSDIR)
 
 LDISKFSDIR="$PWD/ldiskfs"
 AC_SUBST(LDISKFSDIR)
 
@@ -76,8 +74,11 @@ LDISKFS_AC_PATCH_PROGRAM
 if test x$enable_server$enable_dist = xyesno ; then
 LB_LDISKFS_EXT_DIR
 LB_LDISKFS_EXT_SOURCE
 if test x$enable_server$enable_dist = xyesno ; then
 LB_LDISKFS_EXT_DIR
 LB_LDISKFS_EXT_SOURCE
+LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
 fi
 
 fi
 
+LB_CONFIG_HEADERS
+
 AC_SUBST(ac_configure_args)
 
 AC_CONFIG_FILES([Makefile ldiskfs/Makefile]
 AC_SUBST(ac_configure_args)
 
 AC_CONFIG_FILES([Makefile ldiskfs/Makefile]
index a5fab0a..c0fe952 100644 (file)
@@ -15,3 +15,6 @@
 
 /* - enable extended attributes for ldiskfs */
 #define CONFIG_LDISKFS_FS_XATTR 1
 
 /* - enable extended attributes for ldiskfs */
 #define CONFIG_LDISKFS_FS_XATTR 1
+
+/* ext4_free_blocks do not require struct buffer_head */
+#undef HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD
index b7eab7a..d2ff06d 100644 (file)
@@ -371,8 +371,13 @@ static int ext3_ext_new_extent_cb(struct ext3_ext_base *base,
 #ifdef EXT3_MB_HINT_GROUP_ALLOC
                 ext3_mb_discard_inode_preallocations(inode);
 #endif
 #ifdef EXT3_MB_HINT_GROUP_ALLOC
                 ext3_mb_discard_inode_preallocations(inode);
 #endif
-                ext3_free_blocks(handle, inode, ext_pblock(&nex),
-                                 cpu_to_le16(nex.ee_len), 0);
+#ifdef HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD /* Introduced in 2.6.32-rc7 */
+               ext3_free_blocks(handle, inode, NULL, ext_pblock(&nex),
+                                cpu_to_le16(nex.ee_len), 0);
+#else
+               ext3_free_blocks(handle, inode, ext_pblock(&nex),
+                                cpu_to_le16(nex.ee_len), 0);
+#endif
                 goto out;
         }
 
                 goto out;
         }