From: braam Date: Thu, 7 Nov 2002 18:25:21 +0000 (+0000) Subject: - new test program to make many files fast X-Git-Tag: v1_7_100~1^90~144 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=aede4dc0a056709680998f7d7482868024442d7c;p=fs%2Flustre-release.git - new test program to make many files fast --- diff --git a/lustre/tests/createmany.c b/lustre/tests/createmany.c new file mode 100644 index 0000000..27ba3f7 --- /dev/null +++ b/lustre/tests/createmany.c @@ -0,0 +1,38 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char ** argv) +{ + int i, rc, count; + char filename[4096]; + + if (argc < 3) { + printf("Usage %s filenamebase count\n", argv[0]); + return 1; + } + + if (strlen(argv[1]) > 4080) { + printf("name too long\n"); + return 1; + } + + count = strtoul(argv[2], NULL, 0); + + + for (i=0 ; i < count ; i++) { + sprintf(filename, "%s-%d", argv[1], i); + rc = mknod(filename, S_IFREG| 0444, 0); + if (rc) { + printf("mknod(%s) error: %s\n", + filename, strerror(errno)); + break; + } + } + return rc; +}