diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/objclass/class_api.cc | 6 | ||||
-rw-r--r-- | src/objclass/objclass.h | 2 | ||||
-rw-r--r-- | src/os/ObjectStore.h | 5 | ||||
-rw-r--r-- | src/os/bluestore/BlueStore.h | 4 | ||||
-rw-r--r-- | src/osd/PG.cc | 4 | ||||
-rw-r--r-- | src/osd/PG.h | 2 | ||||
-rw-r--r-- | src/test/librados_test_stub/LibradosTestStub.cc | 4 |
7 files changed, 27 insertions, 0 deletions
diff --git a/src/objclass/class_api.cc b/src/objclass/class_api.cc index 97a192e5ed7..726193d1bfb 100644 --- a/src/objclass/class_api.cc +++ b/src/objclass/class_api.cc @@ -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(); +} diff --git a/src/objclass/objclass.h b/src/objclass/objclass.h index 74ed5f7e433..7ddc6ff36fd 100644 --- a/src/objclass/objclass.h +++ b/src/objclass/objclass.h @@ -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 diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 594af2960bb..9cb82891a40 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -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; diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 480d8092ad7..5026f84f62a 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -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; diff --git a/src/osd/PG.cc b/src/osd/PG.cc index a4b2c7d0180..9bc4a64523b 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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(); +} diff --git a/src/osd/PG.h b/src/osd/PG.h index f05e7036e97..c69081daa54 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -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(); diff --git a/src/test/librados_test_stub/LibradosTestStub.cc b/src/test/librados_test_stub/LibradosTestStub.cc index f653f791903..666973f0ebc 100644 --- a/src/test/librados_test_stub/LibradosTestStub.cc +++ b/src/test/librados_test_stub/LibradosTestStub.cc @@ -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; +} |