]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/blk/BlockDevice.cc
import quincy beta 17.1.0
[ceph.git] / ceph / src / blk / BlockDevice.cc
index 6804ee50cbcaa0f08af053d272c568a0edcabf88..fd07e443c1365f470861edef5be391ebafb0936b 100644 (file)
 
 using std::string;
 
+
+blk_access_mode_t buffermode(bool buffered) 
+{
+  return buffered ? blk_access_mode_t::BUFFERED : blk_access_mode_t::DIRECT;
+}
+
+std::ostream& operator<<(std::ostream& os, const blk_access_mode_t buffered) 
+{
+  os << (buffered == blk_access_mode_t::BUFFERED ? "(buffered)" : "(direct)");
+  return os;
+}
+
+
+
 void IOContext::aio_wait()
 {
   std::unique_lock l(lock);
@@ -104,8 +118,11 @@ BlockDevice::detect_device_type(const std::string& path)
     return block_device_t::hm_smr;
   }
 #endif
-
+#if defined(HAVE_LIBAIO) || defined(HAVE_POSIXAIO)
   return block_device_t::aio;
+#else
+  return block_device_t::unknown;
+#endif
 }
 
 BlockDevice::block_device_t
@@ -176,27 +193,6 @@ BlockDevice *BlockDevice::create(
   return create_with_type(device_type, cct, path, cb, cbpriv, d_cb, d_cbpriv);
 }
 
-void BlockDevice::queue_reap_ioc(IOContext *ioc)
-{
-  std::lock_guard l(ioc_reap_lock);
-  if (ioc_reap_count.load() == 0)
-    ++ioc_reap_count;
-  ioc_reap_queue.push_back(ioc);
-}
-
-void BlockDevice::reap_ioc()
-{
-  if (ioc_reap_count.load()) {
-    std::lock_guard l(ioc_reap_lock);
-    for (auto p : ioc_reap_queue) {
-      dout(20) << __func__ << " reap ioc " << p << dendl;
-      delete p;
-    }
-    ioc_reap_queue.clear();
-    --ioc_reap_count;
-  }
-}
-
 bool BlockDevice::is_valid_io(uint64_t off, uint64_t len) const {
   bool ret = (off % block_size == 0 &&
     len % block_size == 0 &&