src/worker.cc
// Open a device, return false on failure.
Open a device, return false on failure.
Open a device return false on failure .
bool DiskThread::OpenDevice(int *pfile) {
  bool no_O_DIRECT = false;
  int flags = O_RDWR | O_SYNC | O_LARGEFILE;
  int fd = open(device_name_.c_str(), flags | O_DIRECT, 0);
  if (O_DIRECT != 0 && fd < 0 && errno == EINVAL) {
    no_O_DIRECT = true;
    fd = open(device_name_.c_str(), flags, 0); 
  }
  if (fd < 0) {
    logprintf(0, "Process Error: Failed to open device %s (thread %d)!!\n",
              device_name_.c_str(), thread_num_);
    return false;
  }
  if (no_O_DIRECT)
    os_->ActivateFlushPageCache();
  *pfile = fd;
  return GetDiskSize(fd);
}
bool DiskThread :: OpenDevice ( int * pfile ) { bool no_O_DIRECT = false ; int flags = O_RDWR | O_SYNC | O_LARGEFILE ; int fd = open ( device_name_ . c_str ( ) , flags | O_DIRECT , 0 ) ; if ( O_DIRECT != 0 && fd < 0 && errno == EINVAL ) { no_O_DIRECT = true ; fd = open ( device_name_ . c_str ( ) , flags , 0 ) ; } if ( fd < 0 ) { logprintf ( 0 , " \n " , device_name_ . c_str ( ) , thread_num_ ) ; return false ; } if ( no_O_DIRECT ) os_ -> ActivateFlushPageCache ( ) ; * pfile = fd ; return GetDiskSize ( fd ) ; }
Open a device, return false on failure.
Open a device return false on failure .
// Try without O_DIRECT