threads: allow calling sync, defrag and periodic tasks on behalf of calling threads, not dedicated threads

There is a special flag which prevents threads from starting.
All appropriate code has been moved to dedicated functions which are either called from
threads (old behaviour) or in the calling context (new behaviour for users who want to call sync,
defrag and periodic stat updates themself).

Patch from <pavel@wialus.co.nz>
Merge branch 'master' of github.com:reverbrain/eblob