From owner-freebsd-arm@FreeBSD.ORG Sat May 31 04:00:22 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 31A08AD9 for ; Sat, 31 May 2014 04:00:22 +0000 (UTC) Received: from mail-pb0-f42.google.com (mail-pb0-f42.google.com [209.85.160.42]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F381F2E70 for ; Sat, 31 May 2014 04:00:21 +0000 (UTC) Received: by mail-pb0-f42.google.com with SMTP id md12so2393583pbc.1 for ; Fri, 30 May 2014 21:00:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:message-id:references:to; bh=gzdFM+IocDH2ZOIXjeRFfNouCfcbt2jN4oW+GFw66dc=; b=e02453e1l8BvLksCtLBKMPrznPHMYNILRQq3jlA2vuIxrHwAtNZaq6Y32nWT4AXtBO DTXpReXIaTZhQZ4RUUI8zhospeQU2dVttCmbf9kKP1inMDgrajTUFxdeJITCr0qKADYG cbPl2RISBDEEejM4mjq6eKoHvmQy/Kb1ugdjaOkEcsvRgrGcnUCEV13XhxnCY5AErpdg 33+9x2yltVuUCfbSzS/vXRKELlY/hiKIuBYVR0MFjA6VUqfZ6x4lTZZptRUvfPUPWp7V VKxIBOSJnqQ3f3BdZfyXmZFLjEeVkEOHmowARSWKZXeoBjdXQ47yJ6L3LhYXshNR/M6t QGKw== X-Gm-Message-State: ALoCoQmZl32bP+K2wAkDcJ8LTAltjh5ydKra+3f/2HZizUjJRrNF+9GdHaKX0r/pwiS06D/azUWl X-Received: by 10.68.196.168 with SMTP id in8mr24050771pbc.132.1401508503643; Fri, 30 May 2014 20:55:03 -0700 (PDT) Received: from lgmac-rtangirala.corp.netflix.com (dc1-prod.netflix.com. [69.53.236.251]) by mx.google.com with ESMTPSA id iq10sm8907912pbc.14.2014.05.30.20.55.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 30 May 2014 20:55:02 -0700 (PDT) Sender: Warner Losh Content-Type: multipart/signed; boundary="Apple-Mail=_9C453B3F-2FC5-4690-8559-A26EA57512CE"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) Subject: Re: TRIM on SD cards From: Warner Losh In-Reply-To: <1401505209.20883.34.camel@revolution.hippie.lan> Date: Fri, 30 May 2014 21:55:02 -0600 Message-Id: References: <20140531004306.GI26883@cicely7.cicely.de> <1401505209.20883.34.camel@revolution.hippie.lan> To: Ian Lepore X-Mailer: Apple Mail (2.1878.2) Cc: freebsd-arm@FreeBSD.org, Bernd Walter , ticso@cicely.de X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 May 2014 04:00:22 -0000 --Apple-Mail=_9C453B3F-2FC5-4690-8559-A26EA57512CE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On May 30, 2014, at 9:00 PM, Ian Lepore wrote: > On Sat, 2014-05-31 at 02:43 +0200, Bernd Walter wrote: >> It seems SD cards support a delete command, which FreeBSD supports >> with the mmcsd driver. >> newfs and tunefs support TRIM in that new filesystems are trim'ed >> and the filesystems automatically trim free'ed blocks. >> So far so good. >> On the practical side with SD based ARM you don't write filesystems >> directly via mmcsd. >> We either create an image, which id dd'ed onto SD or in some cases >> we use an USB SD drive. >> With dd the unused blocks are written as well, which effectively >> hurts by writing data. >> Is there some kind of dd, which actually don't write zero blocks, >> or even better does a trim call for them? >=20 > I don't think dd can safely do that. If it finds a block of zeroes on > the input side, how does it know it's okay to do a DELETE for those > (which sets the block to all-bits-on on most flash media). Maybe it's > important for that data to really be zero; dd doesn't know. >=20 > That's one of the reasons why I recently mentioned a desire for > a /dev/ones to go with /dev/zero as a way of pre-init'ing an image to = be > more friendly to flash media. The idea was not well-received by other > freebsd folks. >=20 > Maybe if the image was sparse, dd could tell the difference between an > missing segment and a segment populated with zeroes and do a DELETE = for > missing data. I never do the image creation thing, I mostly tend to = use > nfsroot and at $work we use tar to copy files to sdcards with a usb > burner rather than preformatting images into files. Blocks of zeros can safely be BIO_DELETEd. Why, because nonexistent = blocks are, by definition, all zeros. The only time there=92s a problem = is when the TRIM doesn=92t really TRIM=85 You don=92t need it to be = sparse at all. Zeros are zeros. Warner > -- Ian >=20 >> Is there a tool to trim a filesystem after creation? >> Ok - even then there is the option to directly newfs on the SD card. >> But in any case I need to be able to issue trim requests to the card. >> It seems there is support in our da driver, but will it be = transported >> to the USB reader and even if - how can I find out if my reader = actually >> supports trim commands? >> A newfs -t -E with my older transcend multireader and a new class10 >> Intenso micro-SD issues no error. >> But is it save to assume the card actually got trim'ed? >>=20 >> Trim is enabled on the filesystem, but not shown in mount list: >> [189]gw1# tunefs -t enable /dev/da0 >> tunefs: issue TRIM to the disk remains unchanged as enabled >> [190]gw1# mount /dev/da0 /mnt >> [191]gw1# mount | grep mnt >> /dev/da0 on /mnt (ufs, local, soft-updates) >> FreeBSD gw1.cicely.de 10.0-STABLE FreeBSD 10.0-STABLE #0: Thu Apr 17 = 11:47:45 CEST 2014 = ticso@gw1.cicely.de:/usr/obj/home/builder/gw1/10/sys/GW1 i386 >>=20 >=20 >=20 > _______________________________________________ > freebsd-arm@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arm > To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org" --Apple-Mail=_9C453B3F-2FC5-4690-8559-A26EA57512CE Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJTiVKWAAoJEGwc0Sh9sBEA1IcP/jjkqOFlK8eMf9F3Hx3GE5qi cggpcYAJfd3afUV599L55dAhM7aEJSvJRyb9jwb57MtJhpJlmv46kV/fKpfgPwpR DZRfm7G/kBbW6XWHEiKZw3BXLiXgvNRrco4gPpfCINeG/oKXq99ZGdoQ5aXH8Gys zxWtFc72Q5i56NXwIcZH9W2PGA0+ygmv8pxVxjpXl3OIYdC4PyzsLHvmdvCrP/XO PXD6F1p2vEc3NXPdkgbDbHyfZYiLmi3umfkQVYWLsR4WYaA/QA0v+V9Z5/VBHJ5y LTfnhrAcxqUNT8cVJwqEMxsDDk8TnHcmMv6xT5s0CqHY00XZ2dDp4MXdzJPpehgj 59YRn/L+OaNPGoWKLSQu2cmbXU1JgbRhUnLHqUrzgXvJvAQnIrMgnRpMdX88J6sP dyjjiJWaYBR9m64USz1ZVplhbxeLXiebsks91G5AG2iUZC+51fNz9LDbJ1C24qaT JdfdF7VZ/M8QaGtvf4u75P+J6TJjsKje/jp112Sql5beQWRRFLQwiH0e6pj8809w /XoR6EeuRV4Qqd6/LUTxjYvzJRJrQqQn7TOo1h5kbsPFkjQXXu+0fqPK5Ua3nizI C0HSP0WxE/Wb83Bs00WOV3/MVJ8+OCj6f5BtO560UwFH04rsgP2YpqkzH8vZoHtB twDnUZcFnsGQJvaIgWqx =p8J5 -----END PGP SIGNATURE----- --Apple-Mail=_9C453B3F-2FC5-4690-8559-A26EA57512CE--