Commit e3cc1091 authored by Philip Carns's avatar Philip Carns

fix previous st dev workaround to be configurable, and to still use normal

file stat for block size 


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@560 3b7491f3-a168-0410-bf4b-c445ed680a29
parent ba069024
......@@ -665,6 +665,7 @@ with_zlib_for_mpi
with_zlib
enable_cuserid
enable_ld_preload
enable_st_dev_workaround
with_mem_align
with_log_path_by_env
with_log_hints
......@@ -1293,6 +1294,7 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-cuserid Disables attempted use of cuserid() at run time
--disable-ld-preload Disables support for LD_PRELOAD library
--enable-st-dev-workaround Gather device id from parent directory instead of file
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
......@@ -3620,6 +3622,19 @@ fi
fi
# Check whether --enable-st-dev-workaround was given.
if test "${enable_st_dev_workaround+set}" = set; then :
enableval=$enable_st_dev_workaround; if test "x$enableval" = "xyes" ; then
$as_echo "#define __CP_ST_DEV_WORKAROUND 1" >>confdefs.h
DISABLE_LDPRELOAD="1"
fi
fi
# Check whether --with-mem-align was given.
if test "${with_mem_align+set}" = set; then :
......
......@@ -43,6 +43,15 @@ AC_ARG_ENABLE(ld-preload,
fi]
,)
AC_ARG_ENABLE(st-dev-workaround,
[ --enable-st-dev-workaround Gather device id from parent directory instead of file],
[if test "x$enableval" = "xyes" ; then
AC_DEFINE(__CP_ST_DEV_WORKAROUND, 1, Define if device id should be taken from parent directory rather than file)
DISABLE_LDPRELOAD="1"
fi]
,)
AC_ARG_WITH(mem-align,
[ --with-mem-align=<num> Memory alignment in bytes],
if test x$withval = xyes; then
......
......@@ -96,5 +96,9 @@
/* Memory alignment in bytes */
#undef __CP_MEM_ALIGNMENT
/* Define if device id should be taken from parent directory rather than file
*/
#undef __CP_ST_DEV_WORKAROUND
/* Generalized request type for MPI-IO */
#undef __D_MPI_REQUEST
......@@ -255,6 +255,24 @@ static void cp_access_counter(struct darshan_file_runtime* file, ssize_t size,
CP_INC(__file, CP_POSIX_STATS, 1); \
} while(0)
static inline dev_t get_device(const char* path, struct stat64* statbuf)
{
dev_t device = 0;
#ifdef __CP_ST_DEV_WORKAROUND
struct stat64 dirstat;
char* tmp_path = strdup(path);
char* parent = dirname(tmp_path);
if(parent && stat64(parent, &dirstat) == 0)
device = dirstat.st_dev;
if(tmp_path) free(tmp_path);
#else
device = statbuf->st_dev;
#endif
return(device);
}
#define CP_RECORD_OPEN(__ret, __path, __mode, __stream_flag, __tm1, __tm2) do { \
struct darshan_file_runtime* file; \
char* exclude; \
......@@ -272,14 +290,11 @@ static void cp_access_counter(struct darshan_file_runtime* file, ssize_t size,
if(file->fd != -1) break; /* TODO: handle multiple concurrent opens */ \
file->fd = __ret; \
if(!CP_VALUE(file, CP_FILE_ALIGNMENT)){ \
char* __tmp_path = strdup(__path); \
char* __parent = dirname(__tmp_path); \
if(__parent && stat64(__parent, &cp_stat_buf) == 0) {\
CP_SET(file, CP_DEVICE, cp_stat_buf.st_dev); \
if(stat64(__path, &cp_stat_buf) == 0) { \
CP_SET(file, CP_DEVICE, get_device(__path, &cp_stat_buf)); \
CP_SET(file, CP_FILE_ALIGNMENT, cp_stat_buf.st_blksize); \
CP_SET(file, CP_SIZE_AT_OPEN, cp_stat_buf.st_size); \
}\
if(__tmp_path) free(__tmp_path); \
}\
file->log_file->rank = my_rank; \
if(__mode) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment