From owner-freebsd-fs@FreeBSD.ORG Wed Dec 8 15:21:45 2010 Return-Path: Delivered-To: freebsd-fs@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 943C9106564A for ; Wed, 8 Dec 2010 15:21:45 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 096D18FC19 for ; Wed, 8 Dec 2010 15:21:44 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 7AFB2456B1; Wed, 8 Dec 2010 16:21:43 +0100 (CET) Received: from localhost (pdawidek.whl [10.0.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id D99D145684; Wed, 8 Dec 2010 16:21:37 +0100 (CET) Date: Wed, 8 Dec 2010 16:21:36 +0100 From: Pawel Jakub Dawidek To: Oliver Fromme Message-ID: <20101208152136.GG1692@garage.freebsd.pl> References: <201012071531.oB7FVEhb047727@lurza.secnetix.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="j2AXaZ4YhVcLc+PQ" Content-Disposition: inline In-Reply-To: <201012071531.oB7FVEhb047727@lurza.secnetix.de> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=4.5 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: freebsd-fs@FreeBSD.ORG, Kirk McKusick Subject: Re: TRIM support for UFS? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Dec 2010 15:21:45 -0000 --j2AXaZ4YhVcLc+PQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 07, 2010 at 04:31:14PM +0100, Oliver Fromme wrote: > Hi, >=20 > I've bought an OCZ Vertex2 E (120 GB SSD) and installed > FreeBSD i386 stable/8 on it, using UFS (UFS2, to be exact). > I've made sure that the partitions are aligned properly, > and used newfs with 4k fragsize and 32k blocksize. > It works very well so far. >=20 > Now, the only thing missing would be TRIM support for UFS. > I did some research and found the following patch: >=20 > http://people.freebsd.org/~pjd/patches/ufsdel.patch >=20 > Apparently that patch is supposed to make UFS use TRIM, > among other things. However, the patch seems to be rather > old (time stamp says 2007-02-03), and nothing has been > comitted to current or stable so far (I've grepped through > the past 12 months of SVN logs, after TRIM support was > added to ada(4) by mav@). >=20 > So, my question is, are there plans to add TRIM support > to UFS? Is anyone working on it? Or is it already there > and I just overlooked it? I hacked up this patch mostly for Kris and md(4) memory-backed UFS, so on file remove space can be returned to the system. I think you should ask Kirk what to do about that, but I'm afraid my patch can break SU - what if we TRIM, but then panic and on fsck decide to actually use the block? BTW. Have you actually observed any performance degradation without TRIM? I've similar SSDs and from what I tested it somehow can handle wear leveling internally. You can to TRIM entire disk using this simple program below, newfs it and test it. Then fill it with random data, newfs it again, test it and compare results. =3D=3D=3D Makefile: PROG=3D trim LDADD=3D -lgeom NO_MAN=3D WARNS?=3D 6 =2Einclude =3D=3D=3D trim.c: #include #include #include int main(int argc, char *argv[]) { off_t mediasize; int fd; if (argc !=3D 2) errx(1, "usage: %s disk", getprogname()); if ((fd =3D g_open(argv[1], 1)) < 0) err(2, "g_open(%s)", argv[1]); if ((mediasize =3D g_mediasize(fd)) < 0) err(3, "g_mediasize()"); if (g_delete(fd, 0, mediasize) < 0) err(4, "g_delete()"); g_close(fd); exit(0); } --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --j2AXaZ4YhVcLc+PQ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkz/ooAACgkQForvXbEpPzQxgACdFFOUklSHI6O8E+cOZEW2ZSVs 9RcAnjQvx+GY87DCOrnLuVPh1Qz09w/2 =eezJ -----END PGP SIGNATURE----- --j2AXaZ4YhVcLc+PQ--