configure: add check for fallocate

We need to check for fallocate() rather than just linux/falloc.h +
FALLOC_FL_PUNCH_HOLE since in uClibc we've got both but still not
fallocate() itself since it's only implemented in newer unreleased
versions.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Gustavo Zacarias 2015-03-10 15:53:17 -03:00 committed by Jaegeuk Kim
parent 5792951de2
commit 3c160e7d11
2 changed files with 2 additions and 1 deletions

View File

@ -68,6 +68,7 @@ AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_GETMNTENT
AC_CHECK_FUNCS_ONCE([
fallocate
getmntent
memset
])

View File

@ -46,7 +46,7 @@ int f2fs_trim_device()
#if defined(WITH_BLKDISCARD) && defined(BLKDISCARD)
MSG(0, "Info: Discarding device\n");
if (S_ISREG(stat_buf.st_mode)) {
#ifdef FALLOC_FL_PUNCH_HOLE
#if defined(HAVE_FALLOCATE) && defined(FALLOC_FL_PUNCH_HOLE)
if (fallocate(config.fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
range[0], range[1]) < 0) {
MSG(0, "Info: fallocate(PUNCH_HOLE|KEEP_SIZE) is failed\n");