Fix recursive dump of options

If a child also had a child, we would miss it.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/parse.c b/parse.c
index 3c20312..f9e0ebe 100644
--- a/parse.c
+++ b/parse.c
@@ -579,10 +579,11 @@
 	return NULL;
 }
 
-static void print_option(struct fio_option *o, struct fio_option *org,
-			 int level)
+static void __print_option(struct fio_option *o, struct fio_option *org,
+			   int level)
 {
 	char name[256], *p;
+	int depth;
 
 	if (!o)
 		return;
@@ -590,13 +591,37 @@
 		org = o;
 	
 	p = name;
-	if (level)
-		p += sprintf(p, "%s", "    ");
+	depth = level;
+	while (depth--)
+		p += sprintf(p, "%s", "  ");
 
 	sprintf(p, "%s", o->name);
 
 	printf("%-24s: %s\n", name, o->help);
-	print_option(find_child(o, org), org, level + 1);
+}
+
+static void print_option(struct fio_option *o)
+{
+	struct fio_option *parent;
+	struct fio_option *__o;
+	unsigned int printed;
+	unsigned int level;
+
+	__print_option(o, NULL, 0);
+	parent = o;
+	level = 0;
+	do {
+		level++;
+		printed = 0;
+
+		while ((__o = find_child(o, parent)) != NULL) {
+			__print_option(__o, o, level);
+			o = __o;
+			printed++;
+		}
+
+		parent = o;
+	} while (printed);
 }
 
 int show_cmd_help(struct fio_option *options, const char *name)
@@ -635,7 +660,7 @@
 				printf("%24s: %s\n", o->name, o->help);
 			if (show_all) {
 				if (!o->parent)
-					print_option(o, NULL, 0);
+					print_option(o);
 				continue;
 			}
 		}