diff --git a/.gitignore b/.gitignore index eb59cf7..5a61c7f 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ src/Makefile.in src/config.h src/config.h.in src/stamp-h1 +*[-.]mod *~ NOTES.txt autom4te.cache diff --git a/configure.ac b/configure.ac index f6b958b..537021b 100755 --- a/configure.ac +++ b/configure.ac @@ -83,7 +83,7 @@ AC_ARG_WITH([lustre], [AS_HELP_STRING([--with-lustre], [support configurable Lustre striping values @<:@default=check@:>@])], [], [with_lustre=check]) -AS_IF([test "x$with_lustre" != xno], [ +AS_IF([test "x$with_lustre" = xyes ], [ AC_CHECK_HEADERS([linux/lustre/lustre_user.h lustre/lustre_user.h], break, [ if test "x$with_lustre" != xcheck -a \ "x$ac_cv_header_linux_lustre_lustre_user_h" = "xno" -a \ @@ -91,6 +91,17 @@ AS_IF([test "x$with_lustre" != xno], [ AC_MSG_FAILURE([--with-lustre was given, not found]) fi ]) + AC_CHECK_HEADERS([linux/lustre/lustreapi.h lustre/lustreapi.h], break, [ + if test "x$with_lustre" != xcheck -a \ + "x$ac_cv_header_linux_lustre_lustreapi_h" = "xno" -a \ + "x$ac_cv_header_lustre_lustreapi_h" = "xno" ; then + AC_MSG_FAILURE([--with-lustre was given, not found]) + fi + ]) +]) +AM_CONDITIONAL([WITH_LUSTRE], [test x$with_lustre = xyes]) +AM_COND_IF([WITH_LUSTRE],[ + AC_DEFINE([WITH_LUSTRE], [], [Build wth LUSTRE backend]) ]) # IME (DDN's Infinite Memory Engine) support diff --git a/doc/mdtest.1 b/doc/mdtest.1 index ba82d88..3cfc082 100644 --- a/doc/mdtest.1 +++ b/doc/mdtest.1 @@ -47,6 +47,9 @@ The first number of tasks on which the test will run .I "-F" Perform test on files only (no directories). .TP +.I "-g" +Use global default directory layout for test subdirectories (deletes inherited striping layout - Lustre only). +.TP .I "-h" Display help message. .TP diff --git a/src/Makefile.am b/src/Makefile.am index 0de3b4b..56b4279 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -91,6 +91,10 @@ extraLDADD += -laws4c extraLDADD += -laws4c_extra endif +if WITH_LUSTRE +extraLDADD += -llustreapi +endif + ior_SOURCES += $(extraSOURCES) ior_LDFLAGS += $(extraLDFLAGS) ior_LDADD += $(extraLDADD) diff --git a/src/mdtest.c b/src/mdtest.c index 17f6e5c..444f391 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -76,6 +76,10 @@ #include +#ifdef HAVE_LUSTRE_LUSTREAPI_H +#include +#endif /* HAVE_LUSTRE_LUSTREAPI_H */ + #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 #define RELEASE_VERS META_VERSION @@ -152,6 +156,9 @@ static int call_sync; static int path_count; static int nstride; /* neighbor stride */ static int make_node = 0; +#ifdef HAVE_LUSTRE_LUSTREAPI_H +static int global_dir_layout; +#endif /* HAVE_LUSTRE_LUSTREAPI_H */ static mdtest_results_t * summary_table; static pid_t pid; @@ -1575,6 +1582,15 @@ void create_remove_directory_tree(int create, if (-1 == backend->mkdir (dir, DIRMODE, ¶m)) { fprintf(out_logfile, "error could not create directory '%s'\n", dir); } +#ifdef HAVE_LUSTRE_LUSTREAPI_H + /* internal node for branching, can be non-striped for children */ + if (global_dir_layout && \ + llapi_dir_set_default_lmv_stripe(dir, -1, 0, + LMV_HASH_TYPE_FNV_1A_64, + NULL) == -1) { + FAIL("Unable to reset to global default directory layout"); + } +#endif /* HAVE_LUSTRE_LUSTREAPI_H */ } create_remove_directory_tree(create, ++currDepth, dir, ++dirNum, progress); @@ -1641,6 +1657,12 @@ static void mdtest_iteration(int i, int j, MPI_Group testgroup, mdtest_results_t if (backend->mkdir(testdir, DIRMODE, ¶m) != 0) { FAIL("Unable to create test directory %s", testdir); } +#ifdef HAVE_LUSTRE_LUSTREAPI_H + /* internal node for branching, can be non-striped for children */ + if (global_dir_layout && unique_dir_per_task && llapi_dir_set_default_lmv_stripe(testdir, -1, 0, LMV_HASH_TYPE_FNV_1A_64, NULL) == -1) { + FAIL("Unable to reset to global default directory layout"); + } +#endif /* HAVE_LUSTRE_LUSTREAPI_H */ } } @@ -1859,6 +1881,9 @@ void mdtest_init_args(){ path_count = 0; nstride = 0; make_node = 0; +#ifdef HAVE_LUSTRE_LUSTREAPI_H + global_dir_layout = 0; +#endif /* HAVE_LUSTRE_LUSTREAPI_H */ } mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * world_out) { @@ -1905,6 +1930,9 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * {'e', NULL, "bytes to read from each file", OPTION_OPTIONAL_ARGUMENT, 'l', & read_bytes}, {'f', NULL, "first number of tasks on which the test will run", OPTION_OPTIONAL_ARGUMENT, 'd', & first}, {'F', NULL, "perform test on files only (no directories)", OPTION_FLAG, 'd', & files_only}, +#ifdef HAVE_LUSTRE_LUSTREAPI_H + {'g', NULL, "global default directory layout for test subdirectories (deletes inherited striping layout)", OPTION_FLAG, 'd', & global_dir_layout}, +#endif /* HAVE_LUSTRE_LUSTREAPI_H */ {'i', NULL, "number of iterations the test will run", OPTION_OPTIONAL_ARGUMENT, 'd', & iterations}, {'I', NULL, "number of items per directory in tree", OPTION_OPTIONAL_ARGUMENT, 'l', & items_per_dir}, {'k', NULL, "use mknod to create file", OPTION_FLAG, 'd', & make_node}, @@ -1998,6 +2026,9 @@ mdtest_results_t * mdtest_run(int argc, char **argv, MPI_Comm world_com, FILE * VERBOSE(1,-1, "read_only : %s", ( read_only ? "True" : "False" )); VERBOSE(1,-1, "first : %d", first ); VERBOSE(1,-1, "files_only : %s", ( files_only ? "True" : "False" )); +#ifdef HAVE_LUSTRE_LUSTREAPI_H + VERBOSE(1,-1, "global_dir_layout : %s", ( global_dir_layout ? "True" : "False" )); +#endif /* HAVE_LUSTRE_LUSTREAPI_H */ VERBOSE(1,-1, "iterations : %d", iterations ); VERBOSE(1,-1, "items_per_dir : "LLU"", items_per_dir ); VERBOSE(1,-1, "last : %d", last );