From d07f439ead57caecbcf4e049d322c17be92bc99b Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 31 May 2006 20:43:01 +0200 Subject: [PATCH] [PATCH] Fixup stat queue file read Apparently a stat file got added to the partition directory as well, which broke the lookup. --- fio.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/fio.c b/fio.c index e48a060e..df284581 100644 --- a/fio.c +++ b/fio.c @@ -1739,23 +1739,19 @@ static void init_disk_util(struct thread_data *td) return; /* - * for md/dm, there's no queue dir. we already have the right place + * If there's a ../queue/ directory there, we are inside a partition. + * Check if that is the case and jump back. For loop/md/dm etc we + * are already in the right spot. */ - sprintf(tmp, "%s/stat", foo); - if (stat(tmp, &st)) { - /* - * if this is inside a partition dir, jump back to parent - */ - sprintf(tmp, "%s/queue", foo); + sprintf(tmp, "%s/../queue", foo); + if (!stat(tmp, &st)) { + p = dirname(foo); + sprintf(tmp, "%s/queue", p); if (stat(tmp, &st)) { - p = dirname(foo); - sprintf(tmp, "%s/queue", p); - if (stat(tmp, &st)) { - fprintf(stderr, "unknown sysfs layout\n"); - return; - } - sprintf(foo, "%s", p); + fprintf(stderr, "unknown sysfs layout\n"); + return; } + sprintf(foo, "%s", p); } disk_util_add(dev, foo); -- 2.25.1