reverbrain/eblob — pull request #23 by SaveTheRbtz (2013-05-31 11:33:38+00:00)
Title: Speededup write path, revised iterator locking, introduced database lock and more.

* Lock database on start using `lockf()` to prevent multiple `libeblob` instances from using same database simultaneously;
* Introduce new `periodic` thread for various background tasks;
* Move statistics updates to `periodic` thread. This almost fully removes statistics update from write path. Also stats update is now atomic - it creates temp file, writes data to it and then uses `rename()`;
* Move heavy `statvfs(3)` call to `periodic` thread. This removes around 5-7 system calls (depending on `libc` implementation) and speeds up write microbenchmarks by factor of two;
* Improved locking in iterator. Previously each following iterator could re-`mmap` data used by already running iterator. Now we hold `bctl` for duration of one batch of `dc`s preventing another thread by re`mmap`ing data underneath it;
* Now that we have working locks - allow iterator to proceed along with `data-sort`;
* Removed old `defrag` parts for good;
* Misc bugfixes and formatting / comment / CI improvements.