summaryrefslogtreecommitdiffstats
path: root/src/crimson/os/seastore/journal
diff options
context:
space:
mode:
authormyoungwon oh <ohmyoungwon@gmail.com>2022-10-18 03:48:05 +0200
committermyoungwon oh <ohmyoungwon@gmail.com>2022-10-19 10:18:47 +0200
commitc70e53910bd09e3e5258aad8f97e3a184925dffb (patch)
treeb11fa1847c9659b865e878b753be982636fea1eb /src/crimson/os/seastore/journal
parentcrimson/os/seastore/cbj: merge mkfs() in cbj into open_for_mkfs() (diff)
downloadceph-c70e53910bd09e3e5258aad8f97e3a184925dffb.tar.xz
ceph-c70e53910bd09e3e5258aad8f97e3a184925dffb.zip
crimson/os/seastore/cbj: add get_journal_start() and adjust it to default block size
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
Diffstat (limited to 'src/crimson/os/seastore/journal')
-rw-r--r--src/crimson/os/seastore/journal/circular_bounded_journal.cc10
-rw-r--r--src/crimson/os/seastore/journal/circular_bounded_journal.h4
2 files changed, 8 insertions, 6 deletions
diff --git a/src/crimson/os/seastore/journal/circular_bounded_journal.cc b/src/crimson/os/seastore/journal/circular_bounded_journal.cc
index ed1d3aaa69a..241c897e187 100644
--- a/src/crimson/os/seastore/journal/circular_bounded_journal.cc
+++ b/src/crimson/os/seastore/journal/circular_bounded_journal.cc
@@ -56,7 +56,7 @@ CircularBoundedJournal::open_for_mkfs()
head.dirty_tail =
journal_seq_t{0,
convert_abs_addr_to_paddr(
- device->get_block_size(),
+ get_start_addr(),
device->get_device_id())};
head.alloc_tail = head.dirty_tail;
encode(head, bl);
@@ -208,10 +208,11 @@ CircularBoundedJournal::read_header_ret
CircularBoundedJournal::read_header()
{
LOG_PREFIX(CircularBoundedJournal::read_header);
+ assert(device);
auto bptr = bufferptr(ceph::buffer::create_page_aligned(
device->get_block_size()));
- DEBUG("reading {}", CBJOURNAL_START_ADDRESS);
- return device->read(CBJOURNAL_START_ADDRESS, bptr
+ DEBUG("reading {}", device->get_journal_start());
+ return device->read(device->get_journal_start(), bptr
).safe_then([bptr, FNAME]() mutable
-> read_header_ret {
bufferlist bl;
@@ -465,7 +466,8 @@ CircularBoundedJournal::write_header()
DEBUG(
"sync header of CircularBoundedJournal, length {}",
bl.length());
- return device_write_bl(CBJOURNAL_START_ADDRESS, bl);
+ assert(device);
+ return device_write_bl(device->get_journal_start(), bl);
}
seastar::future<> CircularBoundedJournal::finish_commit(transaction_type_t type) {
if (is_trim_transaction(type)) {
diff --git a/src/crimson/os/seastore/journal/circular_bounded_journal.h b/src/crimson/os/seastore/journal/circular_bounded_journal.h
index 0f3ac8aeee6..34cd1268ebf 100644
--- a/src/crimson/os/seastore/journal/circular_bounded_journal.h
+++ b/src/crimson/os/seastore/journal/circular_bounded_journal.h
@@ -22,7 +22,6 @@
namespace crimson::os::seastore::journal {
-constexpr rbm_abs_addr CBJOURNAL_START_ADDRESS = 0;
using RBMDevice = random_block_device::RBMDevice;
/**
@@ -195,7 +194,8 @@ public:
return device->get_journal_size() - get_block_size();
}
rbm_abs_addr get_start_addr() const {
- return CBJOURNAL_START_ADDRESS + get_block_size();
+ assert(device);
+ return device->get_journal_start() + get_block_size();
}
size_t get_available_size() const {
return get_total_size() - get_used_size();