Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bluestore: fixed compilation error when enable spdk #12672

Merged
merged 1 commit into from
Dec 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/modules/Finddpdk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ if (EXISTS ${WITH_DPDK_MLX5})
list(APPEND check_LIBRARIES -libverbs)
endif()
set(DPDK_LIBRARIES
-Wl,--whole-archive ${check_LIBRARIES} -Wl,--no-whole-archive)
-Wl,--whole-archive ${check_LIBRARIES} -lpthread -Wl,--no-whole-archive)
endif(DPDK_FOUND)
2 changes: 2 additions & 0 deletions src/os/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ endif(WITH_FUSE)
if(WITH_SPDK)
list(APPEND libos_srcs
bluestore/NVMEDevice.cc)
ADD_DEFINITIONS(-D__SSE4_2__ -D__SSE4_1__ -D__SSSE3__ -D__SSE3__)
add_compile_options(-mcrc32 -msse3 -mssse3 -msse4.1 -msse4.2)
endif()

add_library(os STATIC ${libos_srcs} $<TARGET_OBJECTS:kv_objs>)
Expand Down
21 changes: 11 additions & 10 deletions src/os/bluestore/NVMEDevice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include "NVMEDevice.h"

#define dout_context g_ceph_context
#define dout_subsys ceph_subsys_bdev
#undef dout_prefix
#define dout_prefix *_dout << "bdev(" << sn << ") "
Expand Down Expand Up @@ -110,7 +111,7 @@ struct Task {
Task(NVMEDevice *dev, IOCommand c, uint64_t off, uint64_t l, int64_t rc = 0)
: device(dev), command(c), offset(off), len(l),
return_code(rc),
start(ceph::coarse_real_clock::now(cct)) {}
start(ceph::coarse_real_clock::now()) {}
~Task() {
assert(!io_request.nseg);
}
Expand Down Expand Up @@ -205,7 +206,7 @@ class SharedDriverData {
size = spdk_nvme_ns_get_sector_size(ns) * spdk_nvme_ns_get_num_sectors(ns);
zero_command_support = spdk_nvme_ns_get_flags(ns) & SPDK_NVME_NS_WRITE_ZEROES_SUPPORTED;

PerfCountersBuilder b(cct, string("NVMEDevice-AIOThread-"+stringify(this)),
PerfCountersBuilder b(g_ceph_context, string("NVMEDevice-AIOThread-"+stringify(this)),
l_bluestore_nvmedevice_first, l_bluestore_nvmedevice_last);
b.add_time_avg(l_bluestore_nvmedevice_aio_write_lat, "aio_write_lat", "Average write completing latency");
b.add_time_avg(l_bluestore_nvmedevice_read_lat, "read_lat", "Average read completing latency");
Expand All @@ -217,11 +218,11 @@ class SharedDriverData {
b.add_time_avg(l_bluestore_nvmedevice_flush_queue_lat, "flush_queue_lat", "Average queue flush request latency");
b.add_u64_counter(l_bluestore_nvmedevice_buffer_alloc_failed, "buffer_alloc_failed", "Alloc data buffer failed count");
logger = b.create_perf_counters();
cct->get_perfcounters_collection()->add(logger);
g_ceph_context->get_perfcounters_collection()->add(logger);
_aio_start();
}
~SharedDriverData() {
cct->get_perfcounters_collection()->remove(logger);
g_ceph_context->get_perfcounters_collection()->remove(logger);
delete logger;
}

Expand Down Expand Up @@ -448,7 +449,7 @@ void SharedDriverData::_aio_thread()
std::unique_lock<std::mutex> l(t->ctx->lock);
t->ctx->cond.notify_all();
} else {
cur = ceph::coarse_real_clock::now(cct);
cur = ceph::coarse_real_clock::now();
auto dur = std::chrono::duration_cast<std::chrono::nanoseconds>(cur - start);
logger->tinc(l_bluestore_nvmedevice_read_queue_lat, dur);
}
Expand Down Expand Up @@ -496,7 +497,7 @@ void SharedDriverData::_aio_thread()

Mutex::Locker l(queue_lock);
if (queue_empty.load()) {
cur = ceph::coarse_real_clock::now(cct);
cur = ceph::coarse_real_clock::now();
auto dur = std::chrono::duration_cast<std::chrono::nanoseconds>(cur - start);
logger->tinc(l_bluestore_nvmedevice_polling_lat, dur);
if (aio_stop)
Expand Down Expand Up @@ -588,7 +589,7 @@ static bool probe_cb(void *cb_ctx, struct spdk_pci_device *pci_dev)

if (spdk_pci_device_has_non_uio_driver(pci_dev)) {
/*NVMe kernel driver case*/
if (cct->_conf->bdev_nvme_unbind_from_kernel) {
if (g_ceph_context->_conf->bdev_nvme_unbind_from_kernel) {
r = spdk_pci_device_switch_to_uio_driver(pci_dev);
if (r < 0) {
derr << __func__ << " device " << name
Expand Down Expand Up @@ -659,7 +660,7 @@ int NVMEManager::try_get(const string &sn_tag, SharedDriverData **driver)
"ceph-osd",
coremask_arg, /* This must be the second parameter. It is overwritten by index in main(). */
"-n 4",
socket_mem_arg,
sock_mem_arg,
prefix_arg
};

Expand All @@ -679,7 +680,7 @@ int NVMEManager::try_get(const string &sn_tag, SharedDriverData **driver)
}

pci_system_init();
spdk_nvme_retry_count = cct->_conf->bdev_nvme_retry_count;
spdk_nvme_retry_count = g_ceph_context->_conf->bdev_nvme_retry_count;
if (spdk_nvme_retry_count < 0)
spdk_nvme_retry_count = SPDK_NVME_DEFAULT_RETRY_COUNT;

Expand Down Expand Up @@ -973,7 +974,7 @@ int NVMEDevice::read_random(uint64_t off, uint64_t len, char *buf, bool buffered
uint64_t aligned_len = align_up(off+len, block_size) - aligned_off;
dout(5) << __func__ << " " << off << "~" << len
<< " aligned " << aligned_off << "~" << aligned_len << dendl;
IOContext ioc(nullptr);
IOContext ioc(g_ceph_context, nullptr);
Task *t = new Task(this, IOCommand::READ_COMMAND, aligned_off, aligned_len, 1);
int r = 0;
t->ctx = &ioc;
Expand Down