]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/os/bluestore/Allocator.h
import ceph 12.2.12
[ceph.git] / ceph / src / os / bluestore / Allocator.h
index a93428d9c1b8655d5ff257d34756dc0e4e42205a..ddf194f91483c5bfac08a92c2ed93cccfa71fb2c 100644 (file)
@@ -22,9 +22,6 @@ class Allocator {
 public:
   virtual ~Allocator() {}
 
-  virtual int reserve(uint64_t need) = 0;
-  virtual void unreserve(uint64_t unused) = 0;
-
   /*
    * Allocate required number of blocks in n number of extents.
    * Min and Max number of extents are limited by:
@@ -36,15 +33,17 @@ public:
    */
   virtual int64_t allocate(uint64_t want_size, uint64_t alloc_unit,
                           uint64_t max_alloc_size, int64_t hint,
-                          AllocExtentVector *extents) = 0;
+                          PExtentVector *extents) = 0;
 
   int64_t allocate(uint64_t want_size, uint64_t alloc_unit,
-                  int64_t hint, AllocExtentVector *extents) {
+                  int64_t hint, PExtentVector *extents) {
     return allocate(want_size, alloc_unit, want_size, hint, extents);
   }
 
-  virtual void release(
-    uint64_t offset, uint64_t length) = 0;
+  /* Bulk release. Implementations may override this method to handle the whole
+   * set at once. This could save e.g. unnecessary mutex dance. */
+  virtual void release(const interval_set<uint64_t>& release_set) = 0;
+  void release(const PExtentVector& release_set);
 
   virtual void dump() = 0;
 
@@ -52,6 +51,10 @@ public:
   virtual void init_rm_free(uint64_t offset, uint64_t length) = 0;
 
   virtual uint64_t get_free() = 0;
+  virtual double get_fragmentation(uint64_t alloc_unit)
+  {
+    return 0.0;
+  }
 
   virtual void shutdown() = 0;
   static Allocator *create(CephContext* cct, string type, int64_t size,