Skip to content

Commit 217dcca

Browse files
committed
- the memory chunk that has to be allocated for the llapi_get_stripe function seems to have changed compared to earlier version. This implementation now follows the code snipplet from the man pages.
- implementation of file_get_size and set_size
1 parent 6eba52a commit 217dcca

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

ompi/mca/fs/lustre/fs_lustre_file_get_size.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,18 @@
3333
* Returns: - Success if size is get
3434
*/
3535
int
36-
mca_fs_lustre_file_get_size (mca_io_ompio_file_t *file_handle,
36+
mca_fs_lustre_file_get_size (mca_io_ompio_file_t *fh,
3737
OMPI_MPI_OFFSET_TYPE *size)
3838
{
39-
printf ("LUSTRE GET SIZE\n");
39+
*size = lseek(fh->fd, 0, SEEK_END);
40+
if (-1 == *size) {
41+
perror ("lseek");
42+
return OMPI_ERROR;
43+
}
44+
45+
if (-1 == (lseek(fh->fd, fh->f_offset, SEEK_SET))) {
46+
perror ("lseek");
47+
return OMPI_ERROR;
48+
}
4049
return OMPI_SUCCESS;
4150
}

ompi/mca/fs/lustre/fs_lustre_file_set_size.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,21 @@
3333
* Returns: - Success if size is set
3434
*/
3535
int
36-
mca_fs_lustre_file_set_size (mca_io_ompio_file_t *file_handle,
36+
mca_fs_lustre_file_set_size (mca_io_ompio_file_t *fh,
3737
OMPI_MPI_OFFSET_TYPE size)
3838
{
39-
printf ("LUSTRE SET SIZE\n");
39+
int err = 0;
40+
41+
err = ftruncate(fh->fd, size);
42+
43+
fh->f_comm->c_coll.coll_bcast (&err,
44+
1,
45+
MPI_INT,
46+
OMPIO_ROOT,
47+
fh->f_comm,
48+
fh->f_comm->c_coll.coll_bcast_module);
49+
if (-1 == err) {
50+
return OMPI_ERROR;
51+
}
4052
return OMPI_SUCCESS;
4153
}

0 commit comments

Comments
 (0)