]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/os/bluestore/PMEMDevice.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / os / bluestore / PMEMDevice.h
index c08e3cc5f2f1ae4c633cbb6bace7d93a2ddc8aa2..3077375a2ac85f99aaafe32a4223ba18d8da6863 100644 (file)
 
 #include "os/fs/FS.h"
 #include "include/interval_set.h"
-#include "aio.h"
+#include "ceph_aio.h"
 #include "BlockDevice.h"
 
 class PMEMDevice : public BlockDevice {
   int fd;
   char *addr; //the address of mmap
-  uint64_t size;
-  uint64_t block_size;
   std::string path;
 
-  Mutex debug_lock;
+  ceph::mutex debug_lock = ceph::make_mutex("PMEMDevice::debug_lock");
   interval_set<uint64_t> debug_inflight;
 
   std::atomic_int injecting_crash;
@@ -43,14 +41,7 @@ public:
 
   void aio_submit(IOContext *ioc) override;
 
-  uint64_t get_size() const override {
-    return size;
-  }
-  uint64_t get_block_size() const override {
-    return block_size;
-  }
-
-  int collect_metadata(std::string prefix, map<std::string,std::string> *pm) const override;
+  int collect_metadata(const std::string& prefix, map<std::string,std::string> *pm) const override;
 
   int read(uint64_t off, uint64_t len, bufferlist *pbl,
           IOContext *ioc,
@@ -59,16 +50,24 @@ public:
               IOContext *ioc) override;
 
   int read_random(uint64_t off, uint64_t len, char *buf, bool buffered) override;
-  int write(uint64_t off, bufferlist& bl, bool buffered) override;
+  int write(uint64_t off, bufferlist& bl, bool buffered, int write_hint = WRITE_LIFE_NOT_SET) override;
   int aio_write(uint64_t off, bufferlist& bl,
                IOContext *ioc,
-               bool buffered) override;
+               bool buffered,
+               int write_hint = WRITE_LIFE_NOT_SET) override;
   int flush() override;
 
   // for managing buffered readers/writers
   int invalidate_cache(uint64_t off, uint64_t len) override;
   int open(const std::string &path) override;
   void close() override;
+
+private:
+  bool is_valid_io(uint64_t off, uint64_t len) const {
+    return (len > 0 &&
+            off < size &&
+            off + len <= size);
+  }
 };
 
 #endif