DragonFly BSD
DragonFly kernel List (threaded) for 2011-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Update on TRIM support


From: Tim Bisson <bissont@xxxxxxx>
Date: Wed, 01 Jun 2011 23:12:58 -0700

Hi All,

Here's an update on TRIM support based on feedback from Matt, Alex, Venkatesh, and others. Thanks guys.

First, the code:
https://github.com/bissont/DragonFlyBSD

If you clone the code and do a:
git difftool upstream/master..HEAD
you can get a diff against the current master (as of today).

Changes:
* Moved the underlying TRIM code from the IDE driver to the AHCI/SCSI driver.
* Made UFS block frees (ffs_blkfree()) execute TRIM command on blocks asynchronously instead of synchronously. Once the TRIM command is completed, we free the actual blocks in the freemap in the callback. This makes delete performance much faster as we don't have to wait for the TRIM command to finish before returning from the ffs_blkfree().
* Added an option, -E to newfs_hammer, that will run TRIM on the devices making up the hammer file system before the hammer file system is created.
* Modified the IOCTL to take in bytes rather than sectors. In the IOCTL, we issue a BUF_CMD_FREEBLKS command using a struct buf, which has a size limit of 2^31 (b_bcount) bytes. Therefore, we potentially have to break up the IOCTL TRIM command into multiple requests if the original command is for more than 2^31 bytes in size.


From "man newfs":
-R Turn on the TRIM enable flag. If enabled, and if the underlying
device supports the BIO_DELETE command, the file system will send
a delete request to the underlying device for each freed block.
The trim enable flag is typically set when the underlying device
uses flash-memory as the device can use the delete command to
pre-zero or at least avoid copying blocks that have been deleted.


-E Use TRIM to erase the file system before creating it. If used
and the underlying device supports TRIM, the device's LBAs will
be erased using the TRIM command before the file system is cre-
ated.


From "man newfs_hammer"
-E      TRIM Device(s) before FS creation. Should only be called if all
             devices are SSDs that support TRIM.


Any suggestions, ideas, or feedback is welcome.


Thanks,
Tim







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