Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 May 2014 12:23:05 +0200
From:      Bernd Walter <ticso@cicely7.cicely.de>
To:        Ian Lepore <ian@FreeBSD.org>
Cc:        freebsd-arm@FreeBSD.org, Bernd Walter <ticso@cicely7.cicely.de>, ticso@cicely.de
Subject:   Re: TRIM on SD cards
Message-ID:  <20140531102305.GK26883@cicely7.cicely.de>
In-Reply-To: <1401505209.20883.34.camel@revolution.hippie.lan>
References:  <20140531004306.GI26883@cicely7.cicely.de> <1401505209.20883.34.camel@revolution.hippie.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, May 30, 2014 at 09:00:09PM -0600, 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?
> 
> 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.

That 1 bit thing is true for raw flash media.
A amanged NAND flash device simply unmaps a logical block from physical
storage.
This is similar to having holes in an ufs file, which per definition
returns zero when reading a hole range.
However from reading the thread it is not save to assume managed flash
devices return zero blocks when reading TRIM'ed space.

-- 
B.Walter <bernd@bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140531102305.GK26883>