openssd: lots of small fixes

* Moved to 4096 again, there's some nasty bugs when we start to
stresstest.
* Optimized a couple of loops
* Cleanups.
* Fixed an off-by-one error.