Commit e5df8a50 authored by Cong Xu's avatar Cong Xu

Address stripe_size=0 and stripe_count=0 bugs

Signed-off-by: Cong Xu's avatarCong Xu <cong.xu@intel.com>
parent ed28a4b2
...@@ -1445,7 +1445,8 @@ static int darshan_log_open_all(char *logfile_name, MPI_File *log_fh) ...@@ -1445,7 +1445,8 @@ static int darshan_log_open_all(char *logfile_name, MPI_File *log_fh)
hints = __DARSHAN_LOG_HINTS; hints = __DARSHAN_LOG_HINTS;
} }
if(hints && strlen(hints) > 0) /* DXLT */
if(hints && strlen(hints) > 0 && !getenv("ENABLE_DXLT_IO_TRACE"))
{ {
tok_str = strdup(hints); tok_str = strdup(hints);
if(tok_str) if(tok_str)
......
...@@ -676,19 +676,20 @@ static void dxlt_posix_shutdown( ...@@ -676,19 +676,20 @@ static void dxlt_posix_shutdown(
stripe_count = file_rec->stripe_count; stripe_count = file_rec->stripe_count;
ost_ids = file_rec->ost_ids; ost_ids = file_rec->ost_ids;
cur_offset = offset; if (stripe_size != 0 && stripe_count != 0) {
ost_idx = (offset / stripe_size) % stripe_count; cur_offset = offset;
ost_idx = (offset / stripe_size) % stripe_count;
while (cur_offset < offset + length) {
printf(" [OST: %d]", file_rec->ost_ids[ost_idx]); while (cur_offset < offset + length) {
cur_offset = (cur_offset / stripe_size + 1) * stripe_size; printf(" [OST: %d]", file_rec->ost_ids[ost_idx]);
ost_idx = (ost_idx == stripe_count - 1) ? 0 : ost_idx + 1; cur_offset = (cur_offset / stripe_size + 1) * stripe_size;
ost_idx = (ost_idx == stripe_count - 1) ? 0 : ost_idx + 1;
}
} }
printf("\n"); printf("\n");
} }
DARSHAN_MPI_CALL(PMPI_Barrier)(MPI_COMM_WORLD);
for (i = 0; i < file_rec->read_count; i++) { for (i = 0; i < file_rec->read_count; i++) {
rank = file_rec->base_rec.rank; rank = file_rec->base_rec.rank;
offset = file_rec->read_traces[i].offset; offset = file_rec->read_traces[i].offset;
...@@ -702,13 +703,15 @@ static void dxlt_posix_shutdown( ...@@ -702,13 +703,15 @@ static void dxlt_posix_shutdown(
stripe_count = file_rec->stripe_count; stripe_count = file_rec->stripe_count;
ost_ids = file_rec->ost_ids; ost_ids = file_rec->ost_ids;
cur_offset = offset; if (stripe_size != 0 && stripe_count != 0) {
ost_idx = (offset / stripe_size) % stripe_count; cur_offset = offset;
ost_idx = (offset / stripe_size) % stripe_count;
while (cur_offset < offset + length) { while (cur_offset < offset + length) {
printf(" [OST: %d]", file_rec->ost_ids[ost_idx]); printf(" [OST: %d]", file_rec->ost_ids[ost_idx]);
cur_offset = (cur_offset / stripe_size + 1) * stripe_size; cur_offset = (cur_offset / stripe_size + 1) * stripe_size;
ost_idx = (ost_idx == stripe_count - 1) ? 0 : ost_idx + 1; ost_idx = (ost_idx == stripe_count - 1) ? 0 : ost_idx + 1;
}
} }
printf("\n"); printf("\n");
...@@ -831,7 +834,6 @@ static void dxlt_mpiio_shutdown( ...@@ -831,7 +834,6 @@ static void dxlt_mpiio_shutdown(
printf("DXLT, rank %d writes segment %lld [offset: %lld length: %lld start_time: %fs end_time: %fs]\n", rank, i, offset, length, start_time, end_time); printf("DXLT, rank %d writes segment %lld [offset: %lld length: %lld start_time: %fs end_time: %fs]\n", rank, i, offset, length, start_time, end_time);
} }
DARSHAN_MPI_CALL(PMPI_Barrier)(MPI_COMM_WORLD);
for (i = 0; i < file_rec->read_count; i++) { for (i = 0; i < file_rec->read_count; i++) {
rank = file_rec->base_rec.rank; rank = file_rec->base_rec.rank;
offset = file_rec->read_traces[i].offset; offset = file_rec->read_traces[i].offset;
......
...@@ -187,7 +187,9 @@ void dxlt_get_lustre_stripe_info( ...@@ -187,7 +187,9 @@ void dxlt_get_lustre_stripe_info(
rec_ref = darshan_lookup_record_ref(lustre_runtime->record_id_hash, rec_ref = darshan_lookup_record_ref(lustre_runtime->record_id_hash,
&rec_id, sizeof(darshan_record_id)); &rec_id, sizeof(darshan_record_id));
assert(rec_ref); if(!rec_ref) {
return;
}
file_rec->stripe_count = rec_ref->record->counters[LUSTRE_STRIPE_WIDTH]; file_rec->stripe_count = rec_ref->record->counters[LUSTRE_STRIPE_WIDTH];
file_rec->stripe_size = rec_ref->record->counters[LUSTRE_STRIPE_SIZE]; file_rec->stripe_size = rec_ref->record->counters[LUSTRE_STRIPE_SIZE];
......
...@@ -248,19 +248,21 @@ static void dxlt_log_print_posix_file(void *posix_file_rec, char *file_name, ...@@ -248,19 +248,21 @@ static void dxlt_log_print_posix_file(void *posix_file_rec, char *file_name,
printf("%8s%8d%7s%9lld%16lld%13lld%12.4f%12.4f", "POSIX", rank, "write", i, offset, length, start_time, end_time); printf("%8s%8d%7s%9lld%16lld%13lld%12.4f%12.4f", "POSIX", rank, "write", i, offset, length, start_time, end_time);
cur_offset = offset; if (stripe_count != 0 && stripe_size != 0) {
ost_idx = (offset / stripe_size) % stripe_count; cur_offset = offset;
ost_idx = (offset / stripe_size) % stripe_count;
print_count = 0; print_count = 0;
while (cur_offset < offset + length) { while (cur_offset < offset + length) {
printf(" [%3d]", ost_ids[ost_idx]); printf(" [%3d]", ost_ids[ost_idx]);
cur_offset = (cur_offset / stripe_size + 1) * stripe_size; cur_offset = (cur_offset / stripe_size + 1) * stripe_size;
ost_idx = (ost_idx == stripe_count - 1) ? 0 : ost_idx + 1; ost_idx = (ost_idx == stripe_count - 1) ? 0 : ost_idx + 1;
print_count++; print_count++;
if (print_count >= stripe_count) if (print_count >= stripe_count)
break; break;
}
} }
printf("\n"); printf("\n");
...@@ -274,19 +276,21 @@ static void dxlt_log_print_posix_file(void *posix_file_rec, char *file_name, ...@@ -274,19 +276,21 @@ static void dxlt_log_print_posix_file(void *posix_file_rec, char *file_name,
printf("%8s%8d%7s%9lld%16lld%13lld%12.4f%12.4f", "POSIX", rank, "read", i - write_count, offset, length, start_time, end_time); printf("%8s%8d%7s%9lld%16lld%13lld%12.4f%12.4f", "POSIX", rank, "read", i - write_count, offset, length, start_time, end_time);
cur_offset = offset; if (stripe_count != 0 && stripe_size != 0) {
ost_idx = (offset / stripe_size) % stripe_count; cur_offset = offset;
ost_idx = (offset / stripe_size) % stripe_count;
print_count = 0; print_count = 0;
while (cur_offset < offset + length) { while (cur_offset < offset + length) {
printf(" [%3d]", ost_ids[ost_idx]); printf(" [%3d]", ost_ids[ost_idx]);
cur_offset = (cur_offset / stripe_size + 1) * stripe_size; cur_offset = (cur_offset / stripe_size + 1) * stripe_size;
ost_idx = (ost_idx == stripe_count - 1) ? 0 : ost_idx + 1; ost_idx = (ost_idx == stripe_count - 1) ? 0 : ost_idx + 1;
print_count++; print_count++;
if (print_count >= stripe_count) if (print_count >= stripe_count)
break; break;
}
} }
printf("\n"); printf("\n");
......
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