I/O may hang due to pmem cache fragment issue when blocks are diffrent
in size. Call pmdk API(pmemobj_defrag) to solve.
Fixes: https://tracker.ceph.com/issues/49879
Signed-off-by: Yin Congmin <congmin.yin@intel.com>
<< *req << dendl;
alloc_succeeds = false;
no_space = true; /* Entries need to be retired */
+
+ if (this->m_free_log_entries == this->m_total_log_entries - 1) {
+ /* When the cache is empty, there is still no space to allocate.
+ * Defragment. */
+ pmemobj_defrag(m_log_pool, NULL, 0, NULL);
+ }
break;
} else {
buffer.allocated = true;