20100425 linux trim


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

20100425 linux trim

  1. 1. Linux TRIM Support for SSDs     [email_address]
  2. 2. Index <ul><ul><li>What is SSD? </li></ul></ul><ul><ul><li>What is TRIM? </li></ul></ul><ul><ul><li>Why TRIM for SSDs? </li></ul></ul><ul><ul><li>State of Art </li></ul></ul>
  3. 3. What is SSD? <ul><ul><li>Solid State Drive </li></ul></ul><ul><ul><li>NAND based. SATA/PCI interface.  </li></ul></ul><ul><ul><li>Compatible write, excellent read performance </li></ul></ul><ul><ul><li>High price </li></ul></ul>
  4. 4. What is SSD? <ul><ul><li>FTL (Flash Translation Layer)‏ </li></ul></ul><ul><ul><li>Wear-leveling </li></ul></ul><ul><ul><li>Write-gathering </li></ul></ul><ul><ul><li>Disks are dead! Long live Flash! </li></ul></ul>
  5. 5. What is TRIM? <ul><ul><li>A ATA command </li></ul></ul><ul><ul><li>Discard </li></ul></ul><ul><ul><li>Tells which blocks can be deleted </li></ul></ul>
  6. 6. Why TRIM for SSDs <ul><ul><li>Log-structured filesystem inside SSDs </li></ul></ul><ul><ul><li>Best performance comes when empty segments are created as a side effect of ongoing writes </li></ul></ul>
  7. 7. State of Art <ul><ul><li>TRIM is designed as a non-queued command. The block driver must clear the cmd queue before sending a TRIM cmd and should wait TRIM to complete before sending subsequent cmd. </li></ul></ul><ul><ul><li>Same effect as an io barrier. </li></ul></ul><ul><ul><li>Delays of hundreds of milliseconds per TRIM. </li></ul></ul>
  8. 8. State of Art <ul><ul><li>Ext4 impl (patch available)‏ </li></ul></ul><ul><ul><li>ioctl based batched trim </li></ul></ul><ul><ul><li>Walk through all free extents in each allocating group and discard those extents </li></ul></ul><ul><ul><li>Users can specify the minimal length of extents to be trimmed </li></ul></ul>
  9. 9. State of Art <ul><ul><li>Linux kernel Batched discard </li></ul></ul><ul><ul><li>FS level (proposal): use a rbtree to track deleted blocks and send it down after collapsing neighbor blocks </li></ul></ul><ul><ul><li>Lvm level (proposal): mdraid tracks all used/trimmed blocks </li></ul></ul><ul><ul><li>Block level (proposal): have a discard management layer </li></ul></ul><ul><ul><li>App level (impl): hdparm creates a large file, map it to blocks and discard them </li></ul></ul>
  10. 10. Thank You~~~