Add --debug=mutex
authorJens Axboe <jens.axboe@oracle.com>
Mon, 5 Jan 2009 18:06:39 +0000 (19:06 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 5 Jan 2009 18:06:39 +0000 (19:06 +0100)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
README
debug.h
fio.c
init.c

diff --git a/README b/README
index c5598109b6309a8cc44972f740fd95b664cf8c0b..dd3bab11a4937e68016fb0b934b9987d2b2eadc0 100644 (file)
--- a/README
+++ b/README
@@ -126,6 +126,7 @@ options in fio. Currently the options are:
        parse           Dump info related to option matching and parsing
        diskutil        Dump info related to disk utilization updates
        job:x           Dump info only related to job number x
+       mutex           Dump info only related to mutex up/down ops
        ? or help       Show available debug options.
 
 You can specify as many as you want, eg --debug=file,mem will enable
diff --git a/debug.h b/debug.h
index a9e9e9352531c3d89d4853b5ad528e69daab210d..1a2b79ab6d24b4a385ed1720f718dc29a345cf3b 100644 (file)
--- a/debug.h
+++ b/debug.h
@@ -15,6 +15,7 @@ enum {
        FD_PARSE,
        FD_DISKUTIL,
        FD_JOB,
+       FD_MUTEX,
        FD_DEBUG_MAX,
 };
 
diff --git a/fio.c b/fio.c
index 30b40cc7e27d8be1e9940695ed2c36c92bba2c46..5a40004f5c4dea4c974dcd6c489033b83595be31 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -941,8 +941,11 @@ static void *thread_main(void *data)
        td->io_hist_tree = RB_ROOT;
 
        td_set_runstate(td, TD_INITIALIZED);
+       dprint(FD_MUTEX, "up startup_mutex\n");
        fio_mutex_up(startup_mutex);
+       dprint(FD_MUTEX, "wait on td->mutex\n");
        fio_mutex_down(td->mutex);
+       dprint(FD_MUTEX, "done waiting on td->mutex\n");
 
        /*
         * the ->mutex mutex is now no longer used, close it to avoid
@@ -1280,7 +1283,9 @@ static int fio_start_gtod_thread(void)
                return 1;
        }
 
+       dprint(FD_MUTEX, "wait on startup_mutex\n");
        fio_mutex_down(startup_mutex);
+       dprint(FD_MUTEX, "done waiting on startup_mutex\n");
        return 0;
 }
 
@@ -1422,7 +1427,9 @@ static void run_threads(void)
                                } else if (i == fio_debug_jobno)
                                        *fio_debug_jobp = pid;
                        }
+                       dprint(FD_MUTEX, "wait on startup_mutex\n");
                        fio_mutex_down(startup_mutex);
+                       dprint(FD_MUTEX, "done waiting on startup_mutex\n");
                }
 
                /*
diff --git a/init.c b/init.c
index 3142d8ca7a8dd9c32e606ea6bc2c7d49843f8b15..1adc004b05b754b8e48575634452f5371eff046a 100644 (file)
--- a/init.c
+++ b/init.c
@@ -895,6 +895,7 @@ struct debug_level debug_levels[] = {
        { .name = "parse",      .shift = FD_PARSE },
        { .name = "diskutil",   .shift = FD_DISKUTIL },
        { .name = "job",        .shift = FD_JOB },
+       { .name = "mutex",      .shift = FD_MUTEX },
        { .name = NULL, },
 };