--- ./mdtest-1.8.3/mdtest.c 2010-05-12 05:25:16.000000000 +0800 +++ ./mdtest_lustre/mdtest.c 2012-02-02 21:27:55.000000000 +0800 @@ -41,13 +41,44 @@ #else #include #endif +#include #include #include #include #include #include #include +#include #include +#ifndef HAVE___S8 +typedef __signed__ char __s8; +#endif +#ifndef HAVE___U8 +typedef unsigned char __u8; +#endif + +#ifndef HAVE___S16 +typedef __signed__ short __s16; +#endif +#ifndef HAVE___U16 +typedef unsigned short __u16; +#endif + +#ifndef HAVE___S32 +typedef __signed__ int __s32; +#endif +#ifndef HAVE___U32 +typedef unsigned int __u32; +#endif + +#ifndef HAVE___S64 +typedef __signed__ long long __s64; +#endif +#ifndef HAVE___U64 +typedef unsigned long long __u64; +#endif + +#include #define FILEMODE S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH #define DIRMODE S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IXOTH @@ -104,6 +135,8 @@ int write_bytes = 0; int sync_file = 0; int path_count = 0; int nstride = 0; /* neighbor stride */ +int make_node = 0; +int delay_obj = 0; MPI_Comm testcomm; table_t * summary_table; @@ -304,14 +337,31 @@ void create_remove_items_helper(int dirs FAIL("unable to open file"); } } else { + unsigned myflags = O_CREAT|O_RDWR; + + if (delay_obj) + myflags |= O_LOV_DELAY_CREATE; + if (shared_file) { - if ((fd = open(curr_item, - O_CREAT|O_RDWR, FILEMODE)) == -1) { + if ((fd = open(curr_item, + myflags, FILEMODE)) == -1) { FAIL("unable to create file"); - } + } } else { - if ((fd = creat(curr_item, FILEMODE)) == -1) { - FAIL("unable to create file"); + if (make_node) { + fd = mknod(curr_item, S_IFREG | S_IRUSR, 0); + if (fd != 0) { + FAIL("unable to mknod"); + } + } else if (!delay_obj) { + if ((fd = creat(curr_item, FILEMODE)) == -1) { + FAIL("unable to create file"); + } + } else { + if ((fd = open(curr_item, + myflags, FILEMODE)) == -1) { + FAIL("unable to create file with delay obj"); + } } } } @@ -325,7 +375,7 @@ void create_remove_items_helper(int dirs FAIL("unable to sync file"); } - if (close(fd) == -1) { + if (!make_node && close(fd) == -1) { FAIL("unable to close file"); } @@ -900,6 +950,7 @@ void print_help() { " [-n number_of_items] [-N stride_length] [-p seconds] [-r]", " [-R[seed]] [-s stride] [-S] [-t] [-T] [-u] [-v]", " [-V verbosity_value] [-w number_of_bytes_to_write] [-y] [-z depth]", +"\t-a: make node", "\t-b: branching factor of hierarchical directory structure", "\t-B: no barriers between phases", "\t-c: collective creates: task 0 does all creates", @@ -915,6 +966,7 @@ void print_help() { "\t-L: files only at leaf level of tree", "\t-n: every process will creat/stat/remove # directories and files", "\t-N: stride # between neighbor tasks for file/dir stat (local=0)", +"\t-o: create object without OST object", "\t-p: pre-iteration delay (in seconds)", "\t-r: only remove files or directories left behind by previous runs", "\t-R: randomly stat files (optional argument for random seed)", @@ -1378,12 +1430,14 @@ int main(int argc, char **argv) { /* Parse command line options */ while (1) { - c = getopt(argc, argv, "b:BcCd:Df:Fhi:I:l:Ln:N:p:rR::s:StTuvV:w:yz:"); + c = getopt(argc, argv, "ab:BcCd:Df:Fhi:I:l:Ln:N:op:rR::s:StTuvV:w:yz:"); if (c == -1) { break; } switch (c) { + case 'a': + make_node = 1; break; case 'b': branch_factor = atoi(optarg); break; case 'B': @@ -1414,6 +1468,8 @@ int main(int argc, char **argv) { items = atoi(optarg); break; case 'N': nstride = atoi(optarg); break; + case 'o': + delay_obj = 1; break; case 'p': pre_delay = atoi(optarg); break; case 'r': @@ -1614,8 +1670,9 @@ int main(int argc, char **argv) { if (chdir(testdir) == -1) { FAIL("Unable to change to test directory"); } - /* create hierarchical directory structure */ - MPI_Barrier(MPI_COMM_WORLD); + + /* create hierarchical directory structure */ + MPI_Barrier(MPI_COMM_WORLD); if (create_only) { startCreate = MPI_Wtime(); if (unique_dir_per_task) {