From: liuchang0812 Date: Mon, 16 Jan 2017 13:49:15 +0000 (+0800) Subject: os/bluestore: avoid unnecessary memory copy, use variable reference in BlockDevice... X-Git-Tag: v12.0.0~154^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=609d79c1f68d6695f3030e1c83ae3797a5b24d9d;p=ceph.git os/bluestore: avoid unnecessary memory copy, use variable reference in BlockDevice::Open Signed-off-by: liuchang0812 --- diff --git a/src/os/bluestore/BlockDevice.h b/src/os/bluestore/BlockDevice.h index 3b0f08c9112..3f08cd49b5a 100644 --- a/src/os/bluestore/BlockDevice.h +++ b/src/os/bluestore/BlockDevice.h @@ -108,7 +108,7 @@ public: // for managing buffered readers/writers virtual int invalidate_cache(uint64_t off, uint64_t len) = 0; - virtual int open(string path) = 0; + virtual int open(const string& path) = 0; virtual void close() = 0; }; diff --git a/src/os/bluestore/KernelDevice.cc b/src/os/bluestore/KernelDevice.cc index 9c2de912c89..950eada7c25 100644 --- a/src/os/bluestore/KernelDevice.cc +++ b/src/os/bluestore/KernelDevice.cc @@ -60,7 +60,7 @@ int KernelDevice::_lock() return 0; } -int KernelDevice::open(string p) +int KernelDevice::open(const string& p) { path = p; int r = 0; diff --git a/src/os/bluestore/KernelDevice.h b/src/os/bluestore/KernelDevice.h index f302923f973..8d587481598 100644 --- a/src/os/bluestore/KernelDevice.h +++ b/src/os/bluestore/KernelDevice.h @@ -95,7 +95,7 @@ public: // for managing buffered readers/writers int invalidate_cache(uint64_t off, uint64_t len) override; - int open(string path) override; + int open(const string& path) override; void close() override; }; diff --git a/src/os/bluestore/NVMEDevice.cc b/src/os/bluestore/NVMEDevice.cc index c0bccd7ddca..3e0f9443480 100644 --- a/src/os/bluestore/NVMEDevice.cc +++ b/src/os/bluestore/NVMEDevice.cc @@ -772,7 +772,7 @@ NVMEDevice::NVMEDevice(CephContext* cct, aio_callback_t cb, void *cbpriv) } -int NVMEDevice::open(string p) +int NVMEDevice::open(const string& p) { int r = 0; dout(1) << __func__ << " path " << p << dendl; diff --git a/src/os/bluestore/NVMEDevice.h b/src/os/bluestore/NVMEDevice.h index f6cfd59e96d..094de3f41de 100644 --- a/src/os/bluestore/NVMEDevice.h +++ b/src/os/bluestore/NVMEDevice.h @@ -230,7 +230,7 @@ class NVMEDevice : public BlockDevice { // for managing buffered readers/writers int invalidate_cache(uint64_t off, uint64_t len) override; - int open(string path) override; + int open(const string& path) override; void close() override; };