Skip to content

Commit

Permalink
LU-1812 fsfilt: ext4_free_blocks() has changed slightly
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: chas williams - CONTRACTOR <[email protected]>
Change-Id: I925df73a054613469866ec025ae412ead0ce9e56
Reviewed-on: http://review.whamcloud.com/4991
Reviewed-by: Bob Glossman <[email protected]>
Tested-by: Hudson
Reviewed-by: Christopher J. Morrone <[email protected]>
Tested-by: Maloo <[email protected]>
Reviewed-by: Oleg Drokin <[email protected]>
  • Loading branch information
jasimmons1973 authored and Oleg Drokin committed Apr 2, 2013
1 parent 1ec95b2 commit bea31ad
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
18 changes: 18 additions & 0 deletions ldiskfs/config/ldiskfs-build.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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
Expand Down
5 changes: 3 additions & 2 deletions ldiskfs/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ AC_ARG_ENABLE([server],
])
AC_MSG_RESULT([$enable_server])

LB_CONFIG_HEADERS

LDISKFSDIR="$PWD/ldiskfs"
AC_SUBST(LDISKFSDIR)

Expand All @@ -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]
Expand Down
3 changes: 3 additions & 0 deletions ldiskfs/ldiskfs/ldiskfs_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 7 additions & 2 deletions lustre/lvfs/fsfilt_ext3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit bea31ad

Please sign in to comment.