]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | ||
4 | #include "LogOperation.h" | |
5 | ||
6 | #define dout_subsys ceph_subsys_rbd_pwl | |
7 | #undef dout_prefix | |
8 | #define dout_prefix *_dout << "librbd::cache::pwl::rwl::LogOperation: " \ | |
9 | << this << " " << __func__ << ": " | |
10 | ||
11 | namespace librbd { | |
12 | namespace cache { | |
13 | namespace pwl { | |
14 | namespace rwl { | |
15 | ||
16 | void WriteLogOperation::copy_bl_to_cache_buffer( | |
17 | std::vector<WriteBufferAllocation>::iterator allocation) { | |
18 | /* operation is a shared_ptr, so write_op is only good as long as operation is | |
19 | * in scope */ | |
20 | bufferlist::iterator i(&bl); | |
21 | m_perfcounter->inc(l_librbd_pwl_log_op_bytes, log_entry->write_bytes()); | |
22 | ldout(m_cct, 20) << bl << dendl; | |
23 | log_entry->init_cache_buffer(allocation); | |
24 | i.copy((unsigned)log_entry->write_bytes(), (char*)log_entry->cache_buffer); | |
25 | } | |
26 | ||
27 | void DiscardLogOperation::init_op( | |
28 | uint64_t current_sync_gen, bool persist_on_flush, | |
29 | uint64_t last_op_sequence_num, Context *write_persist, | |
30 | Context *write_append) { | |
31 | log_entry->init(current_sync_gen, persist_on_flush, last_op_sequence_num); | |
32 | this->on_write_append = write_append; | |
33 | this->on_write_persist = write_persist; | |
34 | } | |
35 | ||
36 | } // namespace rwl | |
37 | } // namespace pwl | |
38 | } // namespace cache | |
39 | } // namespace librbd |