![](https://seccdn.libravatar.org/avatar/25bbc96d9c53647354cb724e744b2222.jpg?s=120&d=mm&r=g)
On Fri, Apr 23, 2010 at 10:00 AM, Jeff Mahoney <jeffm@suse.com> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 04/22/2010 01:50 PM, Greg Freemyer wrote:
But hdparm is only providing base functionality and it needs a script to actually invoke it correctly and cause the appropriate sectors to be discarded. Fortunately Mark Lord (the hdparm maintainer) is now also including "wiper.sh" with hdparm that will scan a filesystem (ext4 and xfs for sure and possibly others) and invoke discard in a very efficient way.
I don't think 11.2 or factory are including that script, but I'd like to see it go in as the opensuse 11.3 methodology for calling discard on a SSD.
That will mean including the script, testing it as part of opensuse, and getting it in the nightly cron scripts or something.
AFAIK these scripts and tools aren't safe to run on a mounted file system. Blocks could be allocated underneath the tool and would end up discarding parts of the file system that are in use.
Jeff, The script/hdparm pair use fallocate to accumulate a large chunk of unused blocks thus ensuring they are not used elsewhere. (note hdparm now has a --fallocate arg, as well as the new --trim-sector-ranges-stdin arg. Both are in OS 11.2) The pair then aggregate the discardable block ranges in to groups of a few thousand and invoke ATA-8 trim commands to the SSD bypassing most of the block layer (as hdparm likes to do). At the sata bus level, the trim command can carry thousands of sector ranges with it. ie. The spec calls for up to 255 sectors worth of payload, where the payload is a vectorized list of discard ranges. hdparm as it exists in 11.2 already has the ability to accept a huge list of discard ranges and parse it down into those 255 sector payloads and send it down to the drive. It's extremely efficient. Much more so than whats currently in the kernel. The only negative I see is that it is designed to be invoked routinely, not instantaneously like the kernel currently does it. But as stated, it is not safe with btrfs per the script notes, and I don't know how much hardware its been tested with. Greg -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-factory+help@opensuse.org