Hacker News new | ask | show | jobs
by dapperdrake 12 days ago
How come copy-on-write is not easier with SMR? Each SMR zone a.k.a. shingle or flash erase block is effectively a tiny tape drive. It is basically append only.

Shouldn't this be especially useful with ZFS doing copy-on-write with linked lists as a reversed heap?

EDIT: So apparently, ZFS ashift is capped at 16 and values along 28 would be necessary to cover entire 256MiB (octet) shingles. Bummer.

EDIT2: The basic problem seems to stem from the exact same assumption that SQLite3 [1] makes: The sector write size for random write access is 512B or 4KiB, or whatever. With SMR and flash erase blocks, random write sector size and random read sector size are vastly different. Will take ages for filesystems to be updated to this new reality and then validated on real workloads.

[1] https://www.sqlite.org/atomiccommit.html, section 2 Hardware Assumptions.

1 comments

It seems like posix_fadvise a.k.a. fcntl only has provisions for forward read ahead a.k.a. prefetching and random access. The latter disables prefetching to free up disk read operations and dram memory otherwise used for read ahead.

With a reverse B-tree heap it may be fruitful to prefetch a back offset from the end of the file that ends with the top of the heap inclusive and then switch to random single reads for the sparser read access "down" the heap towards the beginning of the file.

Then comes the question of write access. Flash storage seems to be able to write small read-sized sectors into the empty remainders of erase blocks. With SMR the question becomes, whether there is a third sector size like a single track layer where the next overlapping track can be written later. For erasing, the whole shingle needs to be replaced kind of like a flash erase block.

Maybe OpenZFS ashift can be adjusted to single track sizes within a shingle. That would curb write amplification to the physical limitations. At 60 to 150 tracks that still requires ashift between roughly 22 and 20.5 which are both larger than 16. Seems like it is especially bad if there are no common divisors or other rounding problems.

Maybe non-temporal writes and write coalescing like in CPUs become relevant now. Dan Luu seems to be right here. The read(2), write(2), and fsync(2) bedrock of Unix may be forced to be updated to CPU-like caches where barriers, write-backs, etc. are handled separately.

Land of contrasts, even compared to usual engineering trade offs.

Maybe Donald Knuth should keep the paper foldout on tape access patterns in TAOCP instead of removing it in the next revision as he mentioned in an interview somewhere. The problem domain seems to be resurfacing.