From 609d79c1f68d6695f3030e1c83ae3797a5b24d9d Mon Sep 17 00:00:00 2001 From: liuchang0812 Date: Mon, 16 Jan 2017 21:49:15 +0800 Subject: [PATCH] os/bluestore: avoid unnecessary memory copy, use variable reference in BlockDevice::Open Signed-off-by: liuchang0812 --- src/os/bluestore/BlockDevice.h | 2 +- src/os/bluestore/KernelDevice.cc | 2 +- src/os/bluestore/KernelDevice.h | 2 +- src/os/bluestore/NVMEDevice.cc | 2 +- src/os/bluestore/NVMEDevice.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/os/bluestore/BlockDevice.h b/src/os/bluestore/BlockDevice.h index 3b0f08c911250..3f08cd49b5a1a 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 9c2de912c896a..950eada7c258e 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 f302923f97365..8d58748159810 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 c0bccd7ddcafe..3e0f9443480e8 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 f6cfd59e96d0c..094de3f41de9a 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; }; -- 2.47.3