]>
git.proxmox.com Git - ceph.git/blob - ceph/src/librbd/cache/pwl/ssd/LogEntry.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #include "librbd/cache/ImageWriteback.h"
5 #include "librbd/cache/pwl/ssd/LogEntry.h"
7 #define dout_subsys ceph_subsys_rbd_pwl
9 #define dout_prefix *_dout << "librbd::cache::pwl::ssd::WriteLogEntry: " \
10 << this << " " << __func__ << ": "
17 void WriteLogEntry::init_cache_bl(
18 bufferlist
&src_bl
, uint64_t off
, uint64_t len
) {
20 cache_bl
.substr_of(src_bl
, off
, len
);
23 buffer::list
& WriteLogEntry::get_cache_bl() {
24 std::lock_guard
locker(m_entry_bl_lock
);
28 void WriteLogEntry::remove_cache_bl() {
29 std::lock_guard
locker(m_entry_bl_lock
);
33 unsigned int WriteLogEntry::get_aligned_data_size() const {
34 if (cache_bl
.length()) {
35 return round_up_to(cache_bl
.length(), MIN_WRITE_ALLOC_SSD_SIZE
);
37 return round_up_to(write_bytes(), MIN_WRITE_ALLOC_SSD_SIZE
);
40 void WriteLogEntry::writeback_bl(
41 librbd::cache::ImageWritebackInterface
&image_writeback
,
42 Context
*ctx
, ceph::bufferlist
&& bl
) {
43 image_writeback
.aio_write({{ram_entry
.image_offset_bytes
,
44 ram_entry
.write_bytes
}},
45 std::move(bl
), 0, ctx
);
48 void WriteSameLogEntry::writeback_bl(
49 librbd::cache::ImageWritebackInterface
&image_writeback
,
50 Context
*ctx
, ceph::bufferlist
&&bl
) {
51 image_writeback
.aio_writesame(ram_entry
.image_offset_bytes
,
52 ram_entry
.write_bytes
,
53 std::move(bl
), 0, ctx
);