return true;
}
-void BlueFS::_compact_log_sync()
+void BlueFS::_compact_log_dump_metadata(bluefs_transaction_t *t)
{
- // FIXME: we currently hold the lock while writing out the compacted log,
- // which may mean a latency spike. we could drop the lock while writing out
- // the big compacted log, while continuing to log at the end of the old log
- // file, and once it's done swap out the old log extents for the new ones.
- dout(10) << __func__ << dendl;
- File *log_file = log_writer->file.get();
-
- // clear out log (be careful who calls us!!!)
- log_t.clear();
-
- bluefs_transaction_t t;
- t.seq = 1;
- t.uuid = super.uuid;
+ t->seq = 1;
+ t->uuid = super.uuid;
dout(20) << __func__ << " op_init" << dendl;
- t.op_init();
+
+ t->op_init();
for (unsigned bdev = 0; bdev < MAX_BDEV; ++bdev) {
interval_set<uint64_t>& p = block_all[bdev];
for (interval_set<uint64_t>::iterator q = p.begin(); q != p.end(); ++q) {
dout(20) << __func__ << " op_alloc_add " << bdev << " 0x"
<< std::hex << q.get_start() << "~" << q.get_len() << std::dec
<< dendl;
- t.op_alloc_add(bdev, q.get_start(), q.get_len());
+ t->op_alloc_add(bdev, q.get_start(), q.get_len());
}
}
for (auto& p : file_map) {
if (p.first == 1)
continue;
dout(20) << __func__ << " op_file_update " << p.second->fnode << dendl;
- t.op_file_update(p.second->fnode);
+ t->op_file_update(p.second->fnode);
}
for (auto& p : dir_map) {
dout(20) << __func__ << " op_dir_create " << p.first << dendl;
- t.op_dir_create(p.first);
+ t->op_dir_create(p.first);
for (auto& q : p.second->file_map) {
dout(20) << __func__ << " op_dir_link " << p.first << "/" << q.first
<< " to " << q.second->fnode.ino << dendl;
- t.op_dir_link(p.first, q.first, q.second->fnode.ino);
+ t->op_dir_link(p.first, q.first, q.second->fnode.ino);
}
}
+}
+
+void BlueFS::_compact_log_sync()
+{
+ // FIXME: we currently hold the lock while writing out the compacted log,
+ // which may mean a latency spike. we could drop the lock while writing out
+ // the big compacted log, while continuing to log at the end of the old log
+ // file, and once it's done swap out the old log extents for the new ones.
+ dout(10) << __func__ << dendl;
+ File *log_file = log_writer->file.get();
+
+ // clear out log (be careful who calls us!!!)
+ log_t.clear();
+
+ bluefs_transaction_t t;
+ _compact_log_dump_metadata(&t);
+
dout(20) << __func__ << " op_jump_seq " << log_seq << dendl;
t.op_jump_seq(log_seq);