mirror of
https://github.com/ceph/ceph
synced 2024-12-16 16:39:21 +00:00
os/bluestore: function collect_metadata, use 'const string&' to reduce copy
Signed-off-by: mychoxin <mychoxin@gmail.com>
This commit is contained in:
parent
a3b27da52e
commit
e6855210e0
@ -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,
|
||||
|
@ -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());
|
||||
|
@ -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,
|
||||
|
@ -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());
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user