using TOPNSPC::common::cmd_getval;
MEMPOOL_DEFINE_OBJECT_FACTORY(BlueFS::File, bluefs_file, bluefs);
MEMPOOL_DEFINE_OBJECT_FACTORY(BlueFS::Dir, bluefs_dir, bluefs);
-MEMPOOL_DEFINE_OBJECT_FACTORY(BlueFS::FileWriter, bluefs_file_writer, bluefs);
+MEMPOOL_DEFINE_OBJECT_FACTORY(BlueFS::FileWriter, bluefs_file_writer, bluefs_file_writer);
MEMPOOL_DEFINE_OBJECT_FACTORY(BlueFS::FileReaderBuffer,
- bluefs_file_reader_buffer, bluefs);
-MEMPOOL_DEFINE_OBJECT_FACTORY(BlueFS::FileReader, bluefs_file_reader, bluefs);
+ bluefs_file_reader_buffer, bluefs_file_reader);
+MEMPOOL_DEFINE_OBJECT_FACTORY(BlueFS::FileReader, bluefs_file_reader, bluefs_file_reader);
MEMPOOL_DEFINE_OBJECT_FACTORY(BlueFS::FileLock, bluefs_file_lock, bluefs);
static void wal_discard_cb(void *priv, void* priv2) {
logger->inc(l_bluefs_read_random_bytes, len);
std::shared_lock s_lock(h->lock);
+ buf->bl.reassign_to_mempool(mempool::mempool_bluefs_file_reader);
while (len > 0) {
if (off < buf->bl_off || off >= buf->get_buf_end()) {
s_lock.unlock();
if (off < buf->bl_off || off >= buf->get_buf_end()) {
s_lock.unlock();
std::unique_lock u_lock(h->lock);
+ buf->bl.reassign_to_mempool(mempool::mempool_bluefs_file_reader);
if (off < buf->bl_off || off >= buf->get_buf_end()) {
// if precondition hasn't changed during locking upgrade.
buf->bl.clear();
// do not bother to dirty the file if we are overwriting
// previously allocated extents.
bool must_dirty = false;
- uint64_t clear_upto = 0;
if (allocated < offset + length) {
// we should never run out of log space here; see the min runway check
// in _flush_and_sync_log.
ceph_abort_msg("bluefs enospc");
return r;
}
- if (cct->_conf->bluefs_preextend_wal_files &&
- h->writer_type == WRITER_WAL) {
- // NOTE: this *requires* that rocksdb also has log recycling
- // enabled and is therefore doing robust CRCs on the log
- // records. otherwise, we will fail to reply the rocksdb log
- // properly due to garbage on the device.
- h->file->fnode.size = h->file->fnode.get_allocated();
- clear_upto = h->file->fnode.size;
- dout(10) << __func__ << " extending WAL size to 0x" << std::hex
- << h->file->fnode.size << std::dec << " to include allocated"
- << dendl;
- }
must_dirty = true;
}
if (h->file->fnode.size < offset + length) {
}
}
}
- if (length == partial + h->buffer.length() || clear_upto != 0) {
+ if (length == partial + h->buffer.length()) {
/* in case of inital allocation and need to zero, limited flush is unacceptable */
bl.claim_append_piecewise(h->buffer);
} else {
} else {
h->tail_block.clear();
}
- if (clear_upto != 0) {
- if (offset + length < clear_upto) {
- dout(20) << __func__ << " zeroing WAL log up to 0x"
- << std::hex << clear_upto
- << std::dec << dendl;
- bl.append_zero(clear_upto - (offset + length));
- length += clear_upto - (offset + length);
- }
- }
ceph_assert(bl.length() == length);
switch (h->writer_type) {
void BlueFS::_close_writer(FileWriter *h)
{
dout(10) << __func__ << " " << h << " type " << h->writer_type << dendl;
+ h->buffer.reassign_to_mempool(mempool::mempool_bluefs_file_writer);
for (unsigned i=0; i<MAX_BDEV; ++i) {
if (bdev[i]) {
if (h->iocv[i]) {