Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Aug 2018 18:47:19 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        bob prohaska <fbsd@www.zefox.net>, FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: CFT: TRIM Consolodation on UFS/FFS filesystems
Message-ID:  <170C703D-AA75-4EC9-93BA-D2CF3A7D6D5E@yahoo.com>

next in thread | raw e-mail | index | archive | help
bob prohaska fbsd at www.zefox.net wrote on
Wed Aug 22 00:48:33 UTC 2018 :

> On Mon, Aug 20, 2018 at 12:40:56PM -0700, Kirk McKusick wrote:
> > . . .
> >=20
> > To enable TRIM consolodation either use `sysctl =
vfs.ffs.dotrimcons=3D1'
> > or just set the `dotrimcons' variable in sys/ufs/ffs/ffs_alloc.c to =
1.
> >=20
>=20
> Will the new feature be active  on a Raspberry Pi 3 using flash=20
> on microSD and USB for file systems and swap?=20

Even if a USB device contains appropriate storage in it, that does
not mean that the USB protocol in use has a way to request the
operation. (Similarly for other multiple stages of translation
than USB protocol being involved.)

For FreeBSD, UFS and ZFS have support if the requests can be sent
through all the stages. Swap partitions do not have support even
if the device does through all the stages.

(See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D206048 for
why I do not otherwise mention swap files.)

RPI3's use (some subset of?) USB 2.0 as I remember. I'm not aware
of the protocol supporting such. (I'm no expert, however.) Thus,
UFS and ZFS end up unable to do TRIM for such contexts as I
understand things.

> Can the feature be turned on using one of the conf files in /etc?=20

At least for UFS there are commands for configuration, such as
tunefs and newfs that include control of such points. I do not
remember for ZFS.

As I remember if you enable it on UFS but it actually can not
do it for how the device is connected, FreeBSD reports the
issue at mount or some such.

I've used a SSD both directly via SATA and via a USB enclosure,
the same partitions/file systems across the uses. Only when it
was SATA-style-use did TRIM work.

> According to Sandisk,=20
> "All microSD or USB drives are flash memory and does support the TRIM =
command, however,=20
> you will not  notice any difference after running TRIM command on =
memory cards or USB=20
> drives. TRIM command is basically used for SSD and Hard drives."

This gets back into what the protocols in use allow to be
requested when direct communication with the flash is not
in use. (More may be involved.)

> The "you will not notice any difference...." qualification makes me =
slightly uncertain
> the reply was well-informed, but if there's any hope of success I'd =
like to try it.
> >=46rom time to time there seem to be traffic jams among flash devices =
on the RPI3, it
> would a pleasant surprise if this feature helps.

I'll note that gstat with -d allows watching the "BIO_DELETE"
operations (in FreeBSD terms). One can see if they are what
time is being spent on.

Quoting g_bio(9) :

		    BIO_DELETE	 Indicates that	a certain range	of data	=
is no
				 longer	used and that it can be	erased =
or
				 freed as the underlying technology =
supports.
				 Technologies like flash adaptation =
layers can
				 arrange to erase the relevant blocks =
before
				 they will become reassigned and =
cryptographic
				 devices may want to fill random bits =
into the
				 range to reduce the amount of data =
available
				 for attack.

In your rpi3/2 experiments if you watch the column
sequence:

d/s kBps ms/d

I expect that you will find that they stay at:

  0    0  0.0

indicating lack of use.



=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?170C703D-AA75-4EC9-93BA-D2CF3A7D6D5E>