00001
00002
00003
00004
00005
00006
00007
00008 #include "ad_pvfs2.h"
00009 #include "ad_pvfs2_common.h"
00010
00011
00012
00013
00014
00015
00016
00017
00018 void ADIOI_PVFS2_Flush(ADIO_File fd, int *error_code)
00019 {
00020 int ret, rank, dummy=0, dummy_in=0;
00021 ADIOI_PVFS2_fs *pvfs_fs;
00022 static char myname[] = "ADIOI_PVFS2_FLUSH";
00023
00024 *error_code = MPI_SUCCESS;
00025
00026 pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr;
00027
00028 MPI_Comm_rank(fd->comm, &rank);
00029
00030
00031
00032
00033 MPI_Reduce(&dummy_in, &dummy, 1, MPI_INT, MPI_SUM,
00034 fd->hints->ranklist[0], fd->comm);
00035
00036
00037 if (rank == fd->hints->ranklist[0]) {
00038 ret = PVFS_sys_flush(pvfs_fs->object_ref, &(pvfs_fs->credentials));
00039 }
00040 MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm);
00041
00042
00043 if (ret != 0) {
00044 *error_code = MPIO_Err_create_code(MPI_SUCCESS,
00045 MPIR_ERR_RECOVERABLE,
00046 myname, __LINE__,
00047 ADIOI_PVFS2_error_convert(ret),
00048 "Error in PVFS_sys_flush", 0);
00049 }
00050
00051 }
00052
00053
00054
00055