why isn't TRIM implemented in SSD Firmware?

Acanthus

Lifer
Aug 28, 2001
19,915
2
76
ostif.org
It makes no sense to me why engineers have created this convoluted lineage of support for TRIM on SSDs.

Why can't the firmware just execute a TRIM command while the drive is idle? If it was implemented in firmware you wouldn't need motherboard, o/s, or raid controller support...

There would be no problems with RAID-0/1/5/10 because the o/s would be blind to the operation.

I just don't get how after a couple of years this has not been implemented.

SSD's on RAID should be a holy grail for the SSD makers to move a lot more drives to enthusiasts.

Is there a technical reason this wouldn't work?
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
How would the firmware know which pages are safe to trim without understanding every filesystem in existence?
 

Acanthus

Lifer
Aug 28, 2001
19,915
2
76
ostif.org
How would the firmware know which pages are safe to trim without understanding every filesystem in existence?

the file would no longer be in the MBR

It would only really need to understand the big 2 for windows support. NTFS and FAT32.
 
Last edited:

imagoon

Diamond Member
Feb 19, 2003
5,199
0
0
the file would no longer be in the MBR

It would only really need to understand the big 2 for windows support. NTFS and FAT32.

Sounds dangerous to me. What version of NTFS will it support? How about the next service pack when they increment the NTFS Filesystem number? Will the drive now randomly clear sectors for me? What if I want to run ZFS? Ext3, Ext4?

Also, when the disks are raided (0 / 5 etc) Only parts of the NTFS system is actually on each disk.
 

Acanthus

Lifer
Aug 28, 2001
19,915
2
76
ostif.org
Sounds dangerous to me. What version of NTFS will it support? How about the next service pack when they increment the NTFS Filesystem number? Will the drive now randomly clear sectors for me? What if I want to run ZFS? Ext3, Ext4?

Also, when the disks are raided (0 / 5 etc) Only parts of the NTFS system is actually on each disk.

That's kind of a strange fear considering how SSDs with TRIM already work.

You are simply relying on more parties to keep your data safe.

Anandtech reported very little performance degradation on Durawrite-enabled drives.
 
Last edited:

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
the file would no longer be in the MBR

It would only really need to understand the big 2 for windows support. NTFS and FAT32.

The first sentence makes no sense as no files ever go in the MBR and I couldn't care less about FAT or NTFS support. Pretty much all of my filesystems at home are XFS or ext3 with ext4 and BTRFS probably be used in the future.

Acanthus said:
I was completely unaware that sandforce had implemented "SandForce DuraWrite" which is exactly the idea i was talking about.

Where did you read about it? A quick google didn't show anything about how it actually works other than comments about encryption/compression and how Sandforce won't say what it really does.

Acanthus said:
You are simply relying on more parties to keep your data safe.

I want less parties involved in my data, simple is better.
 

imagoon

Diamond Member
Feb 19, 2003
5,199
0
0
That's kind of a strange fear considering how SSDs with TRIM already work.

You are simply relying on more parties to keep your data safe.

Anandtech reported very little performance degradation on Durawrite-enabled drives.

TRIM works like this:

OS deletes a file from the file system. Sector is marked free in the MBT (ntfs) and is otherwise not touched. OS tells the HDD "Hey Sector 18AF45, is blank and can be erased" drive wipes the sector during cleanup operations. Sector gets wiped to 1's or 0's depending on the drive.

Without trim: OS deletes a file from the file system. Sector is marked free in the MBT (ntfs) and is otherwise not touched. Sector sits untouched until the next write operation where the sector gets wiped to 1's or 0's depending on the drive.

See the difference? TRIM is an OS and Disk function, not a disk only function.

The file system is TRIM irrelevant as any OS can tell the drive to wipe sectors because the file system drivers (should) know where the blank sectors are. The drive on the other hand has no clue what can be erased.
 
Last edited:

imagoon

Diamond Member
Feb 19, 2003
5,199
0
0
The first sentence makes no sense as no files ever go in the MBR and I couldn't care less about FAT or NTFS support. Pretty much all of my filesystems at home are XFS or ext3 with ext4 and BTRFS probably be used in the future.



Where did you read about it? A quick google didn't show anything about how it actually works other than comments about encryption/compression and how Sandforce won't say what it really does.



I want less parties involved in my data, simple is better.

I could be way off base, but I recall it having to do with spare space taking the writes first, then the drive copying the surrounding sectors and then wiping the old space in to "spare area" again. Mostly because the chips address something like 64k at a time so small writes are faster when written to a blank sector and the old data copied around it. Which then frees the 64k sector to be blanked.
 

Zap

Elite Member
Oct 13, 1999
22,377
7
81
Why can't the firmware just execute a TRIM command while the drive is idle?

It does. It is called "garbage collection." Read Anand's review of the latest Kingston drive (same one used in Macbook Air). All drives do it to some degree, it's just that Trim is the OS prompting the drive to initiate it. The Toshiba T6UG1XBG controller used does garbage collection really agressively, so it does not need Trim and does not degrade in performance. However, the concern is additional wear/tear on the chips since in theory there is a limited number of writes.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
It does. It is called "garbage collection." Read Anand's review of the latest Kingston drive (same one used in Macbook Air). All drives do it to some degree, it's just that Trim is the OS prompting the drive to initiate it. The Toshiba T6UG1XBG controller used does garbage collection really agressively, so it does not need Trim and does not degrade in performance. However, the concern is additional wear/tear on the chips since in theory there is a limited number of writes.

But doesn't that require a fairly large pool of pages to swap data in and out of since it doesn't know which pages have data and which don't?
 

Acanthus

Lifer
Aug 28, 2001
19,915
2
76
ostif.org
The first sentence makes no sense as no files ever go in the MBR and I couldn't care less about FAT or NTFS support. Pretty much all of my filesystems at home are XFS or ext3 with ext4 and BTRFS probably be used in the future.



Where did you read about it? A quick google didn't show anything about how it actually works other than comments about encryption/compression and how Sandforce won't say what it really does.



I want less parties involved in my data, simple is better.

Yes sorry, MBR is the incorrect term. The spirit of the idea was correct though. The OS "deletes" a file by removing it from an index that is simply a series of pointers to where files are. It would be easy for the firmware to find files with no pointers, which is essentially what TRIM does.

Anandtech did some coverage on the performance impact of DuraWrite but it appears that SandForce is keeping the technology a trade secret for a long as possible.

Even with TRIM disabled entirely, there was very little degradation over time on the SF1200 drives with DuraWrite enabled firmware.
 

Acanthus

Lifer
Aug 28, 2001
19,915
2
76
ostif.org
The first sentence makes no sense as no files ever go in the MBR and I couldn't care less about FAT or NTFS support. Pretty much all of my filesystems at home are XFS or ext3 with ext4 and BTRFS probably be used in the future.



Where did you read about it? A quick google didn't show anything about how it actually works other than comments about encryption/compression and how Sandforce won't say what it really does.



I want less parties involved in my data, simple is better.

Well for a mainstream implementation i am sure that exotic file systems would be excluded. Unless of course the company in question is targeting enterprise.

I agree with your final thought.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Acanthus said:
Yes sorry, MBR is the incorrect term. The spirit of the idea was correct though. The OS "deletes" a file by removing it from an index that is simply a series of pointers to where files are. It would be easy for the firmware to find files with no pointers, which is essentially what TRIM does.

Except that it's not that simple. NTFS uses b-trees to track file extents, not simple pointers like FAT. And that doesn't account for meta data like ACLs or alternate data streams. And I'm not even sure how encrypted or compressed files are accounted for off the top of my head. And if MS ever wants to compete with ZFS and BTRFS there will be a lot of changes for NTFS coming down the pipe unless they do their own new thing complete from scratch.

Well for a mainstream implementation i am sure that exotic file systems would be excluded. Unless of course the company in question is targeting enterprise.

I agree with your final thought.

But your "mainstream" implementation also excludes phones, tablets, OS X, servers, etc. Basically anything that's not Windows and despite how it looks since Windows owns the desktop right now, is a huge piece of the market.

And as imagoon mentioned, NTFS isn't static. MS makes minor changes to the format fairly frequently. Do you want an SSD that eats your data once you apply Win7 SP1?
 

Acanthus

Lifer
Aug 28, 2001
19,915
2
76
ostif.org
Except that it's not that simple. NTFS uses b-trees to track file extents, not simple pointers like FAT. And that doesn't account for meta data like ACLs or alternate data streams. And I'm not even sure how encrypted or compressed files are accounted for off the top of my head. And if MS ever wants to compete with ZFS and BTRFS there will be a lot of changes for NTFS coming down the pipe unless they do their own new thing complete from scratch.



But your "mainstream" implementation also excludes phones, tablets, OS X, servers, etc. Basically anything that's not Windows and despite how it looks since Windows owns the desktop right now, is a huge piece of the market.

And as imagoon mentioned, NTFS isn't static. MS makes minor changes to the format fairly frequently. Do you want an SSD that eats your data once you apply Win7 SP1?

it appears that someone has already figured out my suggestion :p so saying it isn't possible doesn't really apply here.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
it appears that someone has already figured out my suggestion :p so saying it isn't possible doesn't really apply here.

If you're talking about DuraWrite, not really. I didn't see any technical documents on how it works; just that it's a magic black box that helps performance. And if it does watch the filesystem itself, who's to say it won't break a ton of machines the next time MS tweaks NTFS? Those devices are still so new that hasn't happened yet.
 
Last edited:

Acanthus

Lifer
Aug 28, 2001
19,915
2
76
ostif.org
If you're talking about DuraWrite, not really. I didn't see any technical documents on how it works; just that it's a magic black box that helps performance. And if it does watch the filesystem itself, who's to say it won't break a ton of machines the next time MS tweaks NTFS? Those devices are still so new that hasn't happened yet.

Well for me the important part was avoiding performance degradation without TRIM, since no one can seem to get it working over RAID.

It appears that they didn't use my exact idea, but a combination of ideas that gets us to the same end.

what this means to me is: 3x Corsair Force 80GB in RAID-0 coming up :D
 

zephyrprime

Diamond Member
Feb 18, 2001
7,512
2
81
Firmware doesn't understand the file system so it doesn't know which sectors to trim or not trim.