[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] NBD kernel module, client and server with support for TRIM

On Fri, Mar 16, 2012 at 10:42:03AM -0700, katon goukakyuuno wrote:
> Hi Wouter,
> Thank you very much for replying! I have patched my kernel to support only
> TRIM. I hope I need not apply the patch for FLUSH/FUA as well to just use TRIM?
> I hope all patches are added to the latest Linux kernel soon!
> I have also updated the nbd client and server to version 3.0 (the latest
> version) which does support TRIM.
> How do I test if TRIM is working properly on my system? Are there any test
> scripts readily available;

Not at this time. In fact, while I expect it to be working, I haven't
actually tested it much myself.

> or, do I need to create a new /dev/nbd and mount a
> file system which supports TRIM and then try to issue some commands from
> userspace? I haven't completely figured out this part yet.

Something like that. This should work:
- set the 'trim' option to 'true' in an nbd export
- connect to that NBD export from a client (may be the same machine)
- create an ext4 filesystem on that device
- mount the filesystem with the option 'discard'
- create a large file on the filesystem
- sync
- run 'du' on the nbd backend file
- remove the file
- sync again
- run 'du' again, and see if the file is now smaller. If it is, then a
  TRIM command was sent successfully to the server.

The volume of a pizza of thickness a and radius z can be described by
the following formula:

pi zz a

Reply to: