Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Aug 2018 17:56:56 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        bob prohaska <fbsd@www.zefox.net>
Cc:        Kirk McKusick <mckusick@mckusick.com>, FreeBSD Filesystems <freebsd-fs@FreeBSD.org>, freebsd-arm@freebsd.org
Subject:   Re: CFT: TRIM Consolodation on UFS/FFS filesystems
Message-ID:  <1F534D6D-3CA3-4E28-AF24-7AABAB0EDBD3@yahoo.com>
In-Reply-To: <20180824000637.GA2157@www.zefox.net>
References:  <20180822004843.GA84687@www.zefox.net> <201808230557.w7N5vvjj038580@chez.mckusick.com> <20180824000637.GA2157@www.zefox.net>

next in thread | previous in thread | raw e-mail | index | archive | help


On 2018-Aug-23, at 5:06 PM, bob prohaska <fbsd at www.zefox.net> wrote:

> On Wed, Aug 22, 2018 at 10:57:57PM -0700, Kirk McKusick wrote:
>>> Date: Tue, 21 Aug 2018 17:48:43 -0700
>>> From: bob prohaska <fbsd@www.zefox.net>
>>> To: Kirk McKusick <mckusick@mckusick.com>
>>> Cc: FreeBSD Current <freebsd-current@FreeBSD.org>,
>>>        FreeBSD Filesystems <freebsd-fs@FreeBSD.org>,
>>>        bob prohaska <fbsd@www.zefox.net>
>>> Subject: Re: CFT: TRIM Consolodation on UFS/FFS filesystems
>>> X-ASK-Info: Message Queued (2018/08/21 17:55:39)
>>> X-ASK-Info: Confirmed by User (2018/08/21 18:47:17)
>>>=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
>>=20
>> When you create the filesystem (using newfs) you need to specify
>> the -t option to request that it send TRIM commands to the underlying
>> media. If you have an existing filesystem, you can use the command
>> `tunefs -t enable <filesystem name or device>' to set the =
TRIM-request
>> flag. When you mount a fiesystem that has been told to send TRIM
>> commands, it will send an ioctl to the device asking if it supports
>> TRIM. If it replies that it does, then the TRIM commands will be
>> sent. If it does not then the kernel will print an error message
>> ``WARNING: <filesystem name>: TRIM flag on fs but disk does not
>> support TRIM'' or ``WARNING: <filesystem name>: TRIM flag on fs but
>> disk does not confirm that it supports TRIM''.  If you get no message
>> when you mount, then the drive will accept TRIM commands. Now whether
>> it will do anything with them is not clear based on your quote below.
>>=20
>=20
> Using
> FreeBSD 12.0-ALPHA2 #12 r338122: Tue Aug 21 14:26:18 PDT 2018
>=20
> Alas, no luck. On mount TRIM isn't supported:
>=20
> WARNING: /usr: TRIM flag on fs but disk does not support TRIM
>=20
> Using tunefs on the microSD produced a different refusal:
> # tunefs -t enable /dev/mmcsd0s2a
> tunefs: issue TRIM to the disk set
> tunefs: /dev/mmcsd0s2a: failed to open disk for writing
> I tried with the device both ro and rw, same error. I
> expected "not supported", rather than "failed to open".
> If there's a mistake please tell me.

For a UFS example:

# umount /mnt
pine64# tunefs -tenable /dev/mmcsd0s2a
tunefs: issue TRIM to the disk set
# mount -o noatime /dev/mmcsd0s2a /mnt
# tunefs -p /mnt
tunefs: POSIX.1e ACLs: (-a)                                disabled
tunefs: NFSv4 ACLs: (-N)                                   enabled
tunefs: MAC multilabel: (-l)                               disabled
tunefs: soft updates: (-n)                                 enabled
tunefs: soft update journaling: (-j)                       disabled
tunefs: gjournal: (-J)                                     disabled
tunefs: trim: (-t)                                         enabled
tunefs: maximum blocks per file in a cylinder group: (-e)  4096
tunefs: average file size: (-f)                            16384
tunefs: average number of files in a directory: (-s)       64
tunefs: minimum percentage of free space: (-m)             8%
tunefs: space to hold for metadata blocks: (-k)            6408
tunefs: optimization preference: (-o)                      time
tunefs: volume label: (-L)                                 PINE642GBroot


Then during a svnupdate -r477847 /usr/ports :

dT: 1.006s  w: 1.000s
 L(q)  ops/s    r/s   kBps   ms/r    w/s   kBps   ms/w    d/s   kBps   =
ms/d   %busy Name
 1265    144      1     32   3064    105   2597   2114     38    326   =
32.2  104.2| mmcsd0

Note the "d/s kBps ms/d" figures: it is actively in use.

Context:

This is from head -r337400 before the changes for how
things work. The root file system and swap partition
are on a USB SSD (on a powered hub). But:

mmcsd0: 32GB <SDHC SE32G 8.0 SN <REPLACED> MFG 07/2017 by 3 SD> at mmc0 =
50.0MHz/4bit/32768-block

It is a SanDisk microsdhc card that I did the test with.

> Not sure if this is true of all possible storage devices, but
> the Sandisk Ultra microSD and Sandisk Extreme USB appear to be
> non-starters.
>=20

USB of various vintages has its own issues for the commands
allowed.

But microsd cards that support it should allow TRIM. (If some
work worse with TRIM enabled is another matter. For the old
way TRIM was handled by FreeBSD may be nearly certain that
such works worse for such media.)


=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?1F534D6D-3CA3-4E28-AF24-7AABAB0EDBD3>