From owner-freebsd-fs@freebsd.org Thu Aug 23 05:52:46 2018 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5575108194D for ; Thu, 23 Aug 2018 05:52:46 +0000 (UTC) (envelope-from mckusick@mckusick.com) Received: from chez.mckusick.com (chez.mckusick.com [70.36.157.235]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5255D81D36 for ; Thu, 23 Aug 2018 05:52:46 +0000 (UTC) (envelope-from mckusick@mckusick.com) Received: from chez.mckusick.com (localhost [IPv6:::1]) by chez.mckusick.com (8.15.2/8.15.2) with ESMTP id w7N5vvjj038580; Wed, 22 Aug 2018 22:57:57 -0700 (PDT) (envelope-from mckusick@mckusick.com) Message-Id: <201808230557.w7N5vvjj038580@chez.mckusick.com> From: Kirk McKusick To: bob prohaska Subject: Re: CFT: TRIM Consolodation on UFS/FFS filesystems cc: FreeBSD Filesystems X-URL: http://WWW.McKusick.COM/ Reply-To: Kirk McKusick In-reply-to: <20180822004843.GA84687@www.zefox.net> Comments: In-reply-to bob prohaska message dated "Tue, 21 Aug 2018 17:48:43 -0700." MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <38578.1535003877.1@chez.mckusick.com> Date: Wed, 22 Aug 2018 22:57:57 -0700 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,MISSING_MID, UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on chez.mckusick.com X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Aug 2018 05:52:47 -0000 > Date: Tue, 21 Aug 2018 17:48:43 -0700 > From: bob prohaska > To: Kirk McKusick > Cc: FreeBSD Current , > FreeBSD Filesystems , > bob prohaska > 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 ' 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: : TRIM flag on fs but disk does not support TRIM'' or ``WARNING: : 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 ' to tell the filesystem to stop sending TRIM commands). Do let me know you experiences if you try it out. Kirk McKusick