Lines Matching refs:du
25 static void disk_util_free(struct disk_util *du)
27 if (du == last_du)
30 while (!flist_empty(&du->slaves)) {
33 slave = flist_entry(du->slaves.next, struct disk_util, slavelist);
38 fio_mutex_remove(du->lock);
39 sfree(du);
42 static int get_io_ticks(struct disk_util *du, struct disk_util_stat *dus)
51 dprint(FD_DISKUTIL, "open stat file: %s\n", du->path);
53 f = fopen(du->path, "r");
63 dprint(FD_DISKUTIL, "%s: %s", du->path, p);
74 dprint(FD_DISKUTIL, "%s: stat read ok? %d\n", du->path, ret == 1);
80 static void update_io_tick_disk(struct disk_util *du)
85 if (!du->users)
87 if (get_io_ticks(du, &__dus))
90 dus = &du->dus;
91 ldus = &du->last_dus;
105 dus->s.msec += mtime_since(&du->time, &t);
106 memcpy(&du->time, &t, sizeof(t));
113 struct disk_util *du;
122 du = flist_entry(entry, struct disk_util, list);
123 update_io_tick_disk(du);
135 struct disk_util *du;
140 du = flist_entry(entry, struct disk_util, list);
142 if (major == du->major && minor == du->minor) {
144 return du;
282 struct disk_util *du, *__du;
288 du = smalloc(sizeof(*du));
289 if (!du) {
294 memset(du, 0, sizeof(*du));
295 INIT_FLIST_HEAD(&du->list);
296 l = snprintf(du->path, sizeof(du->path), "%s/stat", path);
297 if (l < 0 || l >= sizeof(du->path)) {
299 path, sizeof(du->path) - 1);
300 sfree(du);
303 strncpy((char *) du->dus.name, basename(path), FIO_DU_NAME_SZ - 1);
304 du->sysfs_root = path;
305 du->major = majdev;
306 du->minor = mindev;
307 INIT_FLIST_HEAD(&du->slavelist);
308 INIT_FLIST_HEAD(&du->slaves);
309 du->lock = fio_mutex_init(FIO_MUTEX_UNLOCKED);
310 du->users = 0;
319 if (!strcmp((char *) du->dus.name, (char *) __du->dus.name)) {
320 disk_util_free(du);
326 dprint(FD_DISKUTIL, "add %s to list\n", du->dus.name);
328 fio_gettime(&du->time, NULL);
329 get_io_ticks(du, &du->last_dus);
331 flist_add_tail(&du->list, &disk_list);
334 find_add_disk_slaves(td, path, du);
335 return du;
439 struct disk_util *du;
448 du = disk_util_exists(majdev, mindev);
449 if (du) {
451 td->sysfs_root = strdup(du->sysfs_root);
453 return du;
491 f->du = __init_disk_util(td, f);
563 struct disk_util *du;
565 du = flist_entry(disk_list.next, struct disk_util, list);
566 flist_del(&du->list);
567 disk_util_free(du);
666 struct disk_util *du;
671 du = flist_entry(entry, struct disk_util, list);
673 aggregate_slaves_stats(du);
674 json_array_add_disk_util(&du->dus, &du->agg, array);
681 struct disk_util *du;
700 du = flist_entry(entry, struct disk_util, list);
702 aggregate_slaves_stats(du);
703 print_disk_util(&du->dus, &du->agg, terse);