From 619c08c100145bd056b66272ab9e162790c33c18 Mon Sep 17 00:00:00 2001 From: Haomai Wang Date: Mon, 18 Jan 2016 11:37:32 +0800 Subject: [PATCH] NVMEDevice: no need to detach nvme device Signed-off-by: Haomai Wang --- src/os/bluestore/NVMEDevice.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/os/bluestore/NVMEDevice.cc b/src/os/bluestore/NVMEDevice.cc index 294d74f3acdda..e7012f284f676 100644 --- a/src/os/bluestore/NVMEDevice.cc +++ b/src/os/bluestore/NVMEDevice.cc @@ -117,7 +117,7 @@ static char *ealargs[] = { }; class SharedDriverData { - std::map > controllers; + std::map > controllers; bool init = false; Mutex lock; @@ -145,7 +145,7 @@ int SharedDriverData::_scan_nvme_device(const string &sn_tag, nvme_controller ** auto ctr_it = controllers.find(sn_tag); if (ctr_it != controllers.end()) { - ctr_it->second.second++; + *name = ctr_it->second.second; *c = ctr_it->second.first; return 0; } @@ -231,7 +231,7 @@ int SharedDriverData::_scan_nvme_device(const string &sn_tag, nvme_controller ** return r; } - controllers[sn_tag] = make_pair(*c, 1); + controllers[sn_tag] = make_pair(*c, *name); pci_iterator_destroy(iter); @@ -294,12 +294,6 @@ void SharedDriverData::release(nvme_controller *c) derr << __func__ << " not found registered nvme controller " << c << dendl; assert(0); } - - if (--it->second.second == 0) { - dout(1) << __func__ << " detach device " << c << dendl; - nvme_detach(c); - controllers.erase(it); - } } // ---------------- -- 2.39.5