From: Kefu Chai Date: Sat, 30 Oct 2021 07:40:40 +0000 (+0800) Subject: crimson/os/seastore: minor cleanups X-Git-Tag: v17.1.0~554^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=89d9b739e80b7eb90203547104a8fe1fa0e20c94;p=ceph-ci.git crimson/os/seastore: minor cleanups * pass string by reference. more consistent this way. * set a bl using list::append(), simpler this way. Signed-off-by: Kefu Chai --- diff --git a/src/crimson/os/seastore/seastore.cc b/src/crimson/os/seastore/seastore.cc index 3ba1795e502..8bfb705d1d5 100644 --- a/src/crimson/os/seastore/seastore.cc +++ b/src/crimson/os/seastore/seastore.cc @@ -38,17 +38,13 @@ namespace crimson::os::seastore { class FileMDStore final : public SeaStore::MDStore { std::string root; public: - FileMDStore(std::string root) : root(root) {} + FileMDStore(const std::string& root) : root(root) {} write_meta_ret write_meta( const std::string& key, const std::string& value) final { std::string path = fmt::format("{}/{}", root, key); - std::string fvalue = value; - fvalue += "\n"; - ceph::bufferptr bp(fvalue.length()); ceph::bufferlist bl; - bp.copy_in(0, fvalue.length(), fvalue.c_str()); - bl.push_back(bp); + bl.append(value + "\n"); return crimson::write_file(std::move(bl), path); } @@ -73,7 +69,7 @@ public: }; SeaStore::SeaStore( - std::string root, + const std::string& root, MDStoreRef mdstore, SegmentManagerRef sm, TransactionManagerRef tm, @@ -90,7 +86,7 @@ SeaStore::SeaStore( } SeaStore::SeaStore( - std::string root, + const std::string& root, SegmentManagerRef sm, TransactionManagerRef tm, CollectionManagerRef cm, diff --git a/src/crimson/os/seastore/seastore.h b/src/crimson/os/seastore/seastore.h index 25fe0e0158c..8e508c6a3f2 100644 --- a/src/crimson/os/seastore/seastore.h +++ b/src/crimson/os/seastore/seastore.h @@ -62,14 +62,14 @@ public: using MDStoreRef = std::unique_ptr; SeaStore( - std::string root, + const std::string& root, MDStoreRef mdstore, SegmentManagerRef sm, TransactionManagerRef tm, CollectionManagerRef cm, OnodeManagerRef om); SeaStore( - std::string root, + const std::string& root, SegmentManagerRef sm, TransactionManagerRef tm, CollectionManagerRef cm,