root/ompi/mca/fs/lustre/fs_lustre.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. mca_fs_lustre_component_init_query
  2. mca_fs_lustre_component_file_query
  3. mca_fs_lustre_component_file_unquery
  4. mca_fs_lustre_module_init
  5. mca_fs_lustre_module_finalize

   1 /*
   2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2017 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2008-2018 University of Houston. All rights reserved.
  13  * Copyright (c) 2018      Research Organization for Information Science
  14  *                         and Technology (RIST). All rights reserved.
  15  * Copyright (c) 2018      DataDirect Networks. All rights reserved.
  16  * $COPYRIGHT$
  17  *
  18  * Additional copyrights may follow
  19  *
  20  * $HEADER$
  21  *
  22  * These symbols are in a file by themselves to provide nice linker
  23  * semantics. Since linkers generally pull in symbols by object fules,
  24  * keeping these symbols as the only symbols in this file prevents
  25  * utility programs such as "ompi_info" from having to import entire
  26  * modules just to query their version and parameters
  27  */
  28 
  29 #include "ompi_config.h"
  30 #include "mpi.h"
  31 #include "ompi/mca/fs/fs.h"
  32 #include "ompi/mca/fs/base/base.h"
  33 #include "ompi/mca/fs/lustre/fs_lustre.h"
  34 
  35 #ifdef HAVE_SYS_STATFS_H
  36 #include <sys/statfs.h> /* or <sys/vfs.h> */
  37 #endif
  38 #ifdef HAVE_SYS_PARAM_H
  39 #include <sys/param.h>
  40 #endif
  41 #ifdef HAVE_SYS_MOUNT_H
  42 #include <sys/mount.h>
  43 #endif
  44 #ifdef HAVE_SYS_STAT_H
  45 #include <sys/stat.h>
  46 #endif
  47 
  48 #include <sys/ioctl.h>
  49 
  50 /*
  51  * *******************************************************************
  52  * ************************ actions structure ************************
  53  * *******************************************************************
  54  */
  55 static mca_fs_base_module_1_0_0_t lustre =  {
  56     mca_fs_lustre_module_init, /* initalise after being selected */
  57     mca_fs_lustre_module_finalize, /* close a module on a communicator */
  58     mca_fs_lustre_file_open,
  59     mca_fs_base_file_close,
  60     mca_fs_base_file_delete,
  61     mca_fs_base_file_set_size,
  62     mca_fs_base_file_get_size,
  63     mca_fs_base_file_sync
  64 };
  65 /*
  66  * *******************************************************************
  67  * ************************* structure ends **************************
  68  * *******************************************************************
  69  */
  70 
  71 int mca_fs_lustre_component_init_query(bool enable_progress_threads,
  72                                       bool enable_mpi_threads)
  73 {
  74     /* Nothing to do */
  75 
  76    return OMPI_SUCCESS;
  77 }
  78 
  79 struct mca_fs_base_module_1_0_0_t *
  80 mca_fs_lustre_component_file_query (ompio_file_t *fh, int *priority)
  81 {
  82     char *tmp;
  83 
  84     /* The code in this function is based on the ADIO FS selection in ROMIO
  85      *   Copyright (C) 1997 University of Chicago.
  86      *   See COPYRIGHT notice in top-level directory.
  87      */
  88 
  89     *priority = mca_fs_lustre_priority;
  90 
  91     tmp = strchr (fh->f_filename, ':');
  92     if (!tmp) {
  93         /* The communicator might be NULL if we only want to delete the file */
  94         if (OMPIO_ROOT == fh->f_rank || MPI_COMM_NULL == fh->f_comm) {
  95             fh->f_fstype = mca_fs_base_get_fstype ( fh->f_filename );
  96         }
  97         if (fh->f_comm != MPI_COMM_NULL) {
  98             fh->f_comm->c_coll->coll_bcast (&(fh->f_fstype),
  99                         1,
 100                         MPI_INT,
 101                         OMPIO_ROOT,
 102                         fh->f_comm,
 103                         fh->f_comm->c_coll->coll_bcast_module);
 104         }
 105     }
 106     else {
 107         if (!strncmp(fh->f_filename, "lustre:", 7) ||
 108             !strncmp(fh->f_filename, "LUSTRE:", 7)) {
 109             fh->f_fstype = LUSTRE;
 110         }
 111     }
 112 
 113    if (LUSTRE == fh->f_fstype) {
 114        if (*priority < 50) {
 115            *priority = 50;
 116            return &lustre;
 117        }
 118    }
 119 
 120    return NULL;
 121 }
 122 
 123 int mca_fs_lustre_component_file_unquery (ompio_file_t *file)
 124 {
 125    /* This function might be needed for some purposes later. for now it
 126     * does not have anything to do since there are no steps which need
 127     * to be undone if this module is not selected */
 128 
 129     return OMPI_SUCCESS;
 130 }
 131 
 132 int mca_fs_lustre_module_init (ompio_file_t *file)
 133 {
 134     /* Make sure the file type is not overwritten by the last queried
 135          * component */
 136     file->f_fstype = LUSTRE;
 137     return OMPI_SUCCESS;
 138 }
 139 
 140 
 141 int mca_fs_lustre_module_finalize (ompio_file_t *file)
 142 {
 143     return OMPI_SUCCESS;
 144 }

/* [<][>][^][v][top][bottom][index][help] */