]>
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() {
27 void WriteLogEntry::copy_cache_bl(bufferlist
*out
) {
28 std::lock_guard
locker(m_entry_bl_lock
);
32 void WriteLogEntry::remove_cache_bl() {
33 std::lock_guard
locker(m_entry_bl_lock
);
37 unsigned int WriteLogEntry::get_aligned_data_size() const {
38 if (cache_bl
.length()) {
39 return round_up_to(cache_bl
.length(), MIN_WRITE_ALLOC_SSD_SIZE
);
41 return round_up_to(write_bytes(), MIN_WRITE_ALLOC_SSD_SIZE
);
44 void WriteLogEntry::writeback_bl(
45 librbd::cache::ImageWritebackInterface
&image_writeback
,
46 Context
*ctx
, ceph::bufferlist
&& bl
) {
47 image_writeback
.aio_write({{ram_entry
.image_offset_bytes
,
48 ram_entry
.write_bytes
}},
49 std::move(bl
), 0, ctx
);
52 void WriteSameLogEntry::writeback_bl(
53 librbd::cache::ImageWritebackInterface
&image_writeback
,
54 Context
*ctx
, ceph::bufferlist
&&bl
) {
55 image_writeback
.aio_writesame(ram_entry
.image_offset_bytes
,
56 ram_entry
.write_bytes
,
57 std::move(bl
), 0, ctx
);