diskutil: ensure that we lock around disk_list access

And also ensure that before we free the disk util structures,
we wait for the disk util thread to exit.

This is v2 of the patch. Commit feb41855 had a bug where it
would deadlock on the disk_util_mutex, when handling drives
that had slaves (lvm/md).

Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/diskutil.h b/diskutil.h
index 5a9b079..88dde55 100644
--- a/diskutil.h
+++ b/diskutil.h
@@ -94,6 +94,8 @@
 
 extern struct flist_head disk_list;
 
+extern void wait_for_disk_thread_exit(void);
+
 /*
  * disk util stuff
  */
@@ -102,13 +104,18 @@
 extern void show_disk_util(int terse);
 extern void free_disk_util(void);
 extern void init_disk_util(struct thread_data *);
-extern void update_io_ticks(void);
+extern int update_io_ticks(void);
+extern void setup_disk_util(void);
 #else
 #define print_disk_util(dus, agg, terse)
 #define show_disk_util(terse)
 #define free_disk_util()
 #define init_disk_util(td)
-#define update_io_ticks()
+#define setup_disk_util()
+static inline int update_io_ticks(void)
+{
+	return 0;
+}
 #endif
 
 #endif