diff --git a/darshan-runtime/lib/darshan-lustre.c b/darshan-runtime/lib/darshan-lustre.c index aed5e6a75612c39cc23111bea48cff8e0f90a495..c02c81742ac0822f5364e0a070da7a1702929032 100644 --- a/darshan-runtime/lib/darshan-lustre.c +++ b/darshan-runtime/lib/darshan-lustre.c @@ -57,14 +57,29 @@ void darshan_instrument_lustre_file(const char* filepath, int fd) size_t lumsize = sizeof(struct lov_user_md) + LOV_MAX_STRIPE_COUNT * sizeof(struct lov_user_ost_data); size_t rec_size; + char *newname = NULL; LUSTRE_LOCK(); + if(instrumentation_disabled) + { + LUSTRE_UNLOCK(); + return; + } + /* make sure the lustre module is already initialized */ lustre_runtime_initialize(); + if(!lustre_runtime) + { + LUSTRE_UNLOCK(); + return; + } /* if we can't issue ioctl, we have no counter data at all */ if ( (lum = calloc(1, lumsize)) == NULL ) + { + LUSTRE_UNLOCK(); return; + } /* find out the OST count of this file so we can allocate memory */ lum->lmm_magic = LOV_USER_MAGIC; @@ -74,11 +89,17 @@ void darshan_instrument_lustre_file(const char* filepath, int fd) if ( ioctl( fd, LL_IOC_LOV_GETSTRIPE, (void *)lum ) == -1 ) { free(lum); + LUSTRE_UNLOCK(); return; } rec_size = LUSTRE_RECORD_SIZE( lum->lmm_stripe_count ); + /* get fully qualified name for record */ + newname = darshan_clean_file_path(filepath); + if(!newname) + newname = (char*)filepath; + { /* broken out for clarity */ void *end_of_new_record = (char*)lustre_runtime->next_free_record + rec_size; @@ -89,8 +110,8 @@ void darshan_instrument_lustre_file(const char* filepath, int fd) /* register a Lustre file record with Darshan */ fs_info.fs_type = -1; darshan_core_register_record( - (void *)filepath, - strlen(filepath), + (void *)newname, + strlen(newname), DARSHAN_LUSTRE_MOD, 1, limit_flag,