The compile time option BLKDISCARD conflicts with ioctl code for discard. This causes discard to fail with "Info: This device doesn't support TRIM". Rename compile time option to WITH_BLKDISCARD.
Signed-off-by: Sankalp Bose <sank...@tuxera.com> --- configure.ac | 2 +- mkfs/Makefile.am | 2 +- mkfs/f2fs_format_utils.c | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index c2dafb0..0111e72 100644 --- a/configure.ac +++ b/configure.ac @@ -56,7 +56,7 @@ AC_PATH_PROG([LDCONFIG], [ldconfig], PKG_CHECK_MODULES([libuuid], [uuid]) # Checks for header files. -AC_CHECK_HEADERS([fcntl.h mntent.h stdlib.h string.h \ +AC_CHECK_HEADERS([linux/fs.h fcntl.h mntent.h stdlib.h string.h \ sys/ioctl.h sys/mount.h unistd.h]) # Checks for typedefs, structures, and compiler characteristics. diff --git a/mkfs/Makefile.am b/mkfs/Makefile.am index ff136a7..fa48699 100644 --- a/mkfs/Makefile.am +++ b/mkfs/Makefile.am @@ -1,7 +1,7 @@ ## Makefile.am AM_CPPFLAGS = ${libuuid_CFLAGS} -I$(top_srcdir)/include -AM_CFLAGS = -Wall -DBLKDISCARD +AM_CFLAGS = -Wall -DWITH_BLKDISCARD sbin_PROGRAMS = mkfs.f2fs mkfs_f2fs_SOURCES = f2fs_format_main.c f2fs_format.c f2fs_format_utils.c mkfs_f2fs_LDADD = ${libuuid_LIBS} $(top_builddir)/lib/libf2fs.la diff --git a/mkfs/f2fs_format_utils.c b/mkfs/f2fs_format_utils.c index 8f7e094..1e629ed 100644 --- a/mkfs/f2fs_format_utils.c +++ b/mkfs/f2fs_format_utils.c @@ -15,6 +15,11 @@ #include "f2fs_fs.h" +#ifdef HAVE_LINUX_FS_H +#include <linux/fs.h> +#endif + + int f2fs_trim_device() { unsigned long long range[2]; @@ -31,7 +36,7 @@ int f2fs_trim_device() return -1; } -#if defined(BLKDISCARD) +#if defined(WITH_BLKDISCARD) && defined(BLKDISCARD) MSG(0, "Info: Discarding device\n"); if (S_ISREG(stat_buf.st_mode)) return 0; -- 2.0.1 ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel