]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rbd/cache/pwl: update wait_buffer state and add wake_up
authorYin Congmin <congmin.yin@intel.com>
Mon, 15 Mar 2021 07:34:35 +0000 (15:34 +0800)
committerYin Congmin <congmin.yin@intel.com>
Mon, 15 Mar 2021 17:14:51 +0000 (01:14 +0800)
Signed-off-by: Yin Congmin <congmin.yin@intel.com>
src/librbd/cache/pwl/AbstractWriteLog.cc
src/librbd/cache/pwl/rwl/WriteLog.cc

index b08d5df7962da9c51f6cd7c6737f6346c91a6834..a658b60b2fe4766a92d1b4deeb7d3e00561ed188 100644 (file)
@@ -1355,7 +1355,9 @@ void AbstractWriteLog<I>::dispatch_deferred_writes(void)
         }
         ceph_assert(!allocated);
         if (!allocated && front_req) {
-          /* front_req->alloc_resources() failed on the last iteration. We'll stop dispatching. */
+          /* front_req->alloc_resources() failed on the last iteration.
+           * We'll stop dispatching. */
+          wake_up();
           front_req = nullptr;
           ceph_assert(!cleared_dispatching_flag);
           m_dispatching_deferred_ops = false;
@@ -1477,7 +1479,7 @@ bool AbstractWriteLog<I>::check_allocation(C_BlockIORequestT *req,
     /* Don't attempt buffer allocate if we've exceeded the "full" threshold */
     if (m_bytes_allocated + bytes_allocated > bytes_allocated_cap) {
       if (!req->has_io_waited_for_buffers()) {
-        req->set_io_waited_for_entries(true);
+        req->set_io_waited_for_buffers(true);
         ldout(m_image_ctx.cct, 1) << "Waiting for allocation cap (cap="
                                   << bytes_allocated_cap
                                   << ", allocated=" << m_bytes_allocated
@@ -1504,6 +1506,10 @@ bool AbstractWriteLog<I>::check_allocation(C_BlockIORequestT *req,
       m_bytes_allocated += bytes_allocated;
       m_bytes_cached += bytes_cached;
       m_bytes_dirty += bytes_dirtied;
+      if (req->has_io_waited_for_buffers()) {
+        req->set_io_waited_for_buffers(false);
+      }
+
     } else {
       alloc_succeeds = false;
     }
index 4cea78dfc8d60a185269d3fd8cc2a375d2ff36d1..0dba120f9310720a01978f9a04f1cd3728ddcb47 100644 (file)
@@ -785,7 +785,8 @@ void WriteLog<I>::process_work() {
             (utime_t(ceph_clock_now() - started).to_msec() < RETIRE_BATCH_TIME_LIMIT_MS))) {
         if (!retire_entries((this->m_shutting_down || this->m_invalidating ||
            (this->m_bytes_allocated > aggressive_high_water_bytes) ||
-           (m_log_entries.size() > aggressive_high_water_entries))
+           (m_log_entries.size() > aggressive_high_water_entries) ||
+           this->m_alloc_failed_since_retire)
             ? MAX_ALLOC_PER_TRANSACTION
             : MAX_FREE_PER_TRANSACTION)) {
           break;
@@ -888,7 +889,7 @@ void WriteLog<I>::reserve_cache(C_BlockIORequestT *req,
     buffer.allocation_lat = ceph_clock_now() - before_reserve;
     if (TOID_IS_NULL(buffer.buffer_oid)) {
       if (!req->has_io_waited_for_buffers()) {
-        req->set_io_waited_for_entries(true);
+        req->set_io_waited_for_buffers(true);
       }
       ldout(m_image_ctx.cct, 5) << "can't allocate all data buffers: "
                                 << pmemobj_errormsg() << ". "