> From: zfs-discuss-boun...@opensolaris.org [mailto:zfs-discuss-
> boun...@opensolaris.org] On Behalf Of Fajar A. Nugraha
> 
> Shouldn't modern SSD controllers be smart enough already that they know:
> - if there's a request to overwrite a sector, then the old data on
> that sector is no longer needed

In the present state of the world, somebody I know in the trade describes
SSD's as "the pimple on the butt of the elephant" when it comes to flash
manufacturing.  In other words, mobile devices account for a huge majority
(something like 90%) of flash produced in the world, and SSD's are something
like 4%, and for some reason (I don't know why) there's a benefit to
optimizing on 8k pages.  Which means no.  If you overwrite a sector of a
SSD, that does not mean you can erase the page.  Because you can only erase
the whole page, and the disk can only interact with the OS using 4k blocks
or smaller.  So there's a minimum of 2 logical blocks per page in the SSD.
When you trim a block, only half of the page gets marked as free.
Eventually the controller needs to read half a block from page A, half a
block from page B, write them both to blank page C, and then erase pages A
and B.


> - allocate a "clean" sector from pool of available sectors (part of
> wear-leveling mechanism)
> - clear the old sector, and add it to the pool (possibly done in
> background operation)

The complexity here is much larger...  In all the storage pages in the SSD,
some are marked used, some are marked unused, some are erased, and some are
not erased.  You can only write to a sector if it's both unused and erased.
Each sector takes half a page.  You can write to an individual sector, but
you cannot erase an individual sector.

At the OS interface, only sectors are logically addressed, but internally
the controller must map those to physical halves of pages.  So the
controller maintains a completely arbitrary lookup table so any sector can
map to any sector or page.  When the OS requests to overwrite some sector,
the controller will actually write to some formerly unused sector and remap
and mark the old one as unused.  Later in the background, if the other half
of the page is also unused, the page will be erased.

Does that clarify anything?

_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to