trim: Target SCSI UNMAP command instead of WRITE SAME.

* The UNMAP command is theoretically much faster, as it can get many block
  ranges instead of just a single range.
* Furthermore, the ATA TRIM command resembles it much better.
* Therefore, fs_trim_data now gets an array of ranges, and we use SCSI UNMAP
  to trim.
* Updated BFS code to collect array ranges to fully support the new
  fs_trim_data possibilities.
This commit is contained in:
Axel Dörfler
2013-11-07 19:03:47 +01:00
parent 960c56aea5
commit 99086aa323
13 changed files with 249 additions and 64 deletions
+6 -3
View File
@@ -172,9 +172,12 @@ typedef struct {
/* B_TRIM_DEVICE data structure */
typedef struct {
off_t offset; /* offset (in bytes) */
off_t size;
off_t trimmed_size; /* filled on return */
uint32 range_count;
uint64 trimmed_size; /* filled on return */
struct range {
uint64 offset; /* offset (in bytes) */
uint64 size;
} ranges[1];
} fs_trim_data;