From cd76e5347921f5fed2f557a93375b435b41cb56c Mon Sep 17 00:00:00 2001 From: XuanWang1982 Date: Mon, 10 Aug 2015 16:04:25 +0200 Subject: [PATCH] Changed parameter name from siox to gpfs Adding get_info function for gpfs module annotate printf information Signed-off-by: Edgar Gabriel --- ompi/mca/fs/gpfs/Makefile.am | 1 + ompi/mca/fs/gpfs/fs_gpfs.c | 3 +- ompi/mca/fs/gpfs/fs_gpfs.h | 4 +- ompi/mca/fs/gpfs/fs_gpfs_file_close.c | 2 +- ompi/mca/fs/gpfs/fs_gpfs_file_get_info.c | 48 ++ ompi/mca/fs/gpfs/fs_gpfs_file_set_info.c | 582 +++++++++++------------ 6 files changed, 337 insertions(+), 303 deletions(-) create mode 100644 ompi/mca/fs/gpfs/fs_gpfs_file_get_info.c diff --git a/ompi/mca/fs/gpfs/Makefile.am b/ompi/mca/fs/gpfs/Makefile.am index 9a0138e2e3..a54c8e7421 100644 --- a/ompi/mca/fs/gpfs/Makefile.am +++ b/ompi/mca/fs/gpfs/Makefile.am @@ -38,6 +38,7 @@ fs_gpfs_sources = \ fs_gpfs_file_get_size.c \ fs_gpfs_file_open.c \ fs_gpfs_file_set_info.c\ + fs_gpfs_file_get_info.c\ fs_gpfs_file_set_size.c \ fs_gpfs_file_sync.c \ fs_gpfs.c \ diff --git a/ompi/mca/fs/gpfs/fs_gpfs.c b/ompi/mca/fs/gpfs/fs_gpfs.c index 0e1168c048..e9e0f16c95 100644 --- a/ompi/mca/fs/gpfs/fs_gpfs.c +++ b/ompi/mca/fs/gpfs/fs_gpfs.c @@ -48,7 +48,8 @@ static mca_fs_base_module_1_0_0_t gpfs = { mca_fs_gpfs_module_init, /* initializ mca_fs_gpfs_module_finalize, /* close a module on a communicator */ mca_fs_gpfs_file_open, mca_fs_gpfs_file_close, mca_fs_gpfs_file_delete, mca_fs_gpfs_file_set_size, mca_fs_gpfs_file_get_size, - mca_fs_gpfs_file_set_info, mca_fs_gpfs_file_sync }; + mca_fs_gpfs_file_set_info, mca_fs_gpfs_file_sync, + mca_fs_gpfs_file_get_info}; /* * ******************************************************************* * ************************* structure ends ************************** diff --git a/ompi/mca/fs/gpfs/fs_gpfs.h b/ompi/mca/fs/gpfs/fs_gpfs.h index 56aedf4b13..d8eae9c4cf 100644 --- a/ompi/mca/fs/gpfs/fs_gpfs.h +++ b/ompi/mca/fs/gpfs/fs_gpfs.h @@ -59,8 +59,8 @@ int mca_fs_gpfs_file_get_size(struct mca_io_ompio_file_t *fh, int mca_fs_gpfs_file_get_amode(struct ompi_file_t *fh, int *amode); int mca_fs_gpfs_file_set_info(struct mca_io_ompio_file_t *fh, struct ompi_info_t *info); -//int mca_fs_gpfs_file_get_info(struct ompi_file_t *fh, - //struct ompi_info_t **info_used); +int mca_fs_gpfs_file_get_info(struct mca_io_ompio_file_t *fh, + struct ompi_info_t **info_used); int mca_fs_gpfs_prefetch_hints(int access_mode, mca_io_ompio_file_t *fh, struct ompi_info_t *info); int mca_fs_gpfs_io_selection(mca_io_ompio_file_t *fh, diff --git a/ompi/mca/fs/gpfs/fs_gpfs_file_close.c b/ompi/mca/fs/gpfs/fs_gpfs_file_close.c index e91acce667..cd58e4ad84 100644 --- a/ompi/mca/fs/gpfs/fs_gpfs_file_close.c +++ b/ompi/mca/fs/gpfs/fs_gpfs_file_close.c @@ -38,7 +38,7 @@ int mca_fs_gpfs_file_close (mca_io_ompio_file_t *fh) { - printf("Using mca_fs_gpfs_file_close to close a file.\n"); + //DEBUG printf("Using mca_fs_gpfs_file_close to close a file.\n"); fh->f_comm->c_coll.coll_barrier (fh->f_comm, fh->f_comm->c_coll.coll_barrier_module); diff --git a/ompi/mca/fs/gpfs/fs_gpfs_file_get_info.c b/ompi/mca/fs/gpfs/fs_gpfs_file_get_info.c new file mode 100644 index 0000000000..008acced01 --- /dev/null +++ b/ompi/mca/fs/gpfs/fs_gpfs_file_get_info.c @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2011 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2015 High Performance Computing Center Stuttgart, + * 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$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" +#include "fs_gpfs.h" +#include "mpi.h" +#include "ompi/constants.h" +#include "ompi/mca/fs/fs.h" + +#include +#include + +#include +#include +#include +#include + +/* + * file_get_info_gpfs + * + * Function: - get_info of a file + * Accepts: - same arguments as MPI_File_get_info() + * Returns: - new info object + */ + + int mca_fs_gpfs_file_get_info(mca_io_ompio_file_t *fh, + ompi_info_t **info_used) { + fprintf(stderr, "GPFS GET INFO\n"); + int ret = OMPI_SUCCESS; + ret = MPI_Info_dup(fh->f_info, *info_used); + return ret; +} \ No newline at end of file diff --git a/ompi/mca/fs/gpfs/fs_gpfs_file_set_info.c b/ompi/mca/fs/gpfs/fs_gpfs_file_set_info.c index e15874605e..bfcaf5889b 100644 --- a/ompi/mca/fs/gpfs/fs_gpfs_file_set_info.c +++ b/ompi/mca/fs/gpfs/fs_gpfs_file_set_info.c @@ -169,305 +169,289 @@ struct { int mca_fs_gpfs_file_set_info(mca_io_ompio_file_t *fh, struct ompi_info_t *info) { //DEBUG: fprintf(stderr, "GPFS SET INFO\n"); - int ret; - //CN: Why subfunction? - ret = mca_fs_gpfs_prefetch_hints(fh->f_amode, fh, info); - return ret; -} - -//CN: The functionality of this function translates between siox keys and GPFS structs -//CN: Would this not be the job of siox - providing a gps hint struct? -//CN: If we want to do this, we schould do this in a modular way, allowing to exchange siox easiely -int mca_fs_gpfs_prefetch_hints(int access_mode, - mca_io_ompio_file_t *fh, struct ompi_info_t *info) { - - //CN: Is this future proof, no description what gpfs_file_t is exactly - //CN: In gpfs.h it seems void* on WINDOWS and int on UNIX - //CN: Does this fit fh->fd in all cases? - gpfs_file_t gpfs_file_handle = fh->fd; - - int rc = 0; - int flag; - int valueLen = MPI_MAX_INFO_VAL; - char value[MPI_MAX_INFO_VAL + 1]; - char gpfsHintsKey[50]; - const char* split = ","; - char* token; - int ret = OMPI_SUCCESS; - ompi_info_t *info_selected; - info_selected = info; - - strcpy(gpfsHintsKey, "useSIOXLib"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag) { - if(strcmp(value, "true") == 0) { - //using the SIOX lib and the I/O pattern selection - ret = mca_fs_gpfs_io_selection(fh, info, info_selected); - if (ret != OMPI_SUCCESS) - return ret; - } - else { - //CN: Is there something left to do here? - //TODO Sending the MPI_INFO to SIOX for knowledgebase - } - } - - //Setting GPFS Hint - gpfsAccessRange - strcpy(gpfsHintsKey, "sioxAccessRange"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag) { - printf("GPFS Access Range is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_AccessRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_AccessRange); - gpfs_hint_AccessRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_AccessRange.gpfsFcntlHeader.fcntlReserved = 0; - - gpfs_hint_AccessRange.gpfsAccessRange.structLen = - sizeof(gpfs_hint_AccessRange.gpfsAccessRange); - gpfs_hint_AccessRange.gpfsAccessRange.structType = GPFS_ACCESS_RANGE; - token = strtok(value, split); - gpfs_hint_AccessRange.gpfsAccessRange.start = atol(token); - token = strtok(NULL, split); - gpfs_hint_AccessRange.gpfsAccessRange.length = atol(token); - token = strtok(NULL, split); - gpfs_hint_AccessRange.gpfsAccessRange.isWrite = atoi(token); - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_AccessRange); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hints_1 gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //Setting GPFS Hint - gpfsFreeRange - strcpy(gpfsHintsKey, "sioxFreeRange"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag) { - printf("GPFS Free Range is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_FreeRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_FreeRange); - gpfs_hint_FreeRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_FreeRange.gpfsFcntlHeader.fcntlReserved = 0; - - gpfs_hint_FreeRange.gpfsFreeRange.structLen = - sizeof(gpfs_hint_FreeRange.gpfsFreeRange); - gpfs_hint_FreeRange.gpfsFreeRange.structType = GPFS_FREE_RANGE; - token = strtok(value, split); - gpfs_hint_FreeRange.gpfsFreeRange.start = atol(token); - token = strtok(NULL, split); - gpfs_hint_FreeRange.gpfsFreeRange.length = atol(token); - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_FreeRange); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hints_2 gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //CN: TODO - //Setting GPFS Hint - gpfsRangeArray - //Setting GPFS Hint - gpfsMultipleAccessRange - - //Setting GPFS Hint - gpfsClearFileCache - strcpy(gpfsHintsKey, "sioxClearFileCache"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag & strcmp(value, "true") == 0) { - printf("GPFS Clear File Cache is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_ClearFileCache.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_ClearFileCache); - gpfs_hint_ClearFileCache.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_ClearFileCache.gpfsFcntlHeader.fcntlReserved = 0; - - gpfs_hint_ClearFileCache.gpfsClearFileCache.structLen = - sizeof(gpfs_hint_ClearFileCache.gpfsClearFileCache); - gpfs_hint_ClearFileCache.gpfsClearFileCache.structType = GPFS_CLEAR_FILE_CACHE; - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_ClearFileCache); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hints_5 gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //Setting GPFS Hint - gpfsCancelHints - strcpy(gpfsHintsKey, "sioxCancelHints"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag & strcmp(value, "true") == 0) { - printf("GPFS Cancel Hints is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_CancelHints.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_CancelHints); - gpfs_hint_CancelHints.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_CancelHints.gpfsFcntlHeader.fcntlReserved = 0; - - gpfs_hint_CancelHints.gpfsCancelHints.structLen = - sizeof(gpfs_hint_CancelHints.gpfsCancelHints); - gpfs_hint_CancelHints.gpfsCancelHints.structType = GPFS_CANCEL_HINTS; - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_CancelHints); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hints_6 gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //Setting GPFS Hint - gpfsDataShipStart - strcpy(gpfsHintsKey, "sioxDataShipStart"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag) { - printf("GPFS Data Ship Start is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_DataShipStart.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_DataShipStart); - gpfs_hint_DataShipStart.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_DataShipStart.gpfsFcntlHeader.fcntlReserved = 0; - - gpfs_hint_DataShipStart.gpfsDataShipStart.structLen = - sizeof(gpfs_hint_DataShipStart.gpfsDataShipStart); - gpfs_hint_DataShipStart.gpfsDataShipStart.structType = GPFS_DATA_SHIP_START; - token = strtok(value, split); - gpfs_hint_DataShipStart.gpfsDataShipStart.numInstances = atoi(token); - gpfs_hint_DataShipStart.gpfsDataShipStart.reserved = 0; - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_DataShipStart); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hints_7 gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //CN: TODO - //Setting GPFS Hint - gpfsDataShipMap - //Setting GPFS Hint - gpfsDataShipMapVariable - - //Setting GPFS Hint - gpfsDataShipStop - strcpy(gpfsHintsKey, "sioxDataShipStop"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag & strcmp(value, "true") == 0) { - printf("GPFS Data Ship Stop is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_DataShipStop.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_DataShipStop); - gpfs_hint_DataShipStop.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_DataShipStop.gpfsFcntlHeader.fcntlReserved = 0; - - gpfs_hint_DataShipStop.gpfsDataShipStop.structLen = - sizeof(gpfs_hint_DataShipStop.gpfsDataShipStop); - gpfs_hint_DataShipStop.gpfsDataShipStop.structType = GPFS_DATA_SHIP_STOP; - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_DataShipStop); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hints_10 gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //Setting GPFS Hint - gpfsSetReplication - strcpy(gpfsHintsKey, "sioxSetReplication"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag) { - printf("GPFS Set Replication is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_SetReplication.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_SetReplication); - gpfs_hint_SetReplication.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_SetReplication.gpfsFcntlHeader.fcntlReserved = 0; - - gpfs_hint_SetReplication.gpfsSetReplication.structLen = - sizeof(gpfs_hint_SetReplication.gpfsSetReplication); - gpfs_hint_SetReplication.gpfsSetReplication.structType = GPFS_FCNTL_SET_REPLICATION; - token = strtok(value, split); - gpfs_hint_SetReplication.gpfsSetReplication.metadataReplicas = atoi(token); - gpfs_hint_SetReplication.gpfsSetReplication.maxMetadataReplicas = atoi(token); - gpfs_hint_SetReplication.gpfsSetReplication.dataReplicas = atoi(token); - gpfs_hint_SetReplication.gpfsSetReplication.maxDataReplicas = atoi(token); - gpfs_hint_SetReplication.gpfsSetReplication.reserved = 0; - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_SetReplication); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hints_11 gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //CN: TODO - //Setting GPFS Hint - gpfsSetStoragePool - - //Setting GPFS Hint - gpfsByteRange - strcpy(gpfsHintsKey, "sioxByteRange"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag) { - printf("GPFS Byte Range is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_ByteRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_ByteRange); - gpfs_hint_ByteRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_ByteRange.gpfsFcntlHeader.fcntlReserved = 0; - - token = strtok(value, split); - gpfs_hint_ByteRange.gpfsByteRange.startOffset = atol(token); - token = strtok(value, split); - gpfs_hint_ByteRange.gpfsByteRange.numOfBlks = atol(token); - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_ByteRange); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hints_13 gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //Setting GPFS Hint - gpfsRestripeData - strcpy(gpfsHintsKey, "sioxRestripeData"); - ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); - if (flag) { - printf("GPFS Restripe Data is set: %s: %s\n", gpfsHintsKey, value); - gpfs_hint_RestripeData.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_RestripeData); - gpfs_hint_RestripeData.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - gpfs_hint_RestripeData.gpfsFcntlHeader.fcntlReserved = 0; - - gpfs_hint_RestripeData.gpfsRestripeData.structLen = - sizeof(gpfs_hint_RestripeData.gpfsRestripeData); - gpfs_hint_RestripeData.gpfsRestripeData.structType = GPFS_FCNTL_RESTRIPE_DATA; - token = strtok(value, split); - gpfs_hint_RestripeData.gpfsRestripeData.options = atoi(token); - gpfs_hint_RestripeData.gpfsRestripeData.reserved1 = 0; - gpfs_hint_RestripeData.gpfsRestripeData.reserved2 = 0; - - rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_RestripeData); - if (rc != 0) { - rc = errno; - printf( - "gpfs_hints_14 gpfs_fcntl(file handle: %d): Error number is %d, %s\n", - gpfs_file_handle, rc, strerror(rc)); - ret = OMPI_ERROR; - } - } - - //CN: TODO - //Setting GPFS Hint - gpfsRestripeRange - //Setting GPFS Hint - gpfsGetReplication - //Setting GPFS Hint - gpfsGetStoragePool - //Setting GPFS Hint - gpfsGetFilesetName - //Setting GPFS Hint - gpfsGetSnapshotName - //Setting GPFS Hint - gpfsSetImmutable - //Setting GPFS Hint - gpfsGetImmutable - //Setting GPFS Hint - gpfsSetExpTime - //Setting GPFS Hint - gpfsGetExpTime - //Setting GPFS Hint - gpfsSetAppendOnly - //Setting GPFS Hint - gpfsGetAppendOnly - - return ret; + int rc = 0; + int flag; + int valueLen = MPI_MAX_INFO_VAL; + char value[MPI_MAX_INFO_VAL + 1]; + char gpfsHintsKey[50]; + const char* split = ","; + char* token; + int ret = OMPI_SUCCESS; + ompi_info_t *info_selected; + info_selected = info; + gpfs_file_t gpfs_file_handle = fh->fd; + + strcpy(gpfsHintsKey, "useSIOXLib"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + if(strcmp(value, "true") == 0) { + //using the SIOX lib and the I/O pattern selection + ret = mca_fs_gpfs_io_selection(fh, info, info_selected); + if (ret != OMPI_SUCCESS) + return ret; + } + else { + //CN: Is there something left to do here? + //TODO Sending the MPI_INFO to SIOX for knowledgebase + } + } + + //Setting GPFS Hint - gpfsAccessRange + strcpy(gpfsHintsKey, "gpfsAccessRange"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + printf("GPFS Access Range is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_AccessRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_AccessRange); + gpfs_hint_AccessRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_AccessRange.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_AccessRange.gpfsAccessRange.structLen = + sizeof(gpfs_hint_AccessRange.gpfsAccessRange); + gpfs_hint_AccessRange.gpfsAccessRange.structType = GPFS_ACCESS_RANGE; + token = strtok(value, split); + gpfs_hint_AccessRange.gpfsAccessRange.start = atol(token); + token = strtok(NULL, split); + gpfs_hint_AccessRange.gpfsAccessRange.length = atol(token); + token = strtok(NULL, split); + gpfs_hint_AccessRange.gpfsAccessRange.isWrite = atoi(token); + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_AccessRange); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_AccessRange gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //Setting GPFS Hint - gpfsFreeRange + strcpy(gpfsHintsKey, "gpfsFreeRange"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + printf("GPFS Free Range is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_FreeRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_FreeRange); + gpfs_hint_FreeRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_FreeRange.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_FreeRange.gpfsFreeRange.structLen = + sizeof(gpfs_hint_FreeRange.gpfsFreeRange); + gpfs_hint_FreeRange.gpfsFreeRange.structType = GPFS_FREE_RANGE; + token = strtok(value, split); + gpfs_hint_FreeRange.gpfsFreeRange.start = atol(token); + token = strtok(NULL, split); + gpfs_hint_FreeRange.gpfsFreeRange.length = atol(token); + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_FreeRange); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_FreeRange gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //CN: TODO + //Setting GPFS Hint - gpfsRangeArray + //Setting GPFS Hint - gpfsMultipleAccessRange + + //Setting GPFS Hint - gpfsClearFileCache + strcpy(gpfsHintsKey, "gpfsClearFileCache"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag & strcmp(value, "true") == 0) { + printf("GPFS Clear File Cache is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_ClearFileCache.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_ClearFileCache); + gpfs_hint_ClearFileCache.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_ClearFileCache.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_ClearFileCache.gpfsClearFileCache.structLen = + sizeof(gpfs_hint_ClearFileCache.gpfsClearFileCache); + gpfs_hint_ClearFileCache.gpfsClearFileCache.structType = GPFS_CLEAR_FILE_CACHE; + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_ClearFileCache); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_ClearFileCache gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //Setting GPFS Hint - gpfsCancelHints + strcpy(gpfsHintsKey, "gpfsCancelHints"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag & strcmp(value, "true") == 0) { + printf("GPFS Cancel Hints is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_CancelHints.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_CancelHints); + gpfs_hint_CancelHints.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_CancelHints.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_CancelHints.gpfsCancelHints.structLen = + sizeof(gpfs_hint_CancelHints.gpfsCancelHints); + gpfs_hint_CancelHints.gpfsCancelHints.structType = GPFS_CANCEL_HINTS; + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_CancelHints); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_CancelHints gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //Setting GPFS Hint - gpfsDataShipStart + strcpy(gpfsHintsKey, "gpfsDataShipStart"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + printf("GPFS Data Ship Start is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_DataShipStart.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_DataShipStart); + gpfs_hint_DataShipStart.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_DataShipStart.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_DataShipStart.gpfsDataShipStart.structLen = + sizeof(gpfs_hint_DataShipStart.gpfsDataShipStart); + gpfs_hint_DataShipStart.gpfsDataShipStart.structType = GPFS_DATA_SHIP_START; + token = strtok(value, split); + gpfs_hint_DataShipStart.gpfsDataShipStart.numInstances = atoi(token); + gpfs_hint_DataShipStart.gpfsDataShipStart.reserved = 0; + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_DataShipStart); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_DataShipStart gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //CN: TODO + //Setting GPFS Hint - gpfsDataShipMap + //Setting GPFS Hint - gpfsDataShipMapVariable + + //Setting GPFS Hint - gpfsDataShipStop + strcpy(gpfsHintsKey, "gpfsDataShipStop"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag & strcmp(value, "true") == 0) { + printf("GPFS Data Ship Stop is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_DataShipStop.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_DataShipStop); + gpfs_hint_DataShipStop.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_DataShipStop.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_DataShipStop.gpfsDataShipStop.structLen = + sizeof(gpfs_hint_DataShipStop.gpfsDataShipStop); + gpfs_hint_DataShipStop.gpfsDataShipStop.structType = GPFS_DATA_SHIP_STOP; + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_DataShipStop); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_DataShipStop gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //Setting GPFS Hint - gpfsSetReplication + strcpy(gpfsHintsKey, "gpfsSetReplication"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + printf("GPFS Set Replication is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_SetReplication.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_SetReplication); + gpfs_hint_SetReplication.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_SetReplication.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_SetReplication.gpfsSetReplication.structLen = + sizeof(gpfs_hint_SetReplication.gpfsSetReplication); + gpfs_hint_SetReplication.gpfsSetReplication.structType = GPFS_FCNTL_SET_REPLICATION; + token = strtok(value, split); + gpfs_hint_SetReplication.gpfsSetReplication.metadataReplicas = atoi(token); + gpfs_hint_SetReplication.gpfsSetReplication.maxMetadataReplicas = atoi(token); + gpfs_hint_SetReplication.gpfsSetReplication.dataReplicas = atoi(token); + gpfs_hint_SetReplication.gpfsSetReplication.maxDataReplicas = atoi(token); + gpfs_hint_SetReplication.gpfsSetReplication.reserved = 0; + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_SetReplication); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_SetReplication gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //CN: TODO + //Setting GPFS Hint - gpfsSetStoragePool + + //Setting GPFS Hint - gpfsByteRange + strcpy(gpfsHintsKey, "gpfsByteRange"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + printf("GPFS Byte Range is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_ByteRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_ByteRange); + gpfs_hint_ByteRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_ByteRange.gpfsFcntlHeader.fcntlReserved = 0; + + token = strtok(value, split); + gpfs_hint_ByteRange.gpfsByteRange.startOffset = atol(token); + token = strtok(value, split); + gpfs_hint_ByteRange.gpfsByteRange.numOfBlks = atol(token); + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_ByteRange); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_ByteRange gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //Setting GPFS Hint - gpfsRestripeData + strcpy(gpfsHintsKey, "gpfsRestripeData"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + printf("GPFS Restripe Data is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_RestripeData.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_RestripeData); + gpfs_hint_RestripeData.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_RestripeData.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_RestripeData.gpfsRestripeData.structLen = + sizeof(gpfs_hint_RestripeData.gpfsRestripeData); + gpfs_hint_RestripeData.gpfsRestripeData.structType = GPFS_FCNTL_RESTRIPE_DATA; + token = strtok(value, split); + gpfs_hint_RestripeData.gpfsRestripeData.options = atoi(token); + gpfs_hint_RestripeData.gpfsRestripeData.reserved1 = 0; + gpfs_hint_RestripeData.gpfsRestripeData.reserved2 = 0; + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_RestripeData); + if (rc != 0) { + rc = errno; + printf( + "gpfs_hint_RestripeData gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //CN: TODO + //Setting GPFS Hint - gpfsRestripeRange + //Setting GPFS Hint - gpfsGetReplication + //Setting GPFS Hint - gpfsGetStoragePool + //Setting GPFS Hint - gpfsGetFilesetName + //Setting GPFS Hint - gpfsGetSnapshotName + //Setting GPFS Hint - gpfsSetImmutable + //Setting GPFS Hint - gpfsGetImmutable + //Setting GPFS Hint - gpfsSetExpTime + //Setting GPFS Hint - gpfsGetExpTime + //Setting GPFS Hint - gpfsSetAppendOnly + //Setting GPFS Hint - gpfsGetAppendOnly + + return ret; } //CN: Will this function set info keys with siox prefix?