]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
objclass: add cls_get_osd_min_alloc_size helper
authorMykola Golub <mgolub@suse.com>
Fri, 31 May 2019 07:13:52 +0000 (08:13 +0100)
committerMykola Golub <mgolub@suse.com>
Sun, 23 Jun 2019 09:06:45 +0000 (10:06 +0100)
Signed-off-by: Mykola Golub <mgolub@suse.com>
src/objclass/class_api.cc
src/objclass/objclass.h
src/os/ObjectStore.h
src/os/bluestore/BlueStore.h
src/osd/PG.cc
src/osd/PG.h
src/test/librados_test_stub/LibradosTestStub.cc

index 97a192e5ed7ef3a0362e013aecfafd3c7aa7dc87..726193d1bfb4a5b0e649ba26e88e54b5e4c79c7c 100644 (file)
@@ -796,3 +796,9 @@ bool cls_has_chunk(cls_method_context_t hctx, string fp_oid)
 
   return false;
 }
+
+uint64_t cls_get_osd_min_alloc_size(cls_method_context_t hctx) {
+  PrimaryLogPG::OpContext *ctx = *(PrimaryLogPG::OpContext **)hctx;
+
+  return ctx->pg->get_min_alloc_size();
+}
index 74ed5f7e433be958b3bd874f8ec21282afa51370..7ddc6ff36fdb4bd08c6cf74c21a9f18f777cfbfb 100644 (file)
@@ -178,6 +178,8 @@ int cls_cxx_chunk_write_and_set(cls_method_context_t hctx, int ofs, int len,
                   int set_len);
 bool cls_has_chunk(cls_method_context_t hctx, std::string fp_oid);
 
+extern uint64_t cls_get_osd_min_alloc_size(cls_method_context_t hctx);
+
 #endif
 
 #endif
index 594af2960bb951155edfacfe6c0a39e8f1ef6b02..9cb82891a4047bbe004999f8c1c8b53568e54216 100644 (file)
@@ -277,6 +277,11 @@ public:
   virtual bool wants_journal() = 0;  //< prefers a journal
   virtual bool allows_journal() = 0; //< allows a journal
 
+  // return store min allocation size, if applicable
+  virtual uint64_t get_min_alloc_size() const {
+    return 0;
+  }
+
   /// enumerate hardware devices (by 'devname', e.g., 'sda' as in /sys/block/sda)
   virtual int get_devices(std::set<std::string> *devls) {
     return -EOPNOTSUPP;
index 480d8092ad7cab537d4dd0bbd6e04f2c38799c5e..5026f84f62aa222cb1057d772b2b4087de991628 100644 (file)
@@ -2387,6 +2387,10 @@ public:
   bool wants_journal() override { return false; };
   bool allows_journal() override { return false; };
 
+  uint64_t get_min_alloc_size() const override {
+    return min_alloc_size;
+  }
+
   int get_devices(set<string> *ls) override;
 
   bool is_rotational() override;
index a4b2c7d01800f158186b4a72179e5b3ed6bb538b..9bc4a64523b8735add720fd796711a7033f2dd19 100644 (file)
@@ -3857,3 +3857,7 @@ void PG::with_heartbeat_peers(std::function<void(int)> f)
   }
   heartbeat_peer_lock.Unlock();
 }
+
+uint64_t PG::get_min_alloc_size() const {
+  return osd->store->get_min_alloc_size();
+}
index f05e7036e9702999acaaeae63bdc091e779279db..c69081daa544b32bf36ae82d79fde6222cb61cb6 100644 (file)
@@ -564,6 +564,8 @@ public:
   virtual void get_dynamic_perf_stats(DynamicPerfStats *stats) {
   }
 
+  uint64_t get_min_alloc_size() const;
+
   // reference counting
 #ifdef PG_DEBUG_REFS
   uint64_t get_with_id();
index f653f7919034ae8639842701b7bfc5bd7d812d0b..666973f0ebc7975bb6553c001142a375ef2bb7fc 100644 (file)
@@ -1503,3 +1503,7 @@ int cls_cxx_chunk_write_and_set(cls_method_handle_t, int,
 int cls_cxx_map_read_header(cls_method_handle_t, bufferlist *) {
   return -ENOTSUP;
 }
+
+uint64_t cls_get_osd_min_alloc_size(cls_method_context_t hctx) {
+  return 0;
+}