endif(LINUX)
option(WITH_BLUESTORE "Bluestore OSD backend" ON)
-if(${WITH_BLUESTORE})
- find_package(aio REQUIRED)
+if(WITH_BLUESTORE)
+ find_package(aio)
set(HAVE_LIBAIO ${AIO_FOUND})
-endif(${WITH_BLUESTORE})
+endif()
option(WITH_OPENLDAP "OPENLDAP is here" ON)
if(WITH_OPENLDAP)
bluestore/BlueStore.cc
bluestore/bluestore_types.cc
bluestore/FreelistManager.cc
- bluestore/KernelDevice.cc
bluestore/StupidAllocator.cc
bluestore/BitMapAllocator.cc
bluestore/BitAllocator.cc
- bluestore/aio.cc
)
endif(WITH_BLUESTORE)
+if(HAVE_LIBAIO)
+ list(APPEND libos_srcs
+ bluestore/KernelDevice.cc
+ bluestore/aio.cc)
+endif()
+
if(WITH_FUSE)
list(APPEND libos_srcs
FuseStore.cc)
#include <libgen.h>
#include <unistd.h>
+#include "BlockDevice.h"
+
+#if defined(HAVE_LIBAIO)
#include "KernelDevice.h"
+#endif
+
#if defined(HAVE_SPDK)
#include "NVMEDevice.h"
#endif
return new PMEMDevice(cct, cb, cbpriv);
}
#endif
-
+#if defined(HAVE_LIBAIO)
if (type == "kernel") {
return new KernelDevice(cct, cb, cbpriv);
}
+#endif
#if defined(HAVE_SPDK)
if (type == "ust-nvme") {
return new NVMEDevice(cct, cb, cbpriv);
#include <atomic>
#include <condition_variable>
-#include <mutex>
#include <list>
+#include <map>
+#include <mutex>
+#include <set>
+#include <string>
+#include <vector>
#include "acconfig.h"
+#ifdef HAVE_LIBAIO
#include "aio.h"
+#endif
+#include "include/assert.h"
+#include "include/buffer.h"
#define SPDK_PREFIX "spdk:"
+class CephContext;
+
/// track in-flight io
struct IOContext {
private:
std::atomic_int total_nseg = {0};
#endif
-
+#ifdef HAVE_LIBAIO
std::list<aio_t> pending_aios; ///< not yet submitted
std::list<aio_t> running_aios; ///< submitting or submitted
+#endif
std::atomic_int num_pending = {0};
std::atomic_int num_running = {0};
bool allow_eio;
virtual int collect_metadata(const std::string& prefix, std::map<std::string,std::string> *pm) const = 0;
- virtual int get_devname(string *out) {
+ virtual int get_devname(std::string *out) {
return -ENOENT;
}
- virtual int get_devices(set<string> *ls) {
- string s;
+ virtual int get_devices(std::set<std::string> *ls) {
+ std::string s;
if (get_devname(&s) == 0) {
ls->insert(s);
}
log_writer->append(bl);
int r = _flush(log_writer, true);
assert(r == 0);
+#ifdef HAVE_LIBAIO
if (!cct->_conf->bluefs_sync_write) {
list<aio_t> completed_ios;
_claim_completed_aios(log_writer, &completed_ios);
wait_for_aio(log_writer);
completed_ios.clear();
}
+#endif
flush_bdev();
dout(10) << __func__ << " writing super" << dendl;
return 0;
}
+#ifdef HAVE_LIBAIO
// we need to retire old completed aios so they don't stick around in
// memory indefinitely (along with their bufferlist refs).
void BlueFS::_claim_completed_aios(FileWriter *h, list<aio_t> *ls)
}
dout(10) << __func__ << " " << h << " done in " << (ceph_clock_now() - start) << dendl;
}
+#endif
int BlueFS::_flush(FileWriter *h, bool force)
{
void BlueFS::_flush_bdev_safely(FileWriter *h)
{
+#ifdef HAVE_LIBAIO
if (!cct->_conf->bluefs_sync_write) {
list<aio_t> completed_ios;
_claim_completed_aios(h, &completed_ios);
completed_ios.clear();
flush_bdev();
lock.lock();
- } else {
+ } else
+#endif
+ {
lock.unlock();
flush_bdev();
lock.lock();
int _flush(FileWriter *h, bool force);
int _fsync(FileWriter *h, std::unique_lock<std::mutex>& l);
+#ifdef HAVE_LIBAIO
void _claim_completed_aios(FileWriter *h, list<aio_t> *ls);
void wait_for_aio(FileWriter *h); // safe to call without a lock
+#endif
int _flush_and_sync_log(std::unique_lock<std::mutex>& l,
uint64_t want_seq = 0,
// a configurable (with different hdd and ssd defaults), and add
// that to the bytes value.
int ios = 1; // one "io" for the kv commit
+#ifdef HAVE_LIBAIO
for (auto& p : txc->ioc.pending_aios) {
ios += p.iov.size();
}
-
+#endif
#ifdef HAVE_SPDK
ios += txc->ioc.total_nseg;
#endif
OpSequencer *osr = txc->osr.get();
std::lock_guard<std::mutex> l(osr->qlock);
txc->state = TransContext::STATE_IO_DONE;
-
+#ifdef HAVE_LIBAIO
// release aio contexts (including pinned buffers).
txc->ioc.running_aios.clear();
-
+#endif
OpSequencer::q_list_t::iterator p = osr->q.iterator_to(*txc);
while (p != osr->q.begin()) {
--p;
#include "aio.h"
-#if defined(HAVE_LIBAIO)
-
std::ostream& operator<<(std::ostream& os, const aio_t& aio)
{
unsigned i = 0;
}
return r;
}
-
-#endif
// vim: ts=8 sw=2 smarttab
#pragma once
-
-#include "acconfig.h"
-#ifdef HAVE_LIBAIO
# include <libaio.h>
#include <boost/intrusive/list.hpp>
void *priv, int *retries);
int get_next_completed(int timeout_ms, aio_t **paio, int max);
};
-
-#endif