* [PATCH] mkfs: set BLKDISCARD by default
@ 2014-06-13 8:49 Jaegeuk Kim
0 siblings, 0 replies; only message in thread
From: Jaegeuk Kim @ 2014-06-13 8:49 UTC (permalink / raw)
To: linux-f2fs-devel; +Cc: Jaegeuk Kim
And let's show some debug info as well.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
mkfs/Makefile.am | 2 +-
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
--
1.8.5.2 (Apple Git-48)
------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-06-13 8:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-13 8:49 [PATCH] mkfs: set BLKDISCARD by default Jaegeuk Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).