If you're not planning on making any further changes, would you mind posting a coalesced patch?
Notice that I removed the last offset thing only halfway, so it would need some cleanup.
Here is an updated patch. I removed the last offset caching thing completely and integrated your changes for conditional lock access. Some other improvements to test cases too. I realised that we must truncate and re-insert to test index fastpath correctly.