os/bluestore: function collect_metadata, use 'const string&' to reduce copy

Signed-off-by: mychoxin <mychoxin@gmail.com>
This commit is contained in:
mychoxin 2017-08-12 16:48:20 +08:00
parent a3b27da52e
commit e6855210e0
7 changed files with 7 additions and 7 deletions

View File

@ -115,7 +115,7 @@ public:
uint64_t get_size() const { return size; }
uint64_t get_block_size() const { return block_size; }
virtual int collect_metadata(std::string prefix, std::map<std::string,std::string> *pm) const = 0;
virtual int collect_metadata(const std::string& prefix, std::map<std::string,std::string> *pm) const = 0;
virtual int read(
uint64_t off,

View File

@ -198,7 +198,7 @@ static string get_dev_property(const char *dev, const char *property)
return val;
}
int KernelDevice::collect_metadata(string prefix, map<string,string> *pm) const
int KernelDevice::collect_metadata(const string& prefix, map<string,string> *pm) const
{
(*pm)[prefix + "rotational"] = stringify((int)(bool)rotational);
(*pm)[prefix + "size"] = stringify(get_size());

View File

@ -75,7 +75,7 @@ public:
void aio_submit(IOContext *ioc) override;
int collect_metadata(std::string prefix, map<std::string,std::string> *pm) const override;
int collect_metadata(const std::string& prefix, map<std::string,std::string> *pm) const override;
int read(uint64_t off, uint64_t len, bufferlist *pbl,
IOContext *ioc,

View File

@ -929,7 +929,7 @@ void NVMEDevice::close()
dout(1) << __func__ << " end" << dendl;
}
int NVMEDevice::collect_metadata(string prefix, map<string,string> *pm) const
int NVMEDevice::collect_metadata(const string& prefix, map<string,string> *pm) const
{
(*pm)[prefix + "rotational"] = "0";
(*pm)[prefix + "size"] = stringify(get_size());

View File

@ -227,7 +227,7 @@ class NVMEDevice : public BlockDevice {
int invalidate_cache(uint64_t off, uint64_t len) override;
int open(const string& path) override;
void close() override;
int collect_metadata(string prefix, map<string,string> *pm) const override;
int collect_metadata(const string& prefix, map<string,string> *pm) const override;
};
#endif

View File

@ -146,7 +146,7 @@ static string get_dev_property(const char *dev, const char *property)
return val;
}
int PMEMDevice::collect_metadata(string prefix, map<string,string> *pm) const
int PMEMDevice::collect_metadata(const string& prefix, map<string,string> *pm) const
{
(*pm)[prefix + "rotational"] = stringify((int)(bool)rotational);
(*pm)[prefix + "size"] = stringify(get_size());

View File

@ -41,7 +41,7 @@ public:
void aio_submit(IOContext *ioc) override;
int collect_metadata(std::string prefix, map<std::string,std::string> *pm) const override;
int collect_metadata(const std::string& prefix, map<std::string,std::string> *pm) const override;
int read(uint64_t off, uint64_t len, bufferlist *pbl,
IOContext *ioc,