From 0c902ed5813d05ac6786ac7cb8e4541b6bacc51d Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Thu, 21 May 2020 01:18:38 +0200 Subject: [PATCH] crimson/osd: implement cls_current_subop_num of the objclass API. Signed-off-by: Radoslaw Zarzynski --- src/crimson/osd/objclass.cc | 6 +++++- src/crimson/osd/ops_executer.h | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/crimson/osd/objclass.cc b/src/crimson/osd/objclass.cc index da57b9c8a5c..013ef35743b 100644 --- a/src/crimson/osd/objclass.cc +++ b/src/crimson/osd/objclass.cc @@ -380,7 +380,11 @@ uint64_t cls_current_version(cls_method_context_t hctx) int cls_current_subop_num(cls_method_context_t hctx) { - return 0; + auto* ox = reinterpret_cast(hctx); + // in contrast to classical OSD, crimson doesn't count OP_CALL and + // OP_STAT which seems fine regarding how the plugins we take care + // about use this part of API. + return ox->get_processed_rw_ops_num(); } uint64_t cls_get_features(cls_method_context_t hctx) diff --git a/src/crimson/osd/ops_executer.h b/src/crimson/osd/ops_executer.h index 2e9e74f4f74..3afe546feb9 100644 --- a/src/crimson/osd/ops_executer.h +++ b/src/crimson/osd/ops_executer.h @@ -186,6 +186,10 @@ public: const auto& get_message() const { return *msg; } + + size_t get_processed_rw_ops_num() const { + return num_read + num_write; + } }; template -- 2.39.5