Member-only story
Read-modify-write, a necessary pain — SSD Firmware Development — Part 18
Let’s redirect our attention once again to the SsdSim code. From the latest release tag, we have a set of tests and of which there are 2 failed tests: BasicRepeatedWriteReadVerify and BasicDescendingWriteReadVerify.
We can understand what these tests are doing with a quick inspection. The BasicRepeatedWriteReadVerify test is dead simple. It tries to write and read verify to LBA 0 with a sector count of 256 sectors each command, twice. The BasicDescendingWriteReadVerify performs write and read verify starting at the end LBA space and going in the decremental direction. Also with a sector count of 256. Being basic “data integrity” tests, we don’t really have an SSD if these tests are failing. The only thing worse might be a write-only SSD drive.
So why are these tests failing? When running the tests, we’ll notice that the first write-read-verify is actually successful and the second for either test case returns a “ReadError” on the read command. Given what we already know about NAND (review NAND basics here), we can see why we might be getting a read error. The repeat write test is trying to write to the same location on NAND without an erase operation. The descending write test is trying to write to the NAND blocks in non-increasing order. For the most part, these will certainly lead to data…