// Journaler only guarantees entries before head write_pos have been
// fully flushed. Before appending new entries, we need to find and
// drop any partial written entry.
- if (journaler.last_committed.write_pos < journaler.get_write_pos()) {
+ auto&& last_committed = journaler.get_last_committed();
+ if (last_committed.write_pos < journaler.get_write_pos()) {
dout(4) << "recovering write_pos" << dendl;
- journaler.set_read_pos(journaler.last_committed.write_pos);
+ journaler.set_read_pos(last_committed.write_pos);
_recover();
return;
}
if (journaler.get_read_pos() == journaler.get_write_pos()) {
dout(4) << "write_pos recovered" << dendl;
// restore original read_pos
- journaler.set_read_pos(journaler.last_committed.expire_pos);
+ auto&& last_committed = journaler.get_last_committed();
+ journaler.set_read_pos(last_committed.expire_pos);
journaler.set_writeable();
recovered = true;
finish_contexts(g_ceph_context, waiting_for_recovery);
fsid.print(fsid_str);
char buf[HEADER_LEN];
memset(buf, 0, sizeof(buf));
+ auto&& last_committed = journaler.get_last_committed();
snprintf(buf, HEADER_LEN, "Ceph mds%d journal dump\n start offset %llu (0x%llx)\n\
length %llu (0x%llx)\n write_pos %llu (0x%llx)\n format %llu\n\
trimmed_pos %llu (0x%llx)\n stripe_unit %lu (0x%lx)\n stripe_count %lu (0x%lx)\n\
role.rank,
(unsigned long long)start, (unsigned long long)start,
(unsigned long long)len, (unsigned long long)len,
- (unsigned long long)journaler.last_committed.write_pos, (unsigned long long)journaler.last_committed.write_pos,
- (unsigned long long)journaler.last_committed.stream_format,
- (unsigned long long)journaler.last_committed.trimmed_pos, (unsigned long long)journaler.last_committed.trimmed_pos,
- (unsigned long)journaler.last_committed.layout.stripe_unit, (unsigned long)journaler.last_committed.layout.stripe_unit,
- (unsigned long)journaler.last_committed.layout.stripe_count, (unsigned long)journaler.last_committed.layout.stripe_count,
- (unsigned long)journaler.last_committed.layout.object_size, (unsigned long)journaler.last_committed.layout.object_size,
+ (unsigned long long)last_committed.write_pos, (unsigned long long)last_committed.write_pos,
+ (unsigned long long)last_committed.stream_format,
+ (unsigned long long)last_committed.trimmed_pos, (unsigned long long)last_committed.trimmed_pos,
+ (unsigned long)last_committed.layout.stripe_unit, (unsigned long)last_committed.layout.stripe_unit,
+ (unsigned long)last_committed.layout.stripe_count, (unsigned long)last_committed.layout.stripe_count,
+ (unsigned long)last_committed.layout.object_size, (unsigned long)last_committed.layout.object_size,
fsid_str,
4);
r = safe_write(fd, buf, sizeof(buf));
C_SaferCond cond;
lock.lock();
- filer.read(ino, &journaler.get_layout(), CEPH_NOSNAP,
- pos, read_size, &bl, 0, &cond);
+ auto&& layout = journaler.get_layout();
+ filer.read(ino, &layout, CEPH_NOSNAP, pos, read_size, &bl, 0, &cond);
lock.unlock();
r = cond.wait();
if (r < 0) {
}
if (recovered == 0) {
- stripe_unit = journaler.last_committed.layout.stripe_unit;
- stripe_count = journaler.last_committed.layout.stripe_count;
- object_size = journaler.last_committed.layout.object_size;
+ auto&& last_committed = journaler.get_last_committed();
+ stripe_unit = last_committed.layout.stripe_unit;
+ stripe_count = last_committed.layout.stripe_count;
+ object_size = last_committed.layout.object_size;
} else {
// try to get layout from dump file header, if failed set layout to default
if (strstr(buf, "stripe_unit")) {