TRIM command also named UNMAP command in SCSI. The format is defined in [9]. So we use UNMAP to replace call the TRIM in this section. To make sure UNMAP command work, first the operation system must support UNMAP command, and second the device
storage must ensure itself for UNMAP. The version of operation system support TRIM is Windows 7, Windows 8, Linux 2.6.28 and later version. To ensure a block device enable itself for UNMAP, the device must support vital product data (VPD) first. VPD is the information about stored computer’s device, the VPD page structures are returned by an INQUIRY command. For support VPD, setting the EVPD to 1 and specifying the page code which page code effect about choose type of the extend VPD structure. One of the types is Block Limits VPD page, it has fields Maximum UNMAP LBA Count and Maximum UNMAP Block Descriptor Count, the Maximum UNMAP LBA count field indicates the maximum number of LBAs that may be unmapped by an UNMAP command. And the Maximum UNMAP Block Descriptor Count field indicates maximum number of UNMAP block descriptors. One of the type is Logical Block Provisioning VPD, to make sure the device support UNMAP, it must set VPD page logical block provisioning structure’s LBPU filed bit to 1.
After delte file, storage device received UNMAP command along with UNMAP parame-ter list see figure 3.4, it shows the command format. The UNMAP parameparame-ter list included block descriptor data, every block descriptor data descriptor the unmapped file of the start LBA and the length of blocks, the format shows in figure 3.4b and 3.4c. Figure 3.4a, the UNMAP command fields include operation code, parameter list length, and control field.
The operation code field is the first byte of command descriptor block (CDB) that identi-fying the operation. Parameter list length field specifies the length in bytes of the UNMAP parameter data. Figure 3.4b, the UNMAP parameter list contains the data sent by ap-plication client along with UNMAP command. UNMAP parameter list include parameter list header and UNMAP Block Descriptor Data. UNMAP parameter list header field indi-cates the following length in bytes of UNMAP Block Descriptor Data. The UNMAP Block Descriptor has field of first LBA of the block should be unmapped and field of the number of the LBAs to be unmapped began with the first LBA. There are not only one UNMAP Block Descriptor Data in the UNMAP parameter list.
For example like Figure 3.3. If we delete a file, the starting logical block address is 100 and the file size 4 KB. We assume length filed of the block descriptor data only can show the maximum size is 524288 in bytes (512 KB). The format is shown in figure 3.3a, block
.
Figure 3.3: The figure shows the example of unmap command and unmap parameter list, figure (a) after delete 4KB-file the receded format and starting logical block address is 100, figure (b) after delete 1024KB-file the receded format and starting logical block address is 100
starting logical block address is 100 and the file size 1024 KB. The length maximum of block descriptor data is still 512 KB. The format is shown in figure 3.3b, because the file is large, so there have two block descriptor data. One is block descriptor data filed start LBA and length is 100 and 524288. And the other block descriptor data start LBA field is 100 and length field 524288. The parameter list have limited block descriptor data. So we can find that, with the file becomes bigger the only one TRIM command can not describe the file, it may have more TRIM commands to describe it. It can extend one phenomenon the large the file deleted the more the TRIM commands issues.
nd the setup of Block Limits VPD Maximum UNMAP LBA Count field is 256 and Maximum UNMAP Block Descriptor Count field is 16, The UNMAP command will set parameter list length 18, and parameter list header will set UNMAP data length 16, UN-MAP Block Descriptor Data Length 10. The setting of UNUN-MAP Block Descriptor Data will show the file starting LBA address and length is 4096 in bytes.
After make sure low device support TRIM, we have make the operating system support TRIM. In nowadays, we have manual to make the operating system support TRIM. In Windows, firs have to use command prompt, and type the following ”fsutil behavior set disabledeletenotify 0”. After that, the operating system will support TRIM. To disable TRIM, type ”fsutil behavior set disabledeletenotify 1”. And If want to know the Windows
0 Operation code 1…
5
Reserved
6 Reserved Group Number 78 Parameter List Length
9 Control
Figure 3.4: the figure(a) and (b) shows the format of unmap command and unmap param-eter list, figure (c) is block descriptor data which is included by unmap paramparam-eter list, each block descriptor data shows the starting address and length of unmapped file
support TRIM or not, type ”fsutil behavior query disabledeletenotify”. The output is 1 means trim-disable , the output is 0 means trim-enable. In Linux, to enable TRIM command is to edit the fstab file and insert ”discard” before after the file system format.
Or can using the command ”mount” and open the option mode ”-o discard” to mount the SSD.
Chapter 4
Experiments Results
4.1 Experimental Setup
This section we provide several experiments to discussed TRIM. The experiments consist of two parts. The first part section B. is to observed host behaviors, the second part section C. is to compare trim-enable and trim-disable performance on real SSD.
In first part, the host behavior is about to know when the file system send TRIM com-mand, the relations about deleted files and number of TRIM commands, and how the file size and file number affect TRIM commands. We set several tests in these part. To ob-serve these host behaviors, we use virtual drive to accepted TRIM and calculate TRIM commands. The tests is excess on two environments. One is on Windows 7 and setting the file system is NTFS, the other is Linux 3.9.11 and setting the file system is EXT4. To choose these two file system is because this is popular file system and most important the two file system is support TRIM.
In second part, there has four experiments in these part. We used two benchmark to test the effect: Iometer and Postmark, the describe detail of benchmark is in after section. In every benchmark we will make sure that to write full random data to bypass the compression engine inside of the solid-state disk. We choose two popular real solid-state
SSD Intel SSD 520 series Plextor M5 Pro
Disk size 120 GB 128 GB
controller SandForce SF-2281 Marvel 88SS9187
DRAM cache NO 256 MB
SATA SATA 6Gb/s SATA 6Gb/s
Table 4.1: Characteristics of SSD
OS File Size Idle Time Received TRIM
Windows 10 KB 0 (s) 1
Windows 10 KB 30 (s) 2
Linux 10 KB 0 (s) 0
Linux 10 KB 30 (s) 0
Table 4.2: The result table of first test
disks for our test, plextor SSD and intel SSD, the information can see Table 4.1. We also conducted the experiment on both Windows 7 and Linux 3.9.11 and with file system NTFS and EXT4, each run of experiments has options enable or disable TRIM. We compare the write performance of trim-enable and trim-disable and analyze it. The setup detail is in its own sections.