Instead of adding new bufferptrs into log writer's bufferlist,
encode required data using single, pre-aligned bufferptr. This
prevents bufferlist rebuilds during aio_write to WAL which is way
more costly than explicitly reserving buffer and writing to that.
Signed-off-by: Piotr Dałek <piotr.dalek@corp.ovh.com>
}
bufferlist bl;
+ bl.reserve(super.block_size);
encode(log_t, bl);
-
// pad to block boundary
- _pad_bl(bl);
+ size_t realign = super.block_size - (bl.length() % super.block_size);
+ if (realign && realign != super.block_size)
+ bl.append_zero(realign);
+
logger->inc(l_bluefs_logged_bytes, bl.length());
log_writer->append(bl);
ENCODE_START(1, 1, bl);
encode(uuid, bl);
encode(seq, bl);
- encode(op_bl, bl);
+ // not using bufferlist encode method, as it merely copies the bufferptr and not
+ // contents, meaning we're left with fragmented target bl
+ __u32 len = op_bl.length();
+ encode(len, bl);
+ for (auto& it : op_bl.buffers()) {
+ bl.append(it.c_str(), it.length());
+ }
encode(crc, bl);
ENCODE_FINISH(bl);
}