root/ompi/mca/io/romio321/romio/adio/ad_zoidfs/ad_zoidfs_resize.c

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

DEFINITIONS

This source file includes following definitions.
  1. ADIOI_ZOIDFS_Resize

   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_zoidfs.h"
   9 #include "ad_zoidfs_common.h"
  10 
  11 /* as with flush, implement the resize operation in a scalable
  12  * manner. one process does the work, then broadcasts the result to everyone
  13  * else.  fortunately, this operation is defined to be collective */
  14 void ADIOI_ZOIDFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code)
  15 {
  16     int ret, rank;
  17     ADIOI_ZOIDFS_object *zoidfs_obj_ptr;
  18     static char myname[] = "ADIOI_ZOIDFS_RESIZE";
  19 
  20     *error_code = MPI_SUCCESS;
  21 
  22     zoidfs_obj_ptr = (ADIOI_ZOIDFS_object *)fd->fs_ptr;
  23 
  24     MPI_Comm_rank(fd->comm, &rank);
  25 
  26 
  27     /* MPI-IO semantics treat conflicting MPI_File_set_size requests the
  28      * same as conflicting write requests. Thus, a resize from one
  29      * process does not have to be visible to the other processes until a
  30      * syncronization point is reached */
  31 
  32     if (rank == fd->hints->ranklist[0]) {
  33         NO_STALE(ret, fd, zoidfs_obj_ptr,
  34                  zoidfs_resize(zoidfs_obj_ptr, size, ZOIDFS_NO_OP_HINT));
  35         MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm);
  36     } else  {
  37         MPI_Bcast(&ret, 1, MPI_INT, fd->hints->ranklist[0], fd->comm);
  38     }
  39     /* --BEGIN ERROR HANDLING-- */
  40     if (ret != ZFS_OK) {
  41         *error_code = MPIO_Err_create_code(MPI_SUCCESS,
  42                                            MPIR_ERR_RECOVERABLE,
  43                                            myname, __LINE__,
  44                                            ADIOI_ZOIDFS_error_convert(ret),
  45                                            "Error in zoidfs_resize", 0);
  46         return;
  47     }
  48     /* --END ERROR HANDLING-- */
  49 }
  50 
  51 /*
  52  * vim: ts=8 sts=4 sw=4 noexpandtab 
  53  */

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