CkIO: Progressive fall back from fdatasync
authorPhil Miller <mille121@illinois.edu>
Thu, 25 Jul 2013 00:23:29 +0000 (19:23 -0500)
committerPhil Miller <mille121@illinois.edu>
Tue, 20 Aug 2013 23:29:03 +0000 (18:29 -0500)
src/libs/ck-libs/io/ckio.C

index 84ec209de2a49e724831c30e4ae77436e35986dd..24f6f8b064be8705f528896149fa467299a56346 100644 (file)
@@ -302,8 +302,19 @@ namespace Ck { namespace IO {
 
         void syncData() {
           CkAssert(bufferMap.size() == 0);
+#if CMK_HAS_FDATASYNC_FUNC
           if (fdatasync(file->fd) < 0)
             fatalError("fdatasync failed", file->name);
+#elif CMK_HAS_FSYNC_FUNC
+          if (fsync(file->fd) < 0)
+            fatalError("fsync failed", file->name);
+#elif CMK_HAS_SYNC_FUNC
+#warning "Will call sync() for every completed write"
+          sync(); // No error reporting from sync()
+#else
+#warning "No file synchronization function available!"
+#endif
+
           contribute(complete);
           contribute(CkCallback(CkIndex_WriteSession::ckDestroy(), thisProxy));
         }