Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Aug 2018 22:57:57 -0700
From:      Kirk McKusick <mckusick@mckusick.com>
To:        bob prohaska <fbsd@www.zefox.net>
Cc:        FreeBSD Filesystems <freebsd-fs@FreeBSD.org>
Subject:   Re: CFT: TRIM Consolodation on UFS/FFS filesystems
Message-ID:  <201808230557.w7N5vvjj038580@chez.mckusick.com>
In-Reply-To: <20180822004843.GA84687@www.zefox.net>

next in thread | previous in thread | raw e-mail | index | archive | help
> 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)
> 
> On Mon, Aug 20, 2018 at 12:40:56PM -0700, Kirk McKusick wrote:
>> I have recently added TRIM consolodation support for the UFS/FFS
>> filesystem. This feature consolodates large numbers of TRIM commands
>> into a much smaller number of commands covering larger blocks of
>> disk space.
>>
>> ...
> 
> Will the new feature be active on a Raspberry Pi 3 using flash 
> on microSD and USB for file systems and swap? 

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.

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

Yes. Just add `sysctl vfs.ffs.dotrimcons=1' to your /etc/rc.local
startup script (or where ever else in the startup that you handle
local startup configuration). Or just log in (as root) or use sudo
to run the sysctl once the system is up and running. Once the sysctl
has been run, all filesystems running with TRIM requested will start
consolodating their TRIM requests.

> According to Sandisk, 
> "All microSD or USB drives are flash memory and does support the
> TRIM command, however, you will not  notice any difference after
> running TRIM command on memory cards or USB drives. TRIM command
> is basically used for SSD and Hard drives."
> 
> 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.  From time to time there
> seem to be traffic jams among flash devices on the RPI3, it would
> a pleasant surprise if this feature helps.
> 
> Thanks for reading!
> 
> bob prohaska

It will not hurt, but if the above is to be believed will not help
either. You would be better off not requesting the filesystem to send
TRIM requests to avoid the overhead of doing so (e.g., if -t was
specified when the filesystem was created, then you can use the command
`tunefs -t disenable <filesystem name or device>' to tell the filesystem
to stop sending TRIM commands).

Do let me know you experiences if you try it out.

	Kirk McKusick



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