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-2011 University of Houston. All rights reserved.
13 * Copyright (c) 2018 Research Organization for Information Science
14 * and Technology (RIST). All rights reserved.
15 * $COPYRIGHT$
16 *
17 * Additional copyrights may follow
18 *
19 * $HEADER$
20 */
21
22 /* This code is based on the PVFS2 ADIO module in ROMIO
23 * Copyright (C) 1997 University of Chicago.
24 * See COPYRIGHT notice in top-level directory.
25 */
26
27 #include "ompi_config.h"
28 #include "fs_pvfs2.h"
29
30 #include "mpi.h"
31 #include "ompi/constants.h"
32 #include "ompi/mca/fs/fs.h"
33
34 /*
35 * file_sync_pvfs2
36 *
37 * Function: - closes a new file
38 * Accepts: - file handle
39 * Returns: - Success if file closed
40 */
41 int
42 mca_fs_pvfs2_file_sync (ompio_file_t *fh)
43 {
44 int ret;
45 mca_fs_pvfs2 *pvfs2_fs;
46
47 ret = OMPI_SUCCESS;
48
49 pvfs2_fs = (mca_fs_pvfs2 *)fh->f_fs_ptr;
50
51 if (OMPIO_ROOT == fh->f_rank) {
52 ret = PVFS_sys_flush(pvfs2_fs->object_ref, &(pvfs2_fs->credentials));
53 }
54
55 fh->f_comm->c_coll->coll_bcast (&ret,
56 1,
57 MPI_INT,
58 OMPIO_ROOT,
59 fh->f_comm,
60 fh->f_comm->c_coll->coll_bcast_module);
61
62 if (0 != ret) {
63 return OMPI_ERROR;
64 }
65 return OMPI_SUCCESS;
66 }