From owner-svn-src-all@FreeBSD.ORG Tue Sep 6 10:19:01 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9FD3106566B; Tue, 6 Sep 2011 10:19:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 803978FC0C; Tue, 6 Sep 2011 10:19:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p86AJ1Wk078615; Tue, 6 Sep 2011 10:19:01 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p86AJ1jS078612; Tue, 6 Sep 2011 10:19:01 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201109061019.p86AJ1jS078612@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 6 Sep 2011 10:19:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225416 - head/sbin/mdmfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 10:19:01 -0000 Author: kib Date: Tue Sep 6 10:19:01 2011 New Revision: 225416 URL: http://svn.freebsd.org/changeset/base/225416 Log: dd -t switch for mdmfs to enable TRIM on the configured filesystem. While there, fix minor style issues. Submitted by: Alex Kozlov MFC after: 1 week Approved by: re (bz) Modified: head/sbin/mdmfs/mdmfs.8 head/sbin/mdmfs/mdmfs.c Modified: head/sbin/mdmfs/mdmfs.8 ============================================================================== --- head/sbin/mdmfs/mdmfs.8 Tue Sep 6 10:17:02 2011 (r225415) +++ head/sbin/mdmfs/mdmfs.8 Tue Sep 6 10:19:01 2011 (r225416) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2007 +.Dd September 4, 2011 .Dt MDMFS 8 .Os .Sh NAME @@ -36,7 +36,7 @@ driver .Sh SYNOPSIS .Nm -.Op Fl DLlMNPSUX +.Op Fl DLlMNPStUX .Op Fl a Ar maxcontig .Op Fl b Ar block-size .Op Fl c Ar blocks-per-cylinder-group @@ -224,6 +224,13 @@ and the optional .Xr malloc 9 backed disks .Pq Dv MD_MALLOC . +.It Fl t +Turn on the TRIM enable flag for +.Xr newfs 8 . +The +.Xr md 4 +device supports the BIO_DELETE command, enabling the TRIM on created +filesystem allows return of freed memory to the system pool. .It Fl U Enable soft-updates on the file system. This is the default, and is accepted only Modified: head/sbin/mdmfs/mdmfs.c ============================================================================== --- head/sbin/mdmfs/mdmfs.c Tue Sep 6 10:17:02 2011 (r225415) +++ head/sbin/mdmfs/mdmfs.c Tue Sep 6 10:19:01 2011 (r225416) @@ -127,7 +127,7 @@ main(int argc, char **argv) } while ((ch = getopt(argc, argv, - "a:b:Cc:Dd:E:e:F:f:hi:LlMm:NnO:o:Pp:Ss:t:Uv:w:X")) != -1) + "a:b:Cc:Dd:E:e:F:f:hi:LlMm:NnO:o:Pp:Ss:tUv:w:X")) != -1) switch (ch) { case 'a': argappend(&newfs_arg, "-a %s", optarg); @@ -212,6 +212,9 @@ main(int argc, char **argv) case 's': argappend(&mdconfig_arg, "-s %s", optarg); break; + case 't': + argappend(&newfs_arg, "-t"); + break; case 'U': softdep = true; break; @@ -282,7 +285,7 @@ argappend(char **dstp, const char *fmt, { char *old, *new; va_list ap; - + old = *dstp; assert(old != NULL); @@ -417,7 +420,7 @@ do_mdconfig_detach(void) rv = run(NULL, "%s -d -u %s%d", path_mdconfig, mdname, unit); if (rv && debug) /* This is allowed to fail. */ warnx("mdconfig (detach) exited with error code %d (ignored)", - rv); + rv); } /* @@ -656,7 +659,7 @@ usage(void) { fprintf(stderr, -"usage: %s [-DLlMNnPSUX] [-a maxcontig] [-b block-size]\n" +"usage: %s [-DLlMNnPStUX] [-a maxcontig] [-b block-size]\n" "\t[-c blocks-per-cylinder-group][-d max-extent-size] [-E path-mdconfig]\n" "\t[-e maxbpg] [-F file] [-f frag-size] [-i bytes] [-m percent-free]\n" "\t[-O optimization] [-o mount-options]\n"