code: private void fsyncImpl(Result<Boolean> result, FsyncType fsyncType)
    {
      try {
        flushData();
        
        ArrayList<SegmentFsyncCallback> fsyncListeners
          = new ArrayList<>(_fsyncListeners);
        _fsyncListeners.clear();
        
        Result<Boolean> resultNext = result.then((v,r)->
          afterDataFsync(r, _position, fsyncType, fsyncListeners));
          
        if (_isDirty || ! fsyncType.isSchedule()) {
          _isDirty = false;
        
          try (OutStore sOut = _readWrite.openWrite(_segment.extent())) {
            if (fsyncType.isSchedule()) {
              sOut.fsyncSchedule(resultNext);
            }
            else {
              sOut.fsync(resultNext);
            }
          }
        }
        else {
          resultNext.ok(true);
        }
      } catch (Throwable e) {
        e.printStackTrace();
        result.fail(e);
      }
    }
docs: Syncs the segment to the disk. After the segment's data is synced, the
  headers can be written. A second sync is needed to complete the header
  writes.