root/ompi/mca/io/romio321/romio/adio/common/ad_opencoll_scalable.c

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

DEFINITIONS

This source file includes following definitions.
  1. ADIOI_SCALEABLE_OpenColl

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /* 
   3  *
   4  *   Copyright (C) 2007 UChicago/Argonne LLC
   5  *   See COPYRIGHT notice in top-level directory.
   6  */
   7 
   8 #include "adio.h"
   9 
  10 /* 
  11  * Scalable open:  for file systems capable of having one process
  12  * create/open a file and broadcast the result to everyone else. 
  13  * - Does not need one process to create the file
  14  * - Does not need special handling for CREATE|EXCL
  15  */
  16 void ADIOI_SCALEABLE_OpenColl(ADIO_File fd, int rank, 
  17                 int access_mode, int *error_code)
  18 {    
  19     int orig_amode_wronly;
  20 
  21     /* if we are doing deferred open, non-aggregators should return now */
  22     if (fd->hints->deferred_open && !(fd->is_agg)) {
  23         *error_code = MPI_SUCCESS;
  24         return;
  25     } 
  26     
  27     /* For writing with data sieving, a read-modify-write is needed. If 
  28        the file is opened for write_only, the read will fail. Therefore,
  29        if write_only, open the file as read_write, but record it as
  30        write_only in fd, so that get_amode returns the right answer. */
  31 
  32     orig_amode_wronly = access_mode;
  33     if (access_mode & ADIO_WRONLY) {
  34         access_mode = access_mode ^ ADIO_WRONLY;
  35         access_mode = access_mode | ADIO_RDWR;
  36     }
  37     fd->access_mode = access_mode;
  38 
  39     (*(fd->fns->ADIOI_xxx_Open))(fd, error_code);
  40 
  41     /* if error, may be it was due to the change in amode above. 
  42        therefore, reopen with access mode provided by the user.*/ 
  43     fd->access_mode = orig_amode_wronly;  
  44     if (*error_code != MPI_SUCCESS) 
  45         (*(fd->fns->ADIOI_xxx_Open))(fd, error_code);
  46 
  47     /* for deferred open: this process has opened the file (because if we are
  48      * not an aggregaor and we are doing deferred open, we returned earlier)*/
  49     fd->is_open = 1;
  50 
  51 }
  52 
  53 /* 
  54  * vim: ts=8 sts=4 sw=4 noexpandtab 
  55  */

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