diff --git a/ompi/mca/fs/lustre/fs_lustre_component.c b/ompi/mca/fs/lustre/fs_lustre_component.c index ccf2580c8d..c6dc1fadfa 100644 --- a/ompi/mca/fs/lustre/fs_lustre_component.c +++ b/ompi/mca/fs/lustre/fs_lustre_component.c @@ -43,7 +43,7 @@ int mca_fs_lustre_priority = 20; to 64KB. MCA parameter Can be changed at runtime also*/ -int mca_fs_lustre_stripe_size = 1048576; +int mca_fs_lustre_stripe_size = 0; int mca_fs_lustre_stripe_width = 0; /* * Instantiate the public struct with all of our public information @@ -81,7 +81,7 @@ lustre_register(void) MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY, &mca_fs_lustre_priority); - mca_fs_lustre_stripe_size = 1048576; + mca_fs_lustre_stripe_size = 0; (void) mca_base_component_var_register(&mca_fs_lustre_component.fsm_version, "stripe_size", "stripe size of a file over lustre", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, @@ -89,7 +89,7 @@ lustre_register(void) MCA_BASE_VAR_SCOPE_READONLY, &mca_fs_lustre_stripe_size); mca_fs_lustre_stripe_width = 0; (void) mca_base_component_var_register(&mca_fs_lustre_component.fsm_version, - "stripe_width", "stripe width of a file over lustre", + "stripe_width", "stripe count of a file over lustre", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY, &mca_fs_lustre_stripe_width); diff --git a/ompi/mca/fs/lustre/fs_lustre_file_open.c b/ompi/mca/fs/lustre/fs_lustre_file_open.c index 6792bb5a52..02d3bb2ec6 100644 --- a/ompi/mca/fs/lustre/fs_lustre_file_open.c +++ b/ompi/mca/fs/lustre/fs_lustre_file_open.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2008-2015 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -50,6 +50,10 @@ mca_fs_lustre_file_open (struct ompi_communicator_t *comm, int amode; int old_mask, perm; int rc; + int flag; + int fs_lustre_stripe_size = -1; + int fs_lustre_stripe_width = -1; + char char_stripe[MPI_MAX_INFO_KEY]; struct lov_user_md *lump=NULL; @@ -74,13 +78,33 @@ mca_fs_lustre_file_open (struct ompi_communicator_t *comm, if (access_mode & MPI_MODE_EXCL) amode = amode | O_EXCL; - if ((mca_fs_lustre_stripe_size || mca_fs_lustre_stripe_width) && + + ompi_info_get (info, "stripe_size", MPI_MAX_INFO_VAL, char_stripe, &flag); + if ( flag ) { + sscanf ( char_stripe, "%d", &fs_lustre_stripe_size ); + } + + ompi_info_get (info, "stripe_width", MPI_MAX_INFO_VAL, char_stripe, &flag); + if ( flag ) { + sscanf ( char_stripe, "%d", &fs_lustre_stripe_width ); + } + + if (fs_lustre_stripe_size < 0) { + fs_lustre_stripe_size = mca_fs_lustre_stripe_size; + } + + if (fs_lustre_stripe_width < 0) { + fs_lustre_stripe_width = mca_fs_lustre_stripe_width; + } + + + if ( (fs_lustre_stripe_size>0 || fs_lustre_stripe_width>0) && (amode&O_CREAT) && (amode&O_RDWR)) { if (0 == fh->f_rank) { - llapi_file_create(filename, - mca_fs_lustre_stripe_size, + llapi_file_create(filename, + fs_lustre_stripe_size, -1, /* MSC need to change that */ - mca_fs_lustre_stripe_width, + fs_lustre_stripe_width, 0); /* MSC need to change that */ 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, else { lump = (struct lov_user_md *) malloc (sizeof(struct lov_user_md)); if (NULL == lump ){ - fprintf(stderr,"Cannot Allocate Lump for extracting stripe size\n"); + fprintf(stderr,"Cannot allocate memory for extracting stripe size\n"); return OMPI_ERROR; } rc = llapi_file_get_stripe(filename, lump); if (rc != 0) { fprintf(stderr, "get_stripe failed: %d (%s)\n",errno, strerror(errno)); - return -1; + return OMPI_ERROR; } fh->f_stripe_size = lump->lmm_stripe_size; }