seastar icon indicating copy to clipboard operation
seastar copied to clipboard

Mark file alignments as const

Open xemul opened this issue 2 years ago • 2 comments

There are four of them currently, they are set when file is constructed and never change then, but are not marked as const. The main (and the only) obstacle is that the values are initialized in inheritants' constructors bodies. So the main change in this set is moving the initialization into file_impl's initializer lists

xemul avatar Oct 04 '22 16:10 xemul

Didn't we leak these members? Will layered file implementations break?

I see it in scylladb-enterprise mirrored_file_impl.

avikivity avatar Oct 18 '22 16:10 avikivity

Didn't we leak these members?

I don't think we did -- they are plain integers

Will layered file implementations break?

It will:

in_memory_file_impl::in_memory_file_impl(std::shared_ptr<foreign_ptr<std::unique_ptr<in_memory_data_store>>> data)
        : _data(std::move(data))
{
    // We're not doing any actual dma transfers and we do not require
    // any specific alignment.
    // The following alignment parameters are solely an optimization.
    _memory_dma_alignment = seastar::cache_line_size;
    _disk_read_dma_alignment = in_memory_data_store::chunk_size;
    _disk_write_dma_alignment = in_memory_data_store::chunk_size;
}

someone will need to patch it to use : file_impl(...) delegation

xemul avatar Oct 18 '22 17:10 xemul