Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Nov 2018 13:59:31 +0700
From:      Eugene Grosbein <eugen@grosbein.net>
To:        Warner Losh <imp@bsdimp.com>
Cc:        FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: TRIM utility
Message-ID:  <6975ff4e-6383-e52c-3a11-d35b95cca114@grosbein.net>
In-Reply-To: <CANCZdfr4fADoG9OzPC8TXd6CeMkUqYqosx3QkheP08BTB7ajwA@mail.gmail.com>
References:  <7699de57-d903-1d61-ee42-062ed312b20d@grosbein.net> <CANCZdfr4fADoG9OzPC8TXd6CeMkUqYqosx3QkheP08BTB7ajwA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
23.11.2018 6:20, Warner Losh wrote:

>> I found we have no utility capable to perform TRIM for the whole SSD device
>> or arbitrary part of it, so I wrote simple one. I can't think of nice name
>> for it, so proposal are welcome! Draft name is "erase".
>>
>> I ask for pre-commit code review, too.
>> The code is tested with TRIM-capable SSD and non-capable other devices.
>>
>> Currently it has four options, all of them are, hmm, optional:
>>
>> -b: to specify offset from the beginning of the device for trimmed region
>> instead of default 0;
>> -l: to specify offset from the "-b" margin - length - for trimmed region
>> instead of whole device;
>> -r rfile: for alternative way to specify length as length of referenced
>> file;
>>
> 
> This seems really obscure and would be better handled by a stat command.

This is inspired by truncate(1) having same option that saves extra call to stat.

Forgot to note, that options -b and -l allow suffixes [K|k|M|m|G|g|T|t]
just like truncate's option -s does.

> "erase" is a really bad name. It's fraught with too many overloaded
> meanings. "trim" is likely the least bad name we can use.

I'm fine with this, renamed.

> Linux has a fstrim command, which does something kinda similar (it's a lot
> like fsck -E to erase unused parts of the filesystem), so there is some
> overlap. I couldn't find a dedicated command to do that, but if it does, we
> should follow that convention to reimplement.

Well, they have http://man7.org/linux/man-pages/man8/blkdiscard.8.html

I don't like the name, though. It's too complicated to pronounce and too long same time.

I can rename -b option to -o to match blkdiscard's, if this matters.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6975ff4e-6383-e52c-3a11-d35b95cca114>