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 <gust...@zacarias.com.ar>
---
 configure.ac             | 1 +
 mkfs/f2fs_format_utils.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index ae451b8..900b84a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,6 +68,7 @@ AC_TYPE_SIZE_T
 # Checks for library functions.
 AC_FUNC_GETMNTENT
 AC_CHECK_FUNCS_ONCE([
+       fallocate
        getmntent
        memset
 ])
diff --git a/mkfs/f2fs_format_utils.c b/mkfs/f2fs_format_utils.c
index a0f85f5..ddeafeb 100644
--- a/mkfs/f2fs_format_utils.c
+++ b/mkfs/f2fs_format_utils.c
@@ -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");
-- 
2.0.5


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to