Skip to content

Commit d3c1139

Browse files
cniethammeredgargabriel
authored andcommitted
First code review round of the GPFS module.
Delete check for amode which should go to a higler layer, e.g. ompi_file_open. Only perform Info value check if key is found. Signed-off-by: Edgar Gabriel <[email protected]>
1 parent b1dc58e commit d3c1139

File tree

8 files changed

+654
-1033
lines changed

8 files changed

+654
-1033
lines changed

ompi/mca/fs/gpfs/fs_gpfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 2004-2007 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
9-
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* Copyright (c) 2004-2015 High Performance Computing Center Stuttgart,
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
@@ -26,6 +26,7 @@
2626
#include "ompi/mca/fs/gpfs/fs_gpfs.h"
2727

2828
#ifdef HAVE_SYS_STATFS_H
29+
/*CN: Check which is prefered, already checked/used in OMPI */
2930
#include <sys/statfs.h> /* or <sys/vfs.h> */
3031
#endif
3132
#ifdef HAVE_SYS_PARAM_H

ompi/mca/fs/gpfs/fs_gpfs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 2004-2007 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
9-
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* Copyright (c) 2004-2015 High Performance Computing Center Stuttgart,
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
@@ -66,6 +66,7 @@ int mca_fs_gpfs_prefetch_hints(int access_mode,
6666
int mca_fs_gpfs_io_selection(mca_io_ompio_file_t *fh,
6767
struct ompi_info_t *info, struct ompi_info_t *info_selected);
6868
int mca_fs_gpfs_file_sync(struct ompi_file_t *fh);
69+
//CN: Is mca_fs_gpfs_file_seek needed at all. Not used anywhere!
6970
int
7071
mca_fs_gpfs_file_seek(struct ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE off,
7172
int whence);

ompi/mca/fs/gpfs/fs_gpfs_component.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
const char *mca_fs_gpfs_component_version_string =
2828
"OMPI/MPI gpfs FS MCA component version " OMPI_VERSION;
2929

30-
static int gpfs_register(void);
30+
static int gpfs_register(void);
3131

3232
int mca_fs_gpfs_priority = 20;
33-
33+
3434
/*
3535
* Instantiate the public struct with all of our public information
3636
* and pointers to our public functions in it
@@ -50,8 +50,8 @@ mca_fs_base_component_2_0_0_t mca_fs_gpfs_component = {
5050
OMPI_RELEASE_VERSION,
5151
NULL,
5252
NULL,
53-
NULL,
54-
gpfs_register
53+
NULL,
54+
gpfs_register
5555
},
5656
{
5757
/* This component is checkpointable */

ompi/mca/fs/gpfs/fs_gpfs_file_delete.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright (c) 2004-2011 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
8-
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
8+
* Copyright (c) 2004-2015 High Performance Computing Center Stuttgart,
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
@@ -27,7 +27,7 @@
2727
#include "ompi/mca/fs/fs.h"
2828

2929
/*
30-
* file_delete_lustre
30+
* file_delete_gpfs
3131
*
3232
* Function: - deletes a file
3333
* Accepts: - file name & info
@@ -37,7 +37,7 @@ int
3737
mca_fs_gpfs_file_delete (char *filename,
3838
struct ompi_info_t *info)
3939
{
40-
printf("Using mca_fs_gpfs_file_delete to delete a file.\n");
40+
//DEBUG: fprintf(stderr, "Using mca_fs_gpfs_file_delete to delete a file.\n");
4141
int ret = OMPI_SUCCESS;
4242

4343
ret = unlink(filename);

ompi/mca/fs/gpfs/fs_gpfs_file_get_size.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright (c) 2004-2011 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
8-
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
8+
* Copyright (c) 2004-2015 High Performance Computing Center Stuttgart,
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
@@ -36,7 +36,7 @@ int
3636
mca_fs_gpfs_file_get_size (mca_io_ompio_file_t *fh,
3737
OMPI_MPI_OFFSET_TYPE *size)
3838
{
39-
printf ("GPFS GET SIZE\n");
39+
//DEBUG: fprintf (stderr, "GPFS GET SIZE\n");
4040
*size = lseek(fh->fd, 0, SEEK_END);
4141
if (-1 == *size) {
4242
perror ("lseek");

ompi/mca/fs/gpfs/fs_gpfs_file_open.c

Lines changed: 59 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright (c) 2004-2005 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
8-
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
8+
* Copyright (c) 2004-2015 High Performance Computing Center Stuttgart,
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
@@ -41,7 +41,7 @@
4141

4242
int
4343
mca_fs_gpfs_file_open (struct ompi_communicator_t *comm,
44-
char* filename,
44+
char* filename,
4545
int access_mode,
4646
struct ompi_info_t *info,
4747
mca_io_ompio_file_t *fh)
@@ -60,35 +60,30 @@ mca_fs_gpfs_file_open (struct ompi_communicator_t *comm,
6060

6161
amode = 0;
6262

63-
if (access_mode & MPI_MODE_CREATE)
63+
if (access_mode & MPI_MODE_CREATE) {
6464
amode = amode | O_CREAT;
65-
if (access_mode & MPI_MODE_RDONLY)
65+
}
66+
if (access_mode & MPI_MODE_RDONLY) {
6667
amode = amode | O_RDONLY;
67-
if (access_mode & MPI_MODE_WRONLY)
68+
}
69+
if (access_mode & MPI_MODE_WRONLY) {
6870
amode = amode | O_WRONLY;
69-
if (access_mode & MPI_MODE_RDWR)
71+
}
72+
if (access_mode & MPI_MODE_RDWR) {
7073
amode = amode | O_RDWR;
71-
if (access_mode & MPI_MODE_EXCL)
74+
}
75+
if (access_mode & MPI_MODE_EXCL) {
7276
amode = amode | O_EXCL;
77+
}
78+
79+
//DEBUG: fprintf(stderr, "Opening a file using Linux open() within fs_gpfs_file_open\n");
7380

74-
printf("Opening a file using Linux open() within fs_gpfs_file_open\n");
75-
76-
// for DEBUG
77-
//int gdb = 0;
78-
//char hostname[256];
79-
//gethostname(hostname, sizeof(hostname));
80-
//printf("PID %d on %s ready for attach\n", getpid(), hostname);
81-
//fflush(stdout);
82-
//while (0 == gdb)
83-
//sleep(5);
84-
8581
fh->fd = open (filename, amode, perm);
8682
if (-1 == fh->fd) {
8783
return OMPI_ERROR;
8884
}
8985

9086
fh->f_amode=access_mode;
91-
//Setting GPFS Hints
9287
mca_fs_gpfs_file_set_info(fh, info);
9388

9489
return OMPI_SUCCESS;
@@ -107,53 +102,55 @@ mca_fs_gpfs_file_get_amode (ompi_file_t *fh,
107102
return OMPI_SUCCESS;
108103
}
109104

110-
int mca_fs_gpfs_file_seek(ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE off, int whence) {
111-
printf("GPFS FILE SEEK!");
112-
int ret = OMPI_SUCCESS;
113-
mca_io_ompio_data_t *data;
114-
OMPI_MPI_OFFSET_TYPE offset, temp_offset;
115-
116-
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
117-
118-
offset = off * data->ompio_fh.f_etype_size;
119-
120-
switch (whence) {
121-
case MPI_SEEK_SET:
122-
if (offset < 0) {
123-
return OMPI_ERROR;
124-
}
125-
break;
126-
case MPI_SEEK_CUR:
127-
offset += data->ompio_fh.f_position_in_file_view;
128-
offset += data->ompio_fh.f_disp;
129-
if (offset < 0) {
130-
return OMPI_ERROR;
131-
}
132-
break;
133-
case MPI_SEEK_END:
134-
ret = data->ompio_fh.f_fs->fs_file_get_size(&data->ompio_fh,
135-
&temp_offset);
136-
offset += temp_offset;
137-
if (offset < 0 || OMPI_SUCCESS != ret) {
138-
return OMPI_ERROR;
139-
}
140-
break;
141-
default:
142-
return OMPI_ERROR;
143-
}
144-
145-
ret = ompi_io_ompio_set_explicit_offset(&data->ompio_fh, offset
146-
/ data->ompio_fh.f_etype_size);
147-
return ret;
105+
//CN: Is mca_fs_gpfs_file_seek needed at all. Not used anywhere!
106+
int
107+
mca_fs_gpfs_file_seek(ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE off, int whence) {
108+
//DEBUG: fprintf(stderr, "GPFS FILE SEEK!");
109+
int ret = OMPI_SUCCESS;
110+
mca_io_ompio_data_t *data;
111+
OMPI_MPI_OFFSET_TYPE offset, temp_offset;
112+
113+
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
114+
115+
offset = off * data->ompio_fh.f_etype_size;
116+
117+
switch (whence) {
118+
case MPI_SEEK_SET:
119+
if (offset < 0) {
120+
return OMPI_ERROR;
121+
}
122+
break;
123+
case MPI_SEEK_CUR:
124+
offset += data->ompio_fh.f_position_in_file_view;
125+
offset += data->ompio_fh.f_disp;
126+
if (offset < 0) {
127+
return OMPI_ERROR;
128+
}
129+
break;
130+
case MPI_SEEK_END:
131+
ret = data->ompio_fh.f_fs->fs_file_get_size(&data->ompio_fh,
132+
&temp_offset);
133+
offset += temp_offset;
134+
if (offset < 0 || OMPI_SUCCESS != ret) {
135+
return OMPI_ERROR;
136+
}
137+
break;
138+
default:
139+
return OMPI_ERROR;
140+
}
141+
142+
ret = ompi_io_ompio_set_explicit_offset(&data->ompio_fh, offset
143+
/ data->ompio_fh.f_etype_size);
144+
return ret;
148145
}
149146

150147
int mca_fs_gpfs_file_get_position(ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE *offset) {
151-
mca_io_ompio_data_t *data;
148+
mca_io_ompio_data_t *data;
152149

153-
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
150+
data = (mca_io_ompio_data_t *) fh->f_io_selected_data;
154151

155-
*offset = data->ompio_fh.f_position_in_file_view
156-
/ data->ompio_fh.f_etype_size;
152+
*offset = data->ompio_fh.f_position_in_file_view
153+
/ data->ompio_fh.f_etype_size;
157154

158-
return OMPI_SUCCESS;
155+
return OMPI_SUCCESS;
159156
}

0 commit comments

Comments
 (0)