diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-07-28 13:41:03 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-07-31 17:29:18 +0200 |
commit | d67c92c0738460432bb92b337f63168ee285fad8 (patch) | |
tree | b660c0f78ed6d71e4ab9f5abf324c4d702b17106 /storage | |
parent | 5aed763bc1faeb00cdef1473587448c03b75edb3 (diff) |
Do not copy the shared_ptr and go get time inside the lock.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp | 5 | ||||
-rw-r--r-- | storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp index 16f3886c813..e5525e1fd17 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp @@ -248,6 +248,7 @@ FileStorHandlerImpl::schedule(const std::shared_ptr<api::StorageMessage>& msg, { assert(disk < _diskInfo.size()); Disk& t(_diskInfo[disk]); + MessageEntry messageEntry(msg, getStorageMessageBucketId(*msg)); vespalib::MonitorGuard lockGuard(t.lock); if (t.getState() == FileStorHandler::AVAILABLE) { @@ -255,7 +256,7 @@ FileStorHandlerImpl::schedule(const std::shared_ptr<api::StorageMessage>& msg, "FileStorHandler: Operation added to disk %d's queue with " "priority %u", disk, msg->getPriority())); - t.queue.emplace_back(msg, getStorageMessageBucketId(*msg)); + t.queue.emplace_back(std::move(messageEntry)); LOG(spam, "Queued operation %s with priority %u.", msg->getType().toString().c_str(), @@ -1219,7 +1220,7 @@ FileStorHandlerImpl::MessageEntry::MessageEntry(const MessageEntry& entry) { } -FileStorHandlerImpl::MessageEntry::MessageEntry(MessageEntry && entry) +FileStorHandlerImpl::MessageEntry::MessageEntry(MessageEntry && entry) noexcept : _command(std::move(entry._command)), _timer(entry._timer), _bucketId(entry._bucketId), diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h index 14bbd40b34b..7d051a3a631 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h @@ -51,7 +51,7 @@ public: uint8_t _priority; MessageEntry(const std::shared_ptr<api::StorageMessage>& cmd, const document::BucketId& bId); - MessageEntry(MessageEntry &&); + MessageEntry(MessageEntry &&) noexcept ; MessageEntry(const MessageEntry &); MessageEntry & operator = (const MessageEntry &) = delete; ~MessageEntry(); |