From: Edwin Rodriguez Date: Wed, 8 Oct 2025 16:18:50 +0000 (-0400) Subject: mds: Refactor Mantle::balance to use std::string instead of std::string_view for... X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1586765b6d3b4b33a6f4c58a3d26053d11d682b1;p=ceph.git mds: Refactor Mantle::balance to use std::string instead of std::string_view for script parameter Fixes: https://tracker.ceph.com/issues/73429 Signed-off-by: Edwin Rodriguez --- diff --git a/src/mds/Mantle.cc b/src/mds/Mantle.cc index 5a03312c5b1..c6c19a7ae09 100644 --- a/src/mds/Mantle.cc +++ b/src/mds/Mantle.cc @@ -49,15 +49,17 @@ static int dout_wrapper(lua_State *L) return 0; } -int Mantle::balance(std::string_view script, - mds_rank_t whoami, - const std::vector> &metrics, - std::map &my_targets) +int +Mantle::balance( + const std::string& script, + mds_rank_t whoami, + const std::vector>& metrics, + std::map& my_targets) { lua_settop(L, 0); /* clear the stack */ /* load the balancer */ - if (luaL_loadstring(L, script.data())) { + if (luaL_loadstring(L, script.c_str())) { mantle_dout(0) << "WARNING: mantle could not load balancer: " << lua_tostring(L, -1) << mantle_dendl; return -EINVAL; diff --git a/src/mds/Mantle.h b/src/mds/Mantle.h index 17c7807b17a..2eaa9ab3072 100644 --- a/src/mds/Mantle.h +++ b/src/mds/Mantle.h @@ -30,11 +30,14 @@ class Mantle { public: Mantle(); - ~Mantle() { if (L) lua_close(L); } - int balance(std::string_view script, - mds_rank_t whoami, - const std::vector > &metrics, - std::map &my_targets); + ~Mantle() { if (L) lua_close(L); + } + + int balance( + const std::string& script, + mds_rank_t whoami, + const std::vector>& metrics, + std::map& my_targets); protected: lua_State *L;