Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit c29a210

Browse files
committed
Merge pull request #400 from edgargabriel/pr/lustre-fs-fix
fix the logic for setting stripe size and stripe count in the lustre …
2 parents e9c2f2f + 944d0a1 commit c29a210

File tree

2 files changed

+34
-10
lines changed

2 files changed

+34
-10
lines changed

ompi/mca/fs/lustre/fs_lustre_component.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ int mca_fs_lustre_priority = 20;
4343
to 64KB. MCA parameter
4444
Can be changed at
4545
runtime also*/
46-
int mca_fs_lustre_stripe_size = 1048576;
46+
int mca_fs_lustre_stripe_size = 0;
4747
int mca_fs_lustre_stripe_width = 0;
4848
/*
4949
* Instantiate the public struct with all of our public information
@@ -81,15 +81,15 @@ lustre_register(void)
8181
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
8282
OPAL_INFO_LVL_9,
8383
MCA_BASE_VAR_SCOPE_READONLY, &mca_fs_lustre_priority);
84-
mca_fs_lustre_stripe_size = 1048576;
84+
mca_fs_lustre_stripe_size = 0;
8585
(void) mca_base_component_var_register(&mca_fs_lustre_component.fsm_version,
8686
"stripe_size", "stripe size of a file over lustre",
8787
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
8888
OPAL_INFO_LVL_9,
8989
MCA_BASE_VAR_SCOPE_READONLY, &mca_fs_lustre_stripe_size);
9090
mca_fs_lustre_stripe_width = 0;
9191
(void) mca_base_component_var_register(&mca_fs_lustre_component.fsm_version,
92-
"stripe_width", "stripe width of a file over lustre",
92+
"stripe_width", "stripe count of a file over lustre",
9393
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
9494
OPAL_INFO_LVL_9,
9595
MCA_BASE_VAR_SCOPE_READONLY, &mca_fs_lustre_stripe_width);

ompi/mca/fs/lustre/fs_lustre_file_open.c

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
12+
* Copyright (c) 2008-2015 University of Houston. All rights reserved.
1313
* $COPYRIGHT$
1414
*
1515
* Additional copyrights may follow
@@ -50,6 +50,10 @@ mca_fs_lustre_file_open (struct ompi_communicator_t *comm,
5050
int amode;
5151
int old_mask, perm;
5252
int rc;
53+
int flag;
54+
int fs_lustre_stripe_size = -1;
55+
int fs_lustre_stripe_width = -1;
56+
char char_stripe[MPI_MAX_INFO_KEY];
5357

5458
struct lov_user_md *lump=NULL;
5559

@@ -74,13 +78,33 @@ mca_fs_lustre_file_open (struct ompi_communicator_t *comm,
7478
if (access_mode & MPI_MODE_EXCL)
7579
amode = amode | O_EXCL;
7680

77-
if ((mca_fs_lustre_stripe_size || mca_fs_lustre_stripe_width) &&
81+
82+
ompi_info_get (info, "stripe_size", MPI_MAX_INFO_VAL, char_stripe, &flag);
83+
if ( flag ) {
84+
sscanf ( char_stripe, "%d", &fs_lustre_stripe_size );
85+
}
86+
87+
ompi_info_get (info, "stripe_width", MPI_MAX_INFO_VAL, char_stripe, &flag);
88+
if ( flag ) {
89+
sscanf ( char_stripe, "%d", &fs_lustre_stripe_width );
90+
}
91+
92+
if (fs_lustre_stripe_size < 0) {
93+
fs_lustre_stripe_size = mca_fs_lustre_stripe_size;
94+
}
95+
96+
if (fs_lustre_stripe_width < 0) {
97+
fs_lustre_stripe_width = mca_fs_lustre_stripe_width;
98+
}
99+
100+
101+
if ( (fs_lustre_stripe_size>0 || fs_lustre_stripe_width>0) &&
78102
(amode&O_CREAT) && (amode&O_RDWR)) {
79103
if (0 == fh->f_rank) {
80-
llapi_file_create(filename,
81-
mca_fs_lustre_stripe_size,
104+
llapi_file_create(filename,
105+
fs_lustre_stripe_size,
82106
-1, /* MSC need to change that */
83-
mca_fs_lustre_stripe_width,
107+
fs_lustre_stripe_width,
84108
0); /* MSC need to change that */
85109

86110
fh->fd = open(filename, O_CREAT | O_RDWR | O_LOV_DELAY_CREATE, perm);
@@ -106,13 +130,13 @@ mca_fs_lustre_file_open (struct ompi_communicator_t *comm,
106130
else {
107131
lump = (struct lov_user_md *) malloc (sizeof(struct lov_user_md));
108132
if (NULL == lump ){
109-
fprintf(stderr,"Cannot Allocate Lump for extracting stripe size\n");
133+
fprintf(stderr,"Cannot allocate memory for extracting stripe size\n");
110134
return OMPI_ERROR;
111135
}
112136
rc = llapi_file_get_stripe(filename, lump);
113137
if (rc != 0) {
114138
fprintf(stderr, "get_stripe failed: %d (%s)\n",errno, strerror(errno));
115-
return -1;
139+
return OMPI_ERROR;
116140
}
117141
fh->f_stripe_size = lump->lmm_stripe_size;
118142
}

0 commit comments

Comments
 (0)