+ //
+ // Part 1.
+ // Build new log starter and compacted metadata body
+ // 1.1. Build full compacted meta transaction.
+ // Encode a bluefs transaction that dumps all of the in-memory fnodes
+ // and names.
+ // This might be pretty large and its allocation map can exceed
+ // superblock size. Hence instead we'll need log starter part which
+ // goes to superblock and refers that new meta through op_update_inc.
+ // 1.2. Allocate space for the above transaction
+ // using its size estimation.
+ // 1.3. Allocate the space required for the starter part of the new log.
+ // It should be small enough to fit into superblock.
+ // 1.4 Building new log persistent fnode representation which will
+ // finally land to disk.
+ // Depending on input parameters we might need to perform device ids
+ // rename - runtime and persistent replicas should be different when we
+ // are in the device migration process.
+ // 1.5 Store starter fnode to run-time superblock, to be written out later.
+ // It doesn't contain compacted meta to fit relevant alocation map into
+ // superblock.
+ // 1.6 Proceed building new log persistent fnode representation.
+ // Will add log tail with compacted meta extents from 1.1.
+ // Device rename applied as well
+ //
+ // 1.7. Encode new log fnode starter,
+ // It will include op_init, new log's op_update_inc
+ // and jump to the compacted meta transaction beginning.
+ // Superblock will reference this starter part
+ //
+ // 1.8. Encode compacted meta transaction,
+ // extend the transaction with a jump to proper sequence no
+ //
+
+
+ // 1.1 Build full compacted meta transaction
+ bluefs_transaction_t compacted_meta_t;
+ _compact_log_dump_metadata_NF(starter_seq + 1, &compacted_meta_t, flags, 0);
+
+ // 1.2 Allocate the space required for the compacted meta transaction
+ uint64_t compacted_meta_need =
+ _estimate_transaction_size(&compacted_meta_t) +
+ cct->_conf->bluefs_max_log_runway;
+
+ dout(20) << __func__ << " compacted_meta_need " << compacted_meta_need << dendl;
+
+ int r = _allocate(log_dev, compacted_meta_need, 0, &fnode_tail, 0,
+ permit_dev_fallback);
+ ceph_assert(r == 0);