1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 herr_t
 ss_blob_flush(ss_scope_t *topscope,     /* Determines the file being flushed, and thus the collectivity of the function. */
               ss_blob_t *blob,          /* Optional argument to restrict the flushing to a single dataset: the dataset to
                                          * which BLOB refers, which might also be used by other blobs.  If BLOB is not
                                          * specified then all blob datasets for the file are flushed.  When BLOB is defined on
                                          * a subset of the FILE communicator, the tasks that don't own the blob should pass
                                          * a non-null object (passing the FILE argument a second time is recommended) in order
                                          * to distinguish between this single-dataset case and the all-datasets case without
                                          * the need for collective communication. */
               unsigned flags,           /* Bit flags that describe how to flush the selected datasets. See
                                          * ss_blob_async_flush() for details. If none of the !FLUSH or !REAP bits are set then
                                          * async two-phase I/O is started but nothing is reaped. */
               ss_prop_t *props          /* Flushing properties (none defined at this time). */
               )
 {
     SS_ENTER(ss_blob_flush, herr_t);
     ss_gfile_t          *gfile=NULL;
     size_t              d_idx=SS_NOSIZE;
     ss_prop_t           *syncprops = NULL;

     gfile = SS_GFILE_LINK(topscope);
     SS_ASSERT(gfile);

     /* Initiate two-phase I/O for the specified dataset(s) */
     if (blob) {
         if (NULL==(syncprops=ss_prop_new("blob sync props"))) SS_ERROR(FAILED);
         d_idx = SS_BLOB(blob)->m.d_idx;
         if (ss_prop_add(syncprops, "dset", H5T_NATIVE_HID, &(gfile->gblob->d[d_idx].dset))<0) SS_ERROR(FAILED);
     }
     if (ss_blob_synchronize(topscope, syncprops)<0) SS_ERROR(FAILED);

     /* Wait for two-phase I/O to complete according to FLAGS. The ss_blob_async_flush_all() is independent. */
     if (flags & (SS_STRICT|SS_BLOB_FLUSH_SHIP|SS_BLOB_FLUSH_WRITE|SS_BLOB_REAP_SHIP|SS_BLOB_REAP_WRITE)) {
         SS_ASSERT(!blob || d_idx!=SS_NOSIZE)
         if (ss_blob_async_flush_all(gfile->gblob, d_idx, gfile->dxpl_independent, flags)<0) SS_ERROR(FAILED);
     }

     /* Successful cleanup */
     if (syncprops) ss_prop_dest(syncprops);
     syncprops = NULL;

     SS_CLEANUP:
     SS_LEAVE(0);
 }