server: silence mem debug warning
[fio.git] / diskutil.c
index e90096bee6f5c099c639f0b29ebcd96eb0bfcac8..9fc309563ea55772125f81bd97389d7988cb82fe 100644 (file)
@@ -24,6 +24,14 @@ static void disk_util_free(struct disk_util *du)
        if (du == last_du)
                last_du = NULL;
 
+       while (!flist_empty(&du->slaves)) {
+               struct disk_util *slave;
+
+               slave = flist_entry(du->slaves.next, struct disk_util, slavelist);
+               flist_del(&slave->slavelist);
+               slave->users--;
+       }
+       
        fio_mutex_remove(du->lock);
        sfree(du->name);
        sfree(du);
@@ -67,10 +75,10 @@ static void update_io_tick_disk(struct disk_util *du)
        struct disk_util_stat __dus, *dus, *ldus;
        struct timeval t;
 
-       if (get_io_ticks(du, &__dus))
-               return;
        if (!du->users)
                return;
+       if (get_io_ticks(du, &__dus))
+               return;
 
        dus = &du->dus;
        ldus = &du->last_dus;
@@ -236,14 +244,16 @@ static void find_add_disk_slaves(struct thread_data *td, char *path,
 
                /* Should probably use an assert here. slavedu should
                 * always be present at this point. */
-               if (slavedu)
+               if (slavedu) {
+                       slavedu->users++;
                        flist_add_tail(&slavedu->slavelist, &masterdu->slaves);
+               }
        }
 
        closedir(dirhandle);
 }
 
-static struct disk_util *disk_util_add(struct thread_data * td, int majdev,
+static struct disk_util *disk_util_add(struct thread_data *td, int majdev,
                                       int mindev, char *path)
 {
        struct disk_util *du, *__du;