]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os: rename aio.h to avoid conflict
authorKefu Chai <kchai@redhat.com>
Tue, 18 Dec 2018 11:31:15 +0000 (19:31 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 21 Dec 2018 16:20:56 +0000 (00:20 +0800)
FreeBSD's libc offers <aio.h>.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/os/bluestore/BlockDevice.h
src/os/bluestore/KernelDevice.h
src/os/bluestore/PMEMDevice.h
src/os/bluestore/aio.cc
src/os/bluestore/aio.h [deleted file]
src/os/bluestore/ceph_aio.h [new file with mode: 0644]

index 5faa26073bafe8a9068f36100c0892e2e60509e0..92c1443546b456b97cde9a7f5efbdf372ef3d595 100644 (file)
@@ -30,7 +30,7 @@
 #include "common/ceph_mutex.h"
 
 #ifdef HAVE_LIBAIO
-#include "aio.h"
+#include "ceph_aio.h"
 #endif
 #include "include/ceph_assert.h"
 #include "include/buffer.h"
index e4dbcda37048a2c417a99d25acc2002d5d36811c..e24b45b3ac08401651816c67b960466477c6eacf 100644 (file)
@@ -22,7 +22,7 @@
 #include "common/Thread.h"
 #include "include/utime.h"
 
-#include "aio.h"
+#include "ceph_aio.h"
 #include "BlockDevice.h"
 
 class KernelDevice : public BlockDevice {
index 51c602968db1c271555da0e10670c91551cf715d..3077375a2ac85f99aaafe32a4223ba18d8da6863 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "os/fs/FS.h"
 #include "include/interval_set.h"
-#include "aio.h"
+#include "ceph_aio.h"
 #include "BlockDevice.h"
 
 class PMEMDevice : public BlockDevice {
index 4811434492597a4503b1a779ba0d47e791287539..46856b85b61d01924dcfbd692bc1981664b20c77 100644 (file)
@@ -2,7 +2,7 @@
 // vim: ts=8 sw=2 smarttab
 
 #include <algorithm>
-#include "aio.h"
+#include "ceph_aio.h"
 
 std::ostream& operator<<(std::ostream& os, const aio_t& aio)
 {
diff --git a/src/os/bluestore/aio.h b/src/os/bluestore/aio.h
deleted file mode 100644 (file)
index bc6acb7..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-
-#pragma once
-# include <libaio.h>
-
-#include <boost/intrusive/list.hpp>
-#include <boost/container/small_vector.hpp>
-
-#include "include/buffer.h"
-#include "include/types.h"
-
-struct aio_t {
-  struct iocb iocb{};  // must be first element; see shenanigans in aio_queue_t
-  void *priv;
-  int fd;
-  boost::container::small_vector<iovec,4> iov;
-  uint64_t offset, length;
-  long rval;
-  bufferlist bl;  ///< write payload (so that it remains stable for duration)
-
-  boost::intrusive::list_member_hook<> queue_item;
-
-  aio_t(void *p, int f) : priv(p), fd(f), offset(0), length(0), rval(-1000) {
-  }
-
-  void pwritev(uint64_t _offset, uint64_t len) {
-    offset = _offset;
-    length = len;
-    io_prep_pwritev(&iocb, fd, &iov[0], iov.size(), offset);
-  }
-  void pread(uint64_t _offset, uint64_t len) {
-    offset = _offset;
-    length = len;
-    bufferptr p = buffer::create_small_page_aligned(length);
-    io_prep_pread(&iocb, fd, p.c_str(), length, offset);
-    bl.append(std::move(p));
-  }
-
-  long get_return_value() {
-    return rval;
-  }
-};
-
-std::ostream& operator<<(std::ostream& os, const aio_t& aio);
-
-typedef boost::intrusive::list<
-  aio_t,
-  boost::intrusive::member_hook<
-    aio_t,
-    boost::intrusive::list_member_hook<>,
-    &aio_t::queue_item> > aio_list_t;
-
-struct aio_queue_t {
-  int max_iodepth;
-  io_context_t ctx;
-
-  typedef list<aio_t>::iterator aio_iter;
-
-  explicit aio_queue_t(unsigned max_iodepth)
-    : max_iodepth(max_iodepth),
-      ctx(0) {
-  }
-  ~aio_queue_t() {
-    ceph_assert(ctx == 0);
-  }
-
-  int init() {
-    ceph_assert(ctx == 0);
-    int r = io_setup(max_iodepth, &ctx);
-    if (r < 0) {
-      if (ctx) {
-       io_destroy(ctx);
-       ctx = 0;
-      }
-    }
-    return r;
-  }
-  void shutdown() {
-    if (ctx) {
-      int r = io_destroy(ctx);
-      ceph_assert(r == 0);
-      ctx = 0;
-    }
-  }
-
-  int submit_batch(aio_iter begin, aio_iter end, uint16_t aios_size, 
-                  void *priv, int *retries);
-  int get_next_completed(int timeout_ms, aio_t **paio, int max);
-};
diff --git a/src/os/bluestore/ceph_aio.h b/src/os/bluestore/ceph_aio.h
new file mode 100644 (file)
index 0000000..bc6acb7
--- /dev/null
@@ -0,0 +1,90 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#pragma once
+# include <libaio.h>
+
+#include <boost/intrusive/list.hpp>
+#include <boost/container/small_vector.hpp>
+
+#include "include/buffer.h"
+#include "include/types.h"
+
+struct aio_t {
+  struct iocb iocb{};  // must be first element; see shenanigans in aio_queue_t
+  void *priv;
+  int fd;
+  boost::container::small_vector<iovec,4> iov;
+  uint64_t offset, length;
+  long rval;
+  bufferlist bl;  ///< write payload (so that it remains stable for duration)
+
+  boost::intrusive::list_member_hook<> queue_item;
+
+  aio_t(void *p, int f) : priv(p), fd(f), offset(0), length(0), rval(-1000) {
+  }
+
+  void pwritev(uint64_t _offset, uint64_t len) {
+    offset = _offset;
+    length = len;
+    io_prep_pwritev(&iocb, fd, &iov[0], iov.size(), offset);
+  }
+  void pread(uint64_t _offset, uint64_t len) {
+    offset = _offset;
+    length = len;
+    bufferptr p = buffer::create_small_page_aligned(length);
+    io_prep_pread(&iocb, fd, p.c_str(), length, offset);
+    bl.append(std::move(p));
+  }
+
+  long get_return_value() {
+    return rval;
+  }
+};
+
+std::ostream& operator<<(std::ostream& os, const aio_t& aio);
+
+typedef boost::intrusive::list<
+  aio_t,
+  boost::intrusive::member_hook<
+    aio_t,
+    boost::intrusive::list_member_hook<>,
+    &aio_t::queue_item> > aio_list_t;
+
+struct aio_queue_t {
+  int max_iodepth;
+  io_context_t ctx;
+
+  typedef list<aio_t>::iterator aio_iter;
+
+  explicit aio_queue_t(unsigned max_iodepth)
+    : max_iodepth(max_iodepth),
+      ctx(0) {
+  }
+  ~aio_queue_t() {
+    ceph_assert(ctx == 0);
+  }
+
+  int init() {
+    ceph_assert(ctx == 0);
+    int r = io_setup(max_iodepth, &ctx);
+    if (r < 0) {
+      if (ctx) {
+       io_destroy(ctx);
+       ctx = 0;
+      }
+    }
+    return r;
+  }
+  void shutdown() {
+    if (ctx) {
+      int r = io_destroy(ctx);
+      ceph_assert(r == 0);
+      ctx = 0;
+    }
+  }
+
+  int submit_batch(aio_iter begin, aio_iter end, uint16_t aios_size, 
+                  void *priv, int *retries);
+  int get_next_completed(int timeout_ms, aio_t **paio, int max);
+};