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 <tchaikov@gmail.com>
This commit is contained in:
Kefu Chai 2021-10-30 15:40:40 +08:00
parent 8b7542d27f
commit 89d9b739e8
2 changed files with 6 additions and 10 deletions

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

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