root/ompi/mca/io/romio321/romio/adio/ad_pvfs2/ad_pvfs2_flush.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. ADIOI_PVFS2_Flush

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /* 
   3  *
   4  *   Copyright (C) 1997 University of Chicago. 
   5  *   See COPYRIGHT notice in top-level directory.
   6  */
   7 
   8 #include "ad_pvfs2.h"
   9 #include "ad_pvfs2_common.h"
  10 
  11 /* we want to be a bit clever here:  at scale, if every client sends a
  12  * flush request, it will stress the PVFS2 servers with redundant
  13  * PVFS_sys_flush requests.  Instead, one process should wait for
  14  * everyone to catch up, do the sync, then broadcast the result.  We can
  15  * get away with this thanks to PVFS2's stateless design 
  16  */
  17 
  18 void ADIOI_PVFS2_Flush(ADIO_File fd, int *error_code) 
  19 { 
  20     int ret, rank, dummy=0, dummy_in=0; 
  21     ADIOI_PVFS2_fs *pvfs_fs;
  22     static char myname[] = "ADIOI_PVFS2_FLUSH";
  23 
  24     *error_code = MPI_SUCCESS;
  25 
  26     pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr;
  27 
  28     MPI_Comm_rank(fd->comm, &rank);
  29 
  30 
  31     /* unlike ADIOI_PVFS2_Resize, MPI_File_sync() does not perform any
  32      * syncronization */
  33     MPI_Reduce(&dummy_in, &dummy, 1, MPI_INT, MPI_SUM, 
  34             fd->hints->ranklist[0], fd->comm);
  35 
  36     /* io_worker computed in ADIO_Open */
  37     if (rank == fd->hints->ranklist[0]) {
  38         ret = PVFS_sys_flush(pvfs_fs->object_ref, &(pvfs_fs->credentials));
  39     }
  40     MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm);
  41 
  42     /* --BEGIN ERROR HANDLING-- */
  43     if (ret != 0) {
  44         *error_code = MPIO_Err_create_code(MPI_SUCCESS,
  45                                            MPIR_ERR_RECOVERABLE,
  46                                            myname, __LINE__,
  47                                            ADIOI_PVFS2_error_convert(ret),
  48                                            "Error in PVFS_sys_flush", 0);
  49     }
  50     /* --END ERROR HANDLING-- */
  51 }
  52 
  53 /* 
  54  * vim: ts=8 sts=4 sw=4 noexpandtab 
  55  */

/* [<][>][^][v][top][bottom][index][help] */