1
0
mirror of https://github.com/ceph/ceph synced 2025-03-31 16:25:56 +00:00

objclass: add cls_get_osd_min_alloc_size helper

Signed-off-by: Mykola Golub <mgolub@suse.com>
This commit is contained in:
Mykola Golub 2019-05-31 08:13:52 +01:00
parent 870cefb32c
commit 4db6d3e0bc
7 changed files with 27 additions and 0 deletions

View 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();
}

View 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

View 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;

View 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;

View 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();
}

View 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();

View 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;
}