|
1 |
| -/* -*- Mode: C; c-basic-offset:4 ; -*- */ |
2 | 1 | /*
|
3 | 2 | * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
4 | 3 | * University Research and Technology
|
5 | 4 | * Corporation. All rights reserved.
|
6 |
| - * Copyright (c) 2004-2007 The University of Tennessee and The University |
| 5 | + * Copyright (c) 2004-2017 The University of Tennessee and The University |
7 | 6 | * of Tennessee Research Foundation. All rights
|
8 | 7 | * reserved.
|
9 |
| - * Copyright (c) 2004-2015 High Performance Computing Center Stuttgart, |
| 8 | + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, |
10 | 9 | * University of Stuttgart. All rights reserved.
|
11 | 10 | * Copyright (c) 2004-2005 The Regents of the University of California.
|
12 | 11 | * All rights reserved.
|
13 |
| - * Copyright (c) 2008-2012 University of Houston. All rights reserved. |
14 |
| - * Copyright (c) 2011 Cisco Systems, Inc. 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 | 15 | * $COPYRIGHT$
|
16 |
| - * |
| 16 | + * |
17 | 17 | * Additional copyrights may follow
|
18 |
| - * |
| 18 | + * |
19 | 19 | * $HEADER$
|
| 20 | + * |
| 21 | + * These symbols are in a file by themselves to provide nice linker |
| 22 | + * semantics. Since linkers generally pull in symbols by object fules, |
| 23 | + * keeping these symbols as the only symbols in this file prevents |
| 24 | + * utility programs such as "ompi_info" from having to import entire |
| 25 | + * modules just to query their version and parameters |
20 | 26 | */
|
21 | 27 |
|
22 | 28 | #include "ompi_config.h"
|
|
26 | 32 | #include "ompi/mca/fs/gpfs/fs_gpfs.h"
|
27 | 33 |
|
28 | 34 | #ifdef HAVE_SYS_STATFS_H
|
29 |
| -/*CN: Check which is prefered, already checked/used in OMPI */ |
30 |
| -#include <sys/statfs.h> /* or <sys/vfs.h> */ |
| 35 | +#include <sys/statfs.h> /* or <sys/vfs.h> */ |
31 | 36 | #endif
|
32 | 37 | #ifdef HAVE_SYS_PARAM_H
|
33 | 38 | #include <sys/param.h>
|
|
39 | 44 | #include <sys/stat.h>
|
40 | 45 | #endif
|
41 | 46 |
|
| 47 | +#include <sys/ioctl.h> |
| 48 | + |
42 | 49 | /*
|
43 | 50 | * *******************************************************************
|
44 | 51 | * ************************ actions structure ************************
|
45 | 52 | * *******************************************************************
|
46 | 53 | */
|
47 |
| -static mca_fs_base_module_1_0_0_t gpfs = { mca_fs_gpfs_module_init, /* initialize after being selected */ |
48 |
| -mca_fs_gpfs_module_finalize, /* close a module on a communicator */ |
49 |
| -mca_fs_gpfs_file_open, mca_fs_gpfs_file_close, mca_fs_gpfs_file_delete, |
50 |
| - mca_fs_gpfs_file_set_size, mca_fs_gpfs_file_get_size, |
51 |
| - mca_fs_gpfs_file_set_info, mca_fs_gpfs_file_sync, |
52 |
| - mca_fs_gpfs_file_get_info}; |
| 54 | +static mca_fs_base_module_1_0_0_t gpfs = { |
| 55 | + mca_fs_gpfs_module_init, /* initalise after being selected */ |
| 56 | + mca_fs_gpfs_module_finalize, /* close a module on a communicator */ |
| 57 | + mca_fs_gpfs_file_open, |
| 58 | + mca_fs_base_file_close, |
| 59 | + mca_fs_base_file_delete, |
| 60 | + mca_fs_base_file_set_size, |
| 61 | + mca_fs_base_file_get_size, |
| 62 | + mca_fs_base_file_sync |
| 63 | +}; |
53 | 64 | /*
|
54 | 65 | * *******************************************************************
|
55 | 66 | * ************************* structure ends **************************
|
56 | 67 | * *******************************************************************
|
57 | 68 | */
|
58 | 69 |
|
59 | 70 | int mca_fs_gpfs_component_init_query(bool enable_progress_threads,
|
60 |
| - bool enable_mpi_threads) { |
61 |
| - /* Nothing to do */ |
| 71 | + bool enable_mpi_threads) |
| 72 | +{ |
| 73 | + /* Nothing to do */ |
62 | 74 |
|
63 |
| - return OMPI_SUCCESS; |
| 75 | + return OMPI_SUCCESS; |
64 | 76 | }
|
65 | 77 |
|
66 | 78 | struct mca_fs_base_module_1_0_0_t *
|
67 |
| -mca_fs_gpfs_component_file_query(mca_io_ompio_file_t *fh, int *priority) { |
68 |
| - int err; |
69 |
| - char *dir; |
70 |
| - struct statfs fsbuf; |
71 |
| - char *tmp; |
72 |
| - |
73 |
| - /* The code in this function is based on the ADIO FS selection in ROMIO |
74 |
| - * Copyright (C) 1997 University of Chicago. |
75 |
| - * See COPYRIGHT notice in top-level directory. |
76 |
| - */ |
77 |
| - *priority = mca_fs_gpfs_priority; |
78 |
| - |
79 |
| - tmp = strchr(fh->f_filename, ':'); |
80 |
| - if (!tmp) { |
81 |
| - if (OMPIO_ROOT == fh->f_rank) { |
82 |
| - do { |
83 |
| - err = statfs(fh->f_filename, &fsbuf); |
84 |
| - } while (err && (errno == ESTALE)); |
85 |
| - |
86 |
| - if (err && (errno == ENOENT)) { |
87 |
| - mca_fs_base_get_parent_dir(fh->f_filename, &dir); |
88 |
| - err = statfs(dir, &fsbuf); |
89 |
| - free(dir); |
90 |
| - } |
91 |
| - |
92 |
| -#ifndef GPFS_SUPER_MAGIC |
93 |
| -#define GPFS_SUPER_MAGIC 0x47504653 /* Thats GPFS in ASCII */ |
94 |
| -#endif |
95 |
| - if (fsbuf.f_type == GPFS_SUPER_MAGIC) { |
96 |
| - fh->f_fstype = GPFS; |
97 |
| - } |
98 |
| - } |
99 |
| - fh->f_comm->c_coll.coll_bcast(&(fh->f_fstype), 1, |
100 |
| - MPI_INT, |
101 |
| - OMPIO_ROOT, fh->f_comm, fh->f_comm->c_coll.coll_bcast_module); |
102 |
| - } else { |
103 |
| - if (!strncmp(fh->f_filename, "gpfs:", 5) |
104 |
| - || !strncmp(fh->f_filename, "GPFS:", 5)) { |
105 |
| - fh->f_fstype = GPFS; |
106 |
| - } |
107 |
| - } |
108 |
| - |
109 |
| - if (GPFS == fh->f_fstype) { |
110 |
| - if (*priority < 50) { |
111 |
| - *priority = 50; |
112 |
| - return &gpfs; |
113 |
| - } |
114 |
| - } |
115 |
| - |
116 |
| - return NULL; |
| 79 | +mca_fs_gpfs_component_file_query (ompio_file_t *fh, int *priority) |
| 80 | +{ |
| 81 | + char *tmp; |
| 82 | + |
| 83 | + /* The code in this function is based on the ADIO FS selection in ROMIO |
| 84 | + * Copyright (C) 1997 University of Chicago. |
| 85 | + * See COPYRIGHT notice in top-level directory. |
| 86 | + */ |
| 87 | + |
| 88 | + *priority = mca_fs_gpfs_priority; |
| 89 | + |
| 90 | + tmp = strchr (fh->f_filename, ':'); |
| 91 | + if (!tmp) { |
| 92 | + if (OMPIO_ROOT == fh->f_rank) { |
| 93 | + fh->f_fstype = mca_fs_base_get_fstype ( fh->f_filename ); |
| 94 | + } |
| 95 | + fh->f_comm->c_coll->coll_bcast (&(fh->f_fstype), |
| 96 | + 1, |
| 97 | + MPI_INT, |
| 98 | + OMPIO_ROOT, |
| 99 | + fh->f_comm, |
| 100 | + fh->f_comm->c_coll->coll_bcast_module); |
| 101 | + } |
| 102 | + else { |
| 103 | + if (!strncmp(fh->f_filename, "gpfs:", 5) || |
| 104 | + !strncmp(fh->f_filename, "GPFS:", 5)) { |
| 105 | + fh->f_fstype = GPFS; |
| 106 | + } |
| 107 | + } |
| 108 | + |
| 109 | + if (GPFS == fh->f_fstype) { |
| 110 | + if (*priority < 50) { |
| 111 | + *priority = 50; |
| 112 | + return &gpfs; |
| 113 | + } |
| 114 | + } |
| 115 | + |
| 116 | + return NULL; |
117 | 117 | }
|
118 | 118 |
|
119 |
| -int mca_fs_gpfs_component_file_unquery(mca_io_ompio_file_t *file) { |
120 |
| - /* This function might be needed for some purposes later. for now it |
121 |
| - * does not have anything to do since there are no steps which need |
122 |
| - * to be undone if this module is not selected */ |
| 119 | +int mca_fs_gpfs_component_file_unquery (ompio_file_t *file) |
| 120 | +{ |
| 121 | + /* This function might be needed for some purposes later. for now it |
| 122 | + * does not have anything to do since there are no steps which need |
| 123 | + * to be undone if this module is not selected */ |
123 | 124 |
|
124 |
| - return OMPI_SUCCESS; |
| 125 | + return OMPI_SUCCESS; |
125 | 126 | }
|
126 | 127 |
|
127 |
| -int mca_fs_gpfs_module_init(mca_io_ompio_file_t *file) { |
128 |
| - return OMPI_SUCCESS; |
| 128 | +int mca_fs_gpfs_module_init (ompio_file_t *file) |
| 129 | +{ |
| 130 | + /* Make sure the file type is not overwritten by the last queried |
| 131 | + * component */ |
| 132 | + file->f_fstype = GPFS; |
| 133 | + return OMPI_SUCCESS; |
129 | 134 | }
|
130 | 135 |
|
131 |
| -int mca_fs_gpfs_module_finalize(mca_io_ompio_file_t *file) { |
132 |
| - return OMPI_SUCCESS; |
133 |
| -} |
134 | 136 |
|
| 137 | +int mca_fs_gpfs_module_finalize (ompio_file_t *file) |
| 138 | +{ |
| 139 | + return OMPI_SUCCESS; |
| 140 | +} |
0 commit comments