Revamp file locking

Get rid of the semaphore implementation, no need to carry both.
Add different locking modes (exclusive and readwrite) to enable
a wider range of testing. Also combine lockfile and lockfile_batch,
the latter is now a postfix option to the former.

So to enable readers-excluding-writers locking mode with a lock batch
count of 4, you would write:

lockfile=readwrite:4

instead.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/smalloc.c b/smalloc.c
index 9a7c25b..85da781 100644
--- a/smalloc.c
+++ b/smalloc.c
@@ -268,11 +268,12 @@
 
 void sinit(void)
 {
-	int ret = add_pool(&mp[0]);
+	int ret;
 
 #ifdef MP_SAFE
 	lock = fio_mutex_rw_init();
 #endif
+	ret = add_pool(&mp[0]);
 	assert(!ret);
 }