Skip to content

Commit 715a6e8

Browse files
committed
fs/gpfs: update component and module file
to match what we are doing meanwhile in the other fs compomenents. Signed-off-by: Edgar Gabriel <[email protected]>
1 parent 8d31ba3 commit 715a6e8

File tree

8 files changed

+112
-352
lines changed

8 files changed

+112
-352
lines changed

ompi/mca/fs/base/fs_base_get_parent_dir.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ int mca_fs_base_get_fstype(char *fname )
135135
else if ( 0 == strncasecmp(fstype, "ime", sizeof("ime"))) {
136136
ompio_type = IME;
137137
}
138+
else if ( 0 == strncasecmp(fstype, "gpfs", sizeof("gpfs"))) {
139+
ompio_type = GPFS;
140+
}
138141

139142
free (fstype);
140143
return ompio_type;

ompi/mca/fs/gpfs/fs_gpfs.c

Lines changed: 84 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
1-
/* -*- Mode: C; c-basic-offset:4 ; -*- */
21
/*
32
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
43
* University Research and Technology
54
* 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
76
* of Tennessee Research Foundation. All rights
87
* reserved.
9-
* Copyright (c) 2004-2015 High Performance Computing Center Stuttgart,
8+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
109
* University of Stuttgart. All rights reserved.
1110
* Copyright (c) 2004-2005 The Regents of the University of California.
1211
* 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.
1515
* $COPYRIGHT$
16-
*
16+
*
1717
* Additional copyrights may follow
18-
*
18+
*
1919
* $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
2026
*/
2127

2228
#include "ompi_config.h"
@@ -26,8 +32,7 @@
2632
#include "ompi/mca/fs/gpfs/fs_gpfs.h"
2733

2834
#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> */
3136
#endif
3237
#ifdef HAVE_SYS_PARAM_H
3338
#include <sys/param.h>
@@ -39,96 +44,97 @@
3944
#include <sys/stat.h>
4045
#endif
4146

47+
#include <sys/ioctl.h>
48+
4249
/*
4350
* *******************************************************************
4451
* ************************ actions structure ************************
4552
* *******************************************************************
4653
*/
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+
};
5364
/*
5465
* *******************************************************************
5566
* ************************* structure ends **************************
5667
* *******************************************************************
5768
*/
5869

5970
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 */
6274

63-
return OMPI_SUCCESS;
75+
return OMPI_SUCCESS;
6476
}
6577

6678
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;
117117
}
118118

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 */
123124

124-
return OMPI_SUCCESS;
125+
return OMPI_SUCCESS;
125126
}
126127

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;
129134
}
130135

131-
int mca_fs_gpfs_module_finalize(mca_io_ompio_file_t *file) {
132-
return OMPI_SUCCESS;
133-
}
134136

137+
int mca_fs_gpfs_module_finalize (ompio_file_t *file)
138+
{
139+
return OMPI_SUCCESS;
140+
}

ompi/mca/fs/gpfs/fs_gpfs_component.c

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,34 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
12
/*
2-
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
3+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
34
* University Research and Technology
45
* Corporation. All rights reserved.
56
* Copyright (c) 2004-2005 The University of Tennessee and The University
67
* of Tennessee Research Foundation. All rights
78
* reserved.
8-
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
910
* University of Stuttgart. All rights reserved.
1011
* Copyright (c) 2004-2005 The Regents of the University of California.
1112
* All rights reserved.
1213
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
14+
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
15+
* reserved.
1316
* $COPYRIGHT$
14-
*
17+
*
1518
* Additional copyrights may follow
16-
*
19+
*
1720
* $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
24+
* files, keeping these symbols as the only symbols in this file
25+
* prevents utility programs such as "ompi_info" from having to import
26+
* entire components just to query their version and parameters.
1827
*/
1928

2029
#include "ompi_config.h"
21-
#include "mpi.h"
2230
#include "fs_gpfs.h"
31+
#include "mpi.h"
2332

2433
/*
2534
* Public string showing the fs gpfs component version number
@@ -30,7 +39,6 @@ const char *mca_fs_gpfs_component_version_string =
3039
static int gpfs_register(void);
3140

3241
int mca_fs_gpfs_priority = 20;
33-
3442
/*
3543
* Instantiate the public struct with all of our public information
3644
* and pointers to our public functions in it
@@ -40,30 +48,25 @@ mca_fs_base_component_2_0_0_t mca_fs_gpfs_component = {
4048
/* First, the mca_component_t struct containing meta information
4149
about the component itself */
4250

43-
{
51+
.fsm_version = {
4452
MCA_FS_BASE_VERSION_2_0_0,
4553

4654
/* Component name and version */
47-
"gpfs",
48-
OMPI_MAJOR_VERSION,
49-
OMPI_MINOR_VERSION,
50-
OMPI_RELEASE_VERSION,
51-
NULL,
52-
NULL,
53-
NULL,
54-
gpfs_register
55+
.mca_component_name = "gpfs",
56+
MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
57+
OMPI_RELEASE_VERSION),
58+
.mca_register_component_params = gpfs_register,
5559
},
56-
{
60+
.fsm_data = {
5761
/* This component is checkpointable */
5862
MCA_BASE_METADATA_PARAM_CHECKPOINT
5963
},
60-
mca_fs_gpfs_component_init_query, /* get thread level */
61-
mca_fs_gpfs_component_file_query, /* get priority and actions */
62-
mca_fs_gpfs_component_file_unquery /* undo what was done by previous function */
64+
.fsm_init_query = mca_fs_gpfs_component_init_query, /* get thread level */
65+
.fsm_file_query = mca_fs_gpfs_component_file_query, /* get priority and actions */
66+
.fsm_file_unquery = mca_fs_gpfs_component_file_unquery, /* undo what was done by previous function */
6367
};
6468

65-
static int
66-
gpfs_register(void)
69+
static int gpfs_register(void)
6770
{
6871
mca_fs_gpfs_priority = 20;
6972
(void) mca_base_component_var_register(&mca_fs_gpfs_component.fsm_version,
@@ -72,4 +75,4 @@ gpfs_register(void)
7275
OPAL_INFO_LVL_9,
7376
MCA_BASE_VAR_SCOPE_READONLY, &mca_fs_gpfs_priority);
7477
return OMPI_SUCCESS;
75-
}
78+
}

ompi/mca/fs/gpfs/fs_gpfs_file_close.c

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)