From: optimistyzy Date: Fri, 6 Jan 2017 12:16:00 +0000 (+0800) Subject: NVMEDevice: Eliminate virt to physical address translation in data_buf_next_sge X-Git-Tag: v12.0.0~264^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=201d4fc606ba2f361d884a559bf6532ea3c309e0;p=ceph.git NVMEDevice: Eliminate virt to physical address translation in data_buf_next_sge After SPDK is updated, SPDK requires virtual address instead of physical address in huge page memory. Thus, we do not need to pass the physical address since SPDK library will do the address translation work.If we still use the original code, it seems a bug. In this patch, we will also use spdk_zmalloc instead of dpdk's rte_malloc_socket function. Signed-off-by: optimistyzy --- diff --git a/src/os/bluestore/NVMEDevice.cc b/src/os/bluestore/NVMEDevice.cc index 0c8b8466ca51..2413d63f3609 100644 --- a/src/os/bluestore/NVMEDevice.cc +++ b/src/os/bluestore/NVMEDevice.cc @@ -315,16 +315,16 @@ static int data_buf_next_sge(void *cb_arg, void **address, uint32_t *length) if (t->io_request.cur_seg_left) { *length = t->io_request.cur_seg_left; - *address = (void *)(rte_malloc_virt2phy(addr) + data_buffer_size - t->io_request.cur_seg_left); + *address = (void *)((uint64_t)addr + data_buffer_size - t->io_request.cur_seg_left); if (t->io_request.cur_seg_idx == t->io_request.nseg - 1) { uint64_t tail = t->len % data_buffer_size; if (tail) { - *address = (void *)(rte_malloc_virt2phy(addr) + tail - t->io_request.cur_seg_left); + *address = (void *)((uint64_t)addr + tail - t->io_request.cur_seg_left); } } t->io_request.cur_seg_left = 0; } else { - *address = (void *)rte_malloc_virt2phy(addr); + *address = addr; *length = data_buffer_size; if (t->io_request.cur_seg_idx == t->io_request.nseg - 1) { uint64_t tail = t->len % data_buffer_size; @@ -375,8 +375,7 @@ void SharedDriverData::_aio_thread() if (data_buf_mempool.empty()) { for (uint16_t i = 0; i < data_buffer_default_num; i++) { - void *b = rte_malloc_socket( - "nvme_data_buffer", data_buffer_size, CEPH_PAGE_SIZE, rte_socket_id()); + void *b = spdk_zmalloc(data_buffer_size, CEPH_PAGE_SIZE, NULL); if (!b) { derr << __func__ << " failed to create memory pool for nvme data buffer" << dendl; assert(b);