From bea31adb586aeab93e1c42594dfc0fdabb554349 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Thu, 28 Mar 2013 13:52:54 -0400 Subject: [PATCH] LU-1812 fsfilt: ext4_free_blocks() has changed slightly 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 Signed-off-by: chas williams - CONTRACTOR Change-Id: I925df73a054613469866ec025ae412ead0ce9e56 Reviewed-on: http://review.whamcloud.com/4991 Reviewed-by: Bob Glossman Tested-by: Hudson Reviewed-by: Christopher J. Morrone Tested-by: Maloo Reviewed-by: Oleg Drokin --- ldiskfs/config/ldiskfs-build.m4 | 18 ++++++++++++++++++ ldiskfs/configure.ac | 5 +++-- ldiskfs/ldiskfs/ldiskfs_config.h.in | 3 +++ lustre/lvfs/fsfilt_ext3.c | 9 +++++++-- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/ldiskfs/config/ldiskfs-build.m4 b/ldiskfs/config/ldiskfs-build.m4 index 0f35f2a..d87e9f8 100644 --- a/ldiskfs/config/ldiskfs-build.m4 +++ b/ldiskfs/config/ldiskfs-build.m4 @@ -706,6 +706,24 @@ fi 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 + #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 diff --git a/ldiskfs/configure.ac b/ldiskfs/configure.ac index cd8bc7c..0ef1c1d 100644 --- a/ldiskfs/configure.ac +++ b/ldiskfs/configure.ac @@ -66,8 +66,6 @@ AC_ARG_ENABLE([server], ]) AC_MSG_RESULT([$enable_server]) -LB_CONFIG_HEADERS - 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 +LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD fi +LB_CONFIG_HEADERS + AC_SUBST(ac_configure_args) AC_CONFIG_FILES([Makefile ldiskfs/Makefile] diff --git a/ldiskfs/ldiskfs/ldiskfs_config.h.in b/ldiskfs/ldiskfs/ldiskfs_config.h.in index a5fab0a..c0fe952 100644 --- a/ldiskfs/ldiskfs/ldiskfs_config.h.in +++ b/ldiskfs/ldiskfs/ldiskfs_config.h.in @@ -15,3 +15,6 @@ /* - 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 diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c index b7eab7a..d2ff06d 100644 --- a/lustre/lvfs/fsfilt_ext3.c +++ b/lustre/lvfs/fsfilt_ext3.c @@ -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 - 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; } -- 1.8.3.1