diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-06-13 17:41:58 +0900 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-06-13 17:48:42 +0900 |
commit | 09f8f56066efd3a9fadb4c731f7184980383f9f9 (patch) | |
tree | f360f477ae47c1acd480e963cfe1c90f21445b78 | |
parent | 0575dd1c56ef731662687fa5b7817335b14c69ee (diff) | |
download | android_external_f2fs-tools-09f8f56066efd3a9fadb4c731f7184980383f9f9.tar.gz android_external_f2fs-tools-09f8f56066efd3a9fadb4c731f7184980383f9f9.tar.bz2 android_external_f2fs-tools-09f8f56066efd3a9fadb4c731f7184980383f9f9.zip |
mkfs: set BLKDISCARD by default
And let's show some debug info as well.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | mkfs/Makefile.am | 2 | ||||
-rw-r--r-- | mkfs/f2fs_format_utils.c | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/mkfs/Makefile.am b/mkfs/Makefile.am index 68cab66..ff136a7 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 +AM_CFLAGS = -Wall -DBLKDISCARD 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 5cc2a32..8f7e094 100644 --- a/mkfs/f2fs_format_utils.c +++ b/mkfs/f2fs_format_utils.c @@ -36,8 +36,12 @@ int f2fs_trim_device() if (S_ISREG(stat_buf.st_mode)) return 0; else if (S_ISBLK(stat_buf.st_mode)) { - if (ioctl(config.fd, BLKDISCARD, &range) < 0) + if (ioctl(config.fd, BLKDISCARD, &range) < 0) { MSG(0, "Info: This device doesn't support TRIM\n"); + } else { + MSG(0, "Info: Discarded %lu sectors\n", + config.total_sectors); + } } else return -1; #endif |