]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: minor cleanups 43749/head
authorKefu Chai <tchaikov@gmail.com>
Sat, 30 Oct 2021 07:40:40 +0000 (15:40 +0800)
committerKefu Chai <tchaikov@gmail.com>
Sat, 30 Oct 2021 07:51:03 +0000 (15:51 +0800)
* pass string by reference. more consistent this way.
* set a bl using list::append(), simpler this way.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/crimson/os/seastore/seastore.cc
src/crimson/os/seastore/seastore.h

index 3ba1795e502fa4fb695b015b006c975afd239e89..8bfb705d1d54fa79450cf73cca91bc1bad31175b 100644 (file)
@@ -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,
index 25fe0e0158c7d8356ce12a6280ad8c2df397afc7..8e508c6a3f274b75af1c84f726e648039cff6b6c 100644 (file)
@@ -62,14 +62,14 @@ public:
   using MDStoreRef = std::unique_ptr<MDStore>;
 
   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,