Skip to content

Commit

Permalink
Added "-f" flag to optionally format OSD drive before tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joc02012 committed Feb 9, 2013
1 parent 4856534 commit a6a348e
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions osd-initiator/tests/iospeed.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ static void write_bw(int fd, uint64_t pid, uint64_t oid,

static void usage(void)
{
fprintf(stderr, "Usage: %s [<size in kbytes>]\n", osd_get_progname());
fprintf(stderr, "Usage: %s [-f] [<size>]\n", osd_get_progname());
fprintf(stderr, " -f format and create partition before test\n");
fprintf(stderr, " size i/o size in kbytes\n");
exit(1);
}

Expand All @@ -226,18 +228,23 @@ int main(int argc, char *argv[])
const int iter = 100;
uint64_t oid;
int onesize = 0;
int doformat = 0;

osd_set_progname(argc, argv);

if (argc == 1) {
;
} else if (argc == 2) {
argc--;
argv++;
for (i=0; argc && i<2; argc--, argv++, i++) {
if (strcmp(argv[0], "-f") == 0) {
doformat = 1;
continue;
}
char *cp;
onesize = strtoul(argv[1], &cp, 0);
if (*cp != '\0')
usage();
onesize = strtoul(argv[0], &cp, 0);
if (*cp != '\0') break;
onesize <<= 10;
} else {
}
if (argc) {
usage();
}

Expand All @@ -262,8 +269,10 @@ int main(int argc, char *argv[])

inquiry(fd);

format_osd(fd, 1<<30);
create_partition(fd, PARTITION_PID_LB);
if (doformat) {
format_osd(fd, 1<<30);
create_partition(fd, PARTITION_PID_LB);
}

oid = obj_create_any(fd, PARTITION_PID_LB);

Expand Down

0 comments on commit a6a348e

Please sign in to comment.