return r;
}
+
+// create a buffer basing on user-configurable. it's intended to make
+// our buffers THP-able.
+static ceph::unique_leakable_ptr<buffer::raw> create_custom_aligned(
+ CephContext* const cct,
+ const size_t len)
+{
+ // just to preserve the logic of create_small_page_aligned().
+ if (len < CEPH_PAGE_SIZE) {
+ return ceph::buffer::create_small_page_aligned(len);
+ } else {
+ const size_t custom_alignment = cct->_conf->bdev_read_buffer_alignment;
+ return ceph::buffer::create_aligned(len, custom_alignment);
+ }
+}
+
int KernelDevice::read(uint64_t off, uint64_t len, bufferlist *pbl,
IOContext *ioc,
bool buffered)
auto start1 = mono_clock::now();
- auto p = ceph::buffer::ptr_node::create(ceph::buffer::create_small_page_aligned(len));
+ auto p = ceph::buffer::ptr_node::create(create_custom_aligned(cct, len));
int r = ::pread(choose_fd(buffered, WRITE_LIFE_NOT_SET),
p->c_str(), len, off);
auto age = cct->_conf->bdev_debug_aio_log_age;
++ioc->num_pending;
aio_t& aio = ioc->pending_aios.back();
aio.bl.push_back(
- ceph::buffer::ptr_node::create(ceph::buffer::create_small_page_aligned(len)));
+ ceph::buffer::ptr_node::create(create_custom_aligned(cct, len)));
aio.bl.prepare_iov(&aio.iov);
aio.preadv(off, len);
dout(30) << aio << dendl;