mirror of
https://github.com/ceph/ceph
synced 2025-02-24 11:37:37 +00:00
librbd/cache/pwl: fix reorder issue between func process_writeback_dirty_entries
In fact, we not only make sure ops in order in func process_writeback_dirty_entries, but also make sure ops in order between func process_writeback_dirty_entries. Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
This commit is contained in:
parent
2badd25cff
commit
76f4d29d92
6
src/librbd/cache/pwl/AbstractWriteLog.cc
vendored
6
src/librbd/cache/pwl/AbstractWriteLog.cc
vendored
@ -1639,6 +1639,7 @@ Context* AbstractWriteLog<I>::construct_flush_entry(std::shared_ptr<GenericLogEn
|
||||
m_lowest_flushing_sync_gen = log_entry->ram_entry.sync_gen_number;
|
||||
}
|
||||
m_flush_ops_in_flight += 1;
|
||||
m_flush_ops_will_send += 1;
|
||||
/* For write same this is the bytes affected by the flush op, not the bytes transferred */
|
||||
m_flush_bytes_in_flight += log_entry->ram_entry.write_bytes;
|
||||
|
||||
@ -1710,6 +1711,11 @@ void AbstractWriteLog<I>::process_writeback_dirty_entries() {
|
||||
all_clean = !m_flush_ops_in_flight;
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_flush_ops_will_send) {
|
||||
ldout(cct, 20) << "Previous flush-ops is still not sent" << dendl;
|
||||
break;
|
||||
}
|
||||
auto candidate = m_dirty_log_entries.front();
|
||||
bool flushable = can_flush_entry(candidate);
|
||||
if (flushable) {
|
||||
|
1
src/librbd/cache/pwl/AbstractWriteLog.h
vendored
1
src/librbd/cache/pwl/AbstractWriteLog.h
vendored
@ -294,6 +294,7 @@ protected:
|
||||
std::atomic<int> m_async_flush_ops = {0};
|
||||
std::atomic<int> m_async_append_ops = {0};
|
||||
|
||||
std::atomic<int> m_flush_ops_will_send = {0};
|
||||
/* Acquire locks in order declared here */
|
||||
|
||||
mutable ceph::mutex m_log_retire_lock;
|
||||
|
1
src/librbd/cache/pwl/rwl/WriteLog.cc
vendored
1
src/librbd/cache/pwl/rwl/WriteLog.cc
vendored
@ -592,6 +592,7 @@ void WriteLog<I>::construct_flush_entries(pwl::GenericLogEntries entries_to_flus
|
||||
ldout(m_image_ctx.cct, 15) << "flushing:" << log_entry
|
||||
<< " " << *log_entry << dendl;
|
||||
log_entry->writeback(this->m_image_writeback, ctx);
|
||||
this->m_flush_ops_will_send -= 1;
|
||||
}), 0);
|
||||
});
|
||||
}
|
||||
|
3
src/librbd/cache/pwl/ssd/WriteLog.cc
vendored
3
src/librbd/cache/pwl/ssd/WriteLog.cc
vendored
@ -539,6 +539,7 @@ void WriteLog<I>::construct_flush_entries(pwl::GenericLogEntries entries_to_flus
|
||||
ldout(m_image_ctx.cct, 15) << "flushing:" << log_entry
|
||||
<< " " << *log_entry << dendl;
|
||||
log_entry->writeback(this->m_image_writeback, ctx);
|
||||
this->m_flush_ops_will_send -= 1;
|
||||
}), 0);
|
||||
});
|
||||
}
|
||||
@ -589,6 +590,7 @@ void WriteLog<I>::construct_flush_entries(pwl::GenericLogEntries entries_to_flus
|
||||
<< " " << *log_entry << dendl;
|
||||
log_entry->writeback_bl(this->m_image_writeback, ctx,
|
||||
std::move(captured_entry_bl));
|
||||
this->m_flush_ops_will_send -= 1;
|
||||
}), 0);
|
||||
} else {
|
||||
m_image_ctx.op_work_queue->queue(new LambdaContext(
|
||||
@ -596,6 +598,7 @@ void WriteLog<I>::construct_flush_entries(pwl::GenericLogEntries entries_to_flus
|
||||
ldout(m_image_ctx.cct, 15) << "flushing:" << log_entry
|
||||
<< " " << *log_entry << dendl;
|
||||
log_entry->writeback(this->m_image_writeback, ctx);
|
||||
this->m_flush_ops_will_send -= 1;
|
||||
}), 0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user