blob: cb15882ffe7b696cb505122d41e44aad14ac0d9b [file] [log] [blame]
Jens Axboe9f8f2062007-04-02 15:08:01 +02001#include <stdio.h>
2#include <string.h>
3#include <sys/time.h>
4#include <sys/types.h>
5#include <sys/stat.h>
6#include <dirent.h>
7#include <libgen.h>
8#include <math.h>
9
10#include "fio.h"
Jens Axboec97bd0f2009-05-27 13:11:20 +020011#include "smalloc.h"
Jens Axboe7c9b1bc2009-06-03 09:25:57 +020012#include "diskutil.h"
Jens Axboe9f8f2062007-04-02 15:08:01 +020013
14static int last_majdev, last_mindev;
Jens Axboec97bd0f2009-05-27 13:11:20 +020015static struct disk_util *last_du;
Jens Axboe9f8f2062007-04-02 15:08:01 +020016
Jens Axboe01743ee2008-06-02 12:19:19 +020017static struct flist_head disk_list = FLIST_HEAD_INIT(disk_list);
Jens Axboe9f8f2062007-04-02 15:08:01 +020018
Jens Axboec97bd0f2009-05-27 13:11:20 +020019static void disk_util_free(struct disk_util *du)
20{
21 if (du == last_du)
22 last_du = NULL;
23
24 fio_mutex_remove(du->lock);
25 sfree(du->name);
26 sfree(du);
27}
28
Jens Axboe9f8f2062007-04-02 15:08:01 +020029static int get_io_ticks(struct disk_util *du, struct disk_util_stat *dus)
30{
31 unsigned in_flight;
32 char line[256];
33 FILE *f;
34 char *p;
Jens Axboe5ec10ea2008-03-06 15:42:00 +010035 int ret;
Jens Axboe9f8f2062007-04-02 15:08:01 +020036
Jens Axboecd991b92008-03-07 13:19:35 +010037 dprint(FD_DISKUTIL, "open stat file: %s\n", du->path);
38
Jens Axboe9f8f2062007-04-02 15:08:01 +020039 f = fopen(du->path, "r");
40 if (!f)
41 return 1;
42
43 p = fgets(line, sizeof(line), f);
44 if (!p) {
45 fclose(f);
46 return 1;
47 }
48
Jens Axboecd991b92008-03-07 13:19:35 +010049 dprint(FD_DISKUTIL, "%s: %s", du->path, p);
50
51 ret = sscanf(p, "%u %u %llu %u %u %u %llu %u %u %u %u\n", &dus->ios[0],
Jens Axboe5ec10ea2008-03-06 15:42:00 +010052 &dus->merges[0], &dus->sectors[0],
53 &dus->ticks[0], &dus->ios[1],
54 &dus->merges[1], &dus->sectors[1],
55 &dus->ticks[1], &in_flight,
56 &dus->io_ticks, &dus->time_in_queue);
Jens Axboe9f8f2062007-04-02 15:08:01 +020057 fclose(f);
Jens Axboecd991b92008-03-07 13:19:35 +010058 dprint(FD_DISKUTIL, "%s: stat read ok? %d\n", du->path, ret == 1);
59 return ret != 11;
Jens Axboe9f8f2062007-04-02 15:08:01 +020060}
61
62static void update_io_tick_disk(struct disk_util *du)
63{
64 struct disk_util_stat __dus, *dus, *ldus;
65 struct timeval t;
66
67 if (get_io_ticks(du, &__dus))
68 return;
Jens Axboec97bd0f2009-05-27 13:11:20 +020069 if (!du->users)
70 return;
Jens Axboe9f8f2062007-04-02 15:08:01 +020071
72 dus = &du->dus;
73 ldus = &du->last_dus;
74
75 dus->sectors[0] += (__dus.sectors[0] - ldus->sectors[0]);
76 dus->sectors[1] += (__dus.sectors[1] - ldus->sectors[1]);
77 dus->ios[0] += (__dus.ios[0] - ldus->ios[0]);
78 dus->ios[1] += (__dus.ios[1] - ldus->ios[1]);
79 dus->merges[0] += (__dus.merges[0] - ldus->merges[0]);
80 dus->merges[1] += (__dus.merges[1] - ldus->merges[1]);
81 dus->ticks[0] += (__dus.ticks[0] - ldus->ticks[0]);
82 dus->ticks[1] += (__dus.ticks[1] - ldus->ticks[1]);
83 dus->io_ticks += (__dus.io_ticks - ldus->io_ticks);
84 dus->time_in_queue += (__dus.time_in_queue - ldus->time_in_queue);
85
86 fio_gettime(&t, NULL);
87 du->msec += mtime_since(&du->time, &t);
88 memcpy(&du->time, &t, sizeof(t));
89 memcpy(ldus, &__dus, sizeof(__dus));
90}
91
92void update_io_ticks(void)
93{
Jens Axboe01743ee2008-06-02 12:19:19 +020094 struct flist_head *entry;
Jens Axboe9f8f2062007-04-02 15:08:01 +020095 struct disk_util *du;
96
Jens Axboecd991b92008-03-07 13:19:35 +010097 dprint(FD_DISKUTIL, "update io ticks\n");
98
Jens Axboe01743ee2008-06-02 12:19:19 +020099 flist_for_each(entry, &disk_list) {
100 du = flist_entry(entry, struct disk_util, list);
Jens Axboe9f8f2062007-04-02 15:08:01 +0200101 update_io_tick_disk(du);
102 }
103}
104
Jens Axboee11c4102007-04-03 16:33:04 -0700105static struct disk_util *disk_util_exists(int major, int minor)
Jens Axboe9f8f2062007-04-02 15:08:01 +0200106{
Jens Axboe01743ee2008-06-02 12:19:19 +0200107 struct flist_head *entry;
Jens Axboe9f8f2062007-04-02 15:08:01 +0200108 struct disk_util *du;
109
Jens Axboe01743ee2008-06-02 12:19:19 +0200110 flist_for_each(entry, &disk_list) {
111 du = flist_entry(entry, struct disk_util, list);
Jens Axboe9f8f2062007-04-02 15:08:01 +0200112
113 if (major == du->major && minor == du->minor)
Jens Axboee11c4102007-04-03 16:33:04 -0700114 return du;
Jens Axboe9f8f2062007-04-02 15:08:01 +0200115 }
116
Jens Axboee11c4102007-04-03 16:33:04 -0700117 return NULL;
Jens Axboe9f8f2062007-04-02 15:08:01 +0200118}
119
Shehjar Tikoo67423012008-09-30 10:35:44 +1000120static int get_device_numbers(char *file_name, int *maj, int *min)
121{
122 struct stat st;
123 int majdev, mindev;
124 char tempname[PATH_MAX], *p;
125
126 if (!lstat(file_name, &st)) {
127 if (S_ISBLK(st.st_mode)) {
128 majdev = major(st.st_rdev);
129 mindev = minor(st.st_rdev);
130 } else if (S_ISCHR(st.st_mode)) {
131 majdev = major(st.st_rdev);
132 mindev = minor(st.st_rdev);
133 if (fio_lookup_raw(st.st_rdev, &majdev, &mindev))
134 return -1;
135 } else if (S_ISFIFO(st.st_mode))
136 return -1;
137 else {
138 majdev = major(st.st_dev);
139 mindev = minor(st.st_dev);
140 }
141 } else {
142 /*
143 * must be a file, open "." in that path
144 */
145 strncpy(tempname, file_name, PATH_MAX - 1);
146 p = dirname(tempname);
147 if (stat(p, &st)) {
148 perror("disk util stat");
149 return -1;
150 }
151
152 majdev = major(st.st_dev);
153 mindev = minor(st.st_dev);
154 }
155
156 *min = mindev;
157 *maj = majdev;
158
159 return 0;
160}
161
162static int read_block_dev_entry(char *path, int *maj, int *min)
163{
164 char line[256], *p;
165 FILE *f;
166
167 f = fopen(path, "r");
168 if (!f) {
169 perror("open path");
170 return 1;
171 }
172
173 p = fgets(line, sizeof(line), f);
174 fclose(f);
175
176 if (!p)
177 return 1;
178
179 if (sscanf(p, "%u:%u", maj, min) != 2)
180 return 1;
181
182 return 0;
183}
184
Jens Axboec97bd0f2009-05-27 13:11:20 +0200185static struct disk_util *__init_per_file_disk_util(struct thread_data *td,
186 int majdev, int mindev, char * path);
Shehjar Tikoo67423012008-09-30 10:35:44 +1000187
188static void find_add_disk_slaves(struct thread_data *td, char *path,
189 struct disk_util *masterdu)
190{
191 DIR *dirhandle = NULL;
192 struct dirent *dirent = NULL;
193 char slavesdir[PATH_MAX], temppath[PATH_MAX], slavepath[PATH_MAX];
194 struct disk_util *slavedu = NULL;
195 int majdev, mindev;
196 ssize_t linklen;
197
198 sprintf(slavesdir, "%s/%s",path, "slaves");
199 dirhandle = opendir(slavesdir);
200 if (!dirhandle)
201 return;
202
203 while ((dirent = readdir(dirhandle)) != NULL) {
204 if (!strcmp(dirent->d_name, ".") || !strcmp(dirent->d_name, ".."))
205 continue;
206
207 sprintf(temppath, "%s/%s", slavesdir, dirent->d_name);
208 /* Can we always assume that the slaves device entries
209 * are links to the real directories for the slave
210 * devices?
211 */
212 if ((linklen = readlink(temppath, slavepath, PATH_MAX-1)) < 0) {
213 perror("readlink() for slave device.");
214 return;
215 }
216 slavepath[linklen]='\0';
217
218 sprintf(temppath, "%s/%s/dev", slavesdir, slavepath);
219 if (read_block_dev_entry(temppath, &majdev, &mindev)) {
220 perror("Error getting slave device numbers.");
221 return;
222 }
223
224 sprintf(temppath, "%s/%s", slavesdir, slavepath);
225 __init_per_file_disk_util(td, majdev, mindev, temppath);
226 slavedu = disk_util_exists(majdev, mindev);
227
228 /* Should probably use an assert here. slavedu should
229 * always be present at this point. */
230 if (slavedu)
231 flist_add_tail(&slavedu->slavelist, &masterdu->slaves);
232 }
233
234 closedir(dirhandle);
235 return;
236}
237
Jens Axboec97bd0f2009-05-27 13:11:20 +0200238static struct disk_util *disk_util_add(struct thread_data * td, int majdev,
239 int mindev, char *path)
Jens Axboe9f8f2062007-04-02 15:08:01 +0200240{
241 struct disk_util *du, *__du;
Jens Axboe01743ee2008-06-02 12:19:19 +0200242 struct flist_head *entry;
Jens Axboe9f8f2062007-04-02 15:08:01 +0200243
Jens Axboecd991b92008-03-07 13:19:35 +0100244 dprint(FD_DISKUTIL, "add maj/min %d/%d: %s\n", majdev, mindev, path);
245
Jens Axboec97bd0f2009-05-27 13:11:20 +0200246 du = smalloc(sizeof(*du));
Jens Axboe9f8f2062007-04-02 15:08:01 +0200247 memset(du, 0, sizeof(*du));
Jens Axboe01743ee2008-06-02 12:19:19 +0200248 INIT_FLIST_HEAD(&du->list);
Jens Axboe9f8f2062007-04-02 15:08:01 +0200249 sprintf(du->path, "%s/stat", path);
Jens Axboec97bd0f2009-05-27 13:11:20 +0200250 du->name = smalloc_strdup(basename(path));
Jens Axboee11c4102007-04-03 16:33:04 -0700251 du->sysfs_root = path;
Jens Axboe9f8f2062007-04-02 15:08:01 +0200252 du->major = majdev;
253 du->minor = mindev;
Shehjar Tikoo67423012008-09-30 10:35:44 +1000254 INIT_FLIST_HEAD(&du->slavelist);
255 INIT_FLIST_HEAD(&du->slaves);
Jens Axboec97bd0f2009-05-27 13:11:20 +0200256 du->lock = fio_mutex_init(1);
257 du->users = 0;
Jens Axboe9f8f2062007-04-02 15:08:01 +0200258
Jens Axboe01743ee2008-06-02 12:19:19 +0200259 flist_for_each(entry, &disk_list) {
260 __du = flist_entry(entry, struct disk_util, list);
Jens Axboe9f8f2062007-04-02 15:08:01 +0200261
Jens Axboecd991b92008-03-07 13:19:35 +0100262 dprint(FD_DISKUTIL, "found %s in list\n", __du->name);
263
Jens Axboe9f8f2062007-04-02 15:08:01 +0200264 if (!strcmp(du->name, __du->name)) {
Jens Axboec97bd0f2009-05-27 13:11:20 +0200265 disk_util_free(du);
266 return __du;
Jens Axboe9f8f2062007-04-02 15:08:01 +0200267 }
268 }
269
Jens Axboecd991b92008-03-07 13:19:35 +0100270 dprint(FD_DISKUTIL, "add %s to list\n", du->name);
271
Jens Axboe9f8f2062007-04-02 15:08:01 +0200272 fio_gettime(&du->time, NULL);
273 get_io_ticks(du, &du->last_dus);
274
Jens Axboe01743ee2008-06-02 12:19:19 +0200275 flist_add_tail(&du->list, &disk_list);
Shehjar Tikoo67423012008-09-30 10:35:44 +1000276 find_add_disk_slaves(td, path, du);
Jens Axboec97bd0f2009-05-27 13:11:20 +0200277 return du;
Jens Axboe9f8f2062007-04-02 15:08:01 +0200278}
279
Shehjar Tikoo67423012008-09-30 10:35:44 +1000280
Jens Axboe9f8f2062007-04-02 15:08:01 +0200281static int check_dev_match(int majdev, int mindev, char *path)
282{
283 int major, minor;
Jens Axboe9f8f2062007-04-02 15:08:01 +0200284
Shehjar Tikoo67423012008-09-30 10:35:44 +1000285 if (read_block_dev_entry(path, &major, &minor))
Jens Axboe9f8f2062007-04-02 15:08:01 +0200286 return 1;
Jens Axboe9f8f2062007-04-02 15:08:01 +0200287
Jens Axboec97bd0f2009-05-27 13:11:20 +0200288 if (majdev == major && mindev == minor)
Jens Axboe9f8f2062007-04-02 15:08:01 +0200289 return 0;
Jens Axboe9f8f2062007-04-02 15:08:01 +0200290
Jens Axboe9f8f2062007-04-02 15:08:01 +0200291 return 1;
292}
293
Jens Axboeac0be2a2008-06-06 12:08:04 +0200294static int find_block_dir(int majdev, int mindev, char *path, int link_ok)
Jens Axboe9f8f2062007-04-02 15:08:01 +0200295{
296 struct dirent *dir;
297 struct stat st;
298 int found = 0;
299 DIR *D;
300
301 D = opendir(path);
302 if (!D)
303 return 0;
304
305 while ((dir = readdir(D)) != NULL) {
306 char full_path[256];
307
308 if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, ".."))
309 continue;
310
311 sprintf(full_path, "%s/%s", path, dir->d_name);
312
313 if (!strcmp(dir->d_name, "dev")) {
314 if (!check_dev_match(majdev, mindev, full_path)) {
315 found = 1;
316 break;
317 }
318 }
319
Jens Axboeac0be2a2008-06-06 12:08:04 +0200320 if (link_ok) {
321 if (stat(full_path, &st) == -1) {
322 perror("stat");
323 break;
324 }
325 } else {
326 if (lstat(full_path, &st) == -1) {
327 perror("stat");
328 break;
329 }
Jens Axboe9f8f2062007-04-02 15:08:01 +0200330 }
331
332 if (!S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode))
333 continue;
334
Jens Axboeac0be2a2008-06-06 12:08:04 +0200335 found = find_block_dir(majdev, mindev, full_path, 0);
Jens Axboe9f8f2062007-04-02 15:08:01 +0200336 if (found) {
337 strcpy(path, full_path);
338 break;
339 }
340 }
341
342 closedir(D);
343 return found;
344}
345
Jens Axboec97bd0f2009-05-27 13:11:20 +0200346static struct disk_util *__init_per_file_disk_util(struct thread_data *td,
347 int majdev, int mindev,
348 char *path)
Jens Axboe9f8f2062007-04-02 15:08:01 +0200349{
350 struct stat st;
Shehjar Tikoo67423012008-09-30 10:35:44 +1000351 char tmp[PATH_MAX];
Jens Axboe9f8f2062007-04-02 15:08:01 +0200352 char *p;
353
Shehjar Tikoo67423012008-09-30 10:35:44 +1000354 /*
355 * If there's a ../queue/ directory there, we are inside a partition.
356 * Check if that is the case and jump back. For loop/md/dm etc we
357 * are already in the right spot.
358 */
359 sprintf(tmp, "%s/../queue", path);
360 if (!stat(tmp, &st)) {
361 p = dirname(path);
362 sprintf(tmp, "%s/queue", p);
363 if (stat(tmp, &st)) {
364 log_err("unknown sysfs layout\n");
Jens Axboec97bd0f2009-05-27 13:11:20 +0200365 return NULL;
Jens Axboe9f8f2062007-04-02 15:08:01 +0200366 }
Shehjar Tikoo67423012008-09-30 10:35:44 +1000367 strncpy(tmp, p, PATH_MAX - 1);
368 sprintf(path, "%s", tmp);
Jens Axboe9f8f2062007-04-02 15:08:01 +0200369 }
370
Shehjar Tikoo67423012008-09-30 10:35:44 +1000371 if (td->o.ioscheduler && !td->sysfs_root)
372 td->sysfs_root = strdup(path);
373
Jens Axboec97bd0f2009-05-27 13:11:20 +0200374 return disk_util_add(td, majdev, mindev, path);
Shehjar Tikoo67423012008-09-30 10:35:44 +1000375}
376
Jens Axboec97bd0f2009-05-27 13:11:20 +0200377static struct disk_util *init_per_file_disk_util(struct thread_data *td,
378 char *filename)
Shehjar Tikoo67423012008-09-30 10:35:44 +1000379{
380
381 char foo[PATH_MAX];
382 struct disk_util *du;
383 int mindev, majdev;
384
Jens Axboec97bd0f2009-05-27 13:11:20 +0200385 if (get_device_numbers(filename, &majdev, &mindev))
386 return NULL;
Shehjar Tikoo67423012008-09-30 10:35:44 +1000387
388 dprint(FD_DISKUTIL, "%s belongs to maj/min %d/%d\n", filename, majdev,
389 mindev);
Jens Axboecd991b92008-03-07 13:19:35 +0100390
Jens Axboee11c4102007-04-03 16:33:04 -0700391 du = disk_util_exists(majdev, mindev);
392 if (du) {
393 if (td->o.ioscheduler && !td->sysfs_root)
394 td->sysfs_root = strdup(du->sysfs_root);
395
Jens Axboec97bd0f2009-05-27 13:11:20 +0200396 return du;
Jens Axboee11c4102007-04-03 16:33:04 -0700397 }
Jens Axboe9f8f2062007-04-02 15:08:01 +0200398
399 /*
400 * for an fs without a device, we will repeatedly stat through
401 * sysfs which can take oodles of time for thousands of files. so
402 * cache the last lookup and compare with that before going through
403 * everything again.
404 */
405 if (mindev == last_mindev && majdev == last_majdev)
Jens Axboec97bd0f2009-05-27 13:11:20 +0200406 return last_du;
Jens Axboe9f8f2062007-04-02 15:08:01 +0200407
408 last_mindev = mindev;
409 last_majdev = majdev;
Jens Axboe5ec10ea2008-03-06 15:42:00 +0100410
Jens Axboe9f8f2062007-04-02 15:08:01 +0200411 sprintf(foo, "/sys/block");
Jens Axboeac0be2a2008-06-06 12:08:04 +0200412 if (!find_block_dir(majdev, mindev, foo, 1))
Jens Axboec97bd0f2009-05-27 13:11:20 +0200413 return NULL;
Jens Axboe9f8f2062007-04-02 15:08:01 +0200414
Jens Axboec97bd0f2009-05-27 13:11:20 +0200415 return __init_per_file_disk_util(td, majdev, mindev, foo);
Shehjar Tikoo67423012008-09-30 10:35:44 +1000416}
Jens Axboe9f8f2062007-04-02 15:08:01 +0200417
Jens Axboec97bd0f2009-05-27 13:11:20 +0200418static struct disk_util *__init_disk_util(struct thread_data *td,
419 struct fio_file *f)
Shehjar Tikoo67423012008-09-30 10:35:44 +1000420{
421 return init_per_file_disk_util(td, f->file_name);
Jens Axboe9f8f2062007-04-02 15:08:01 +0200422}
423
424void init_disk_util(struct thread_data *td)
425{
426 struct fio_file *f;
427 unsigned int i;
428
429 if (!td->o.do_disk_util ||
430 (td->io_ops->flags & (FIO_DISKLESSIO | FIO_NODISKUTIL)))
431 return;
432
433 for_each_file(td, f, i)
Jens Axboec97bd0f2009-05-27 13:11:20 +0200434 f->du = __init_disk_util(td, f);
Jens Axboe9f8f2062007-04-02 15:08:01 +0200435}
436
Shehjar Tikoo043b74b2008-09-30 11:11:35 +1000437static void aggregate_slaves_stats(struct disk_util *masterdu)
438{
439 struct disk_util_stat *dus;
440 struct flist_head *entry;
441 struct disk_util *slavedu;
442 double util, max_util = 0;
443 int slavecount = 0;
444
Jens Axboe5e28df32008-09-30 08:39:17 +0200445 unsigned merges[2] = { 0, };
446 unsigned ticks[2] = { 0, };
447 unsigned time_in_queue = { 0, };
448 unsigned long long sectors[2] = { 0, };
449 unsigned ios[2] = { 0, };
Shehjar Tikoo043b74b2008-09-30 11:11:35 +1000450
451 flist_for_each(entry, &masterdu->slaves) {
452 slavedu = flist_entry(entry, struct disk_util, slavelist);
453 dus = &slavedu->dus;
454 ios[0] += dus->ios[0];
455 ios[1] += dus->ios[1];
456 merges[0] += dus->merges[0];
457 merges[1] += dus->merges[1];
458 sectors[0] += dus->sectors[0];
459 sectors[1] += dus->sectors[1];
460 ticks[0] += dus->ticks[0];
461 ticks[1] += dus->ticks[1];
462 time_in_queue += dus->time_in_queue;
463 ++slavecount;
464
465 util = (double) (100 * dus->io_ticks / (double) slavedu->msec);
466 /* System utilization is the utilization of the
467 * component with the highest utilization.
468 */
469 if (util > max_util)
470 max_util = util;
471
472 }
473
474 if (max_util > 100.0)
475 max_util = 100.0;
476
477 log_info(", aggrios=%u/%u, aggrmerge=%u/%u, aggrticks=%u/%u,"
478 " aggrin_queue=%u, aggrutil=%3.2f%%",
479 ios[0]/slavecount, ios[1]/slavecount,
480 merges[0]/slavecount, merges[1]/slavecount,
481 ticks[0]/slavecount, ticks[1]/slavecount,
482 time_in_queue/slavecount, max_util);
483
484}
485
Jens Axboe9f8f2062007-04-02 15:08:01 +0200486void show_disk_util(void)
487{
488 struct disk_util_stat *dus;
Jens Axboe01743ee2008-06-02 12:19:19 +0200489 struct flist_head *entry, *next;
Jens Axboe9f8f2062007-04-02 15:08:01 +0200490 struct disk_util *du;
491 double util;
492
Jens Axboe01743ee2008-06-02 12:19:19 +0200493 if (flist_empty(&disk_list))
Jens Axboe0a839f32007-04-26 09:02:34 +0200494 return;
495
Jens Axboe9f8f2062007-04-02 15:08:01 +0200496 log_info("\nDisk stats (read/write):\n");
497
Jens Axboe01743ee2008-06-02 12:19:19 +0200498 flist_for_each(entry, &disk_list) {
499 du = flist_entry(entry, struct disk_util, list);
Jens Axboe9f8f2062007-04-02 15:08:01 +0200500 dus = &du->dus;
501
502 util = (double) 100 * du->dus.io_ticks / (double) du->msec;
503 if (util > 100.0)
504 util = 100.0;
505
Shehjar Tikoo67423012008-09-30 10:35:44 +1000506 /* If this node is the slave of a master device, as
507 * happens in case of software RAIDs, inward-indent
508 * this stats line to reflect a master-slave
509 * relationship. Because the master device gets added
510 * before the slave devices, we can safely assume that
511 * the master's stats line has been displayed in a
512 * previous iteration of this loop.
513 */
514 if(!flist_empty(&du->slavelist))
515 log_info(" ");
516
Jens Axboe5ec10ea2008-03-06 15:42:00 +0100517 log_info(" %s: ios=%u/%u, merge=%u/%u, ticks=%u/%u, "
Shehjar Tikoo043b74b2008-09-30 11:11:35 +1000518 "in_queue=%u, util=%3.2f%%", du->name,
Jens Axboe5ec10ea2008-03-06 15:42:00 +0100519 dus->ios[0], dus->ios[1],
520 dus->merges[0], dus->merges[1],
521 dus->ticks[0], dus->ticks[1],
522 dus->time_in_queue, util);
Shehjar Tikoo043b74b2008-09-30 11:11:35 +1000523
524 /* If the device has slaves, aggregate the stats for
525 * those slave devices also.
526 */
527 if(!flist_empty(&du->slaves))
528 aggregate_slaves_stats(du);
529
530 log_info("\n");
Jens Axboe9f8f2062007-04-02 15:08:01 +0200531 }
532
533 /*
534 * now free the list
535 */
Jens Axboe01743ee2008-06-02 12:19:19 +0200536 flist_for_each_safe(entry, next, &disk_list) {
537 flist_del(entry);
538 du = flist_entry(entry, struct disk_util, list);
Jens Axboec97bd0f2009-05-27 13:11:20 +0200539 disk_util_free(du);
Jens Axboe9f8f2062007-04-02 15:08:01 +0200540 }
541}