Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support flexible virtual device creation in HomeStore with num_chunks or chunk_size #597

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class HomestoreConan(ConanFile):
name = "homestore"
version = "6.5.17"
version = "6.5.18"

homepage = "https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
Expand Down
8 changes: 5 additions & 3 deletions src/include/homestore/blkdata_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,19 @@ class BlkDataService {

/**
* @brief Creates a new virtual device with the specified size and block size, using the specified
* block allocator and chunk selector types. The virtual device will be composed of the specified
* number of chunks.
* block allocator and chunk selector types. The virtual device will be composed of a number of chunks.
* Either `num_chunks` or `chunk_size` must be specified.
* Prioritize `num_chunks` over `chunk_size` if both are provided.
*
* @param size The size of the virtual device, in bytes.
* @param blk_size The size of each block in the virtual device, in bytes.
* @param alloc_type The type of block allocator to use for the virtual device.
* @param chunk_sel_type The type of chunk selector to use for the virtual device.
* @param num_chunks The number of chunks to use for the virtual device.
* @param chunk_size The size of chunks to use for the virtual device, in bytes.
*/
void create_vdev(uint64_t size, HSDevType devType, uint32_t blk_size, blk_allocator_type_t alloc_type,
chunk_selector_type_t chunk_sel_type, uint32_t num_chunks);
chunk_selector_type_t chunk_sel_type, uint32_t num_chunks, uint32_t chunk_size);

/**
* @brief Opens a virtual device with the specified virtual device information.
Expand Down
3 changes: 2 additions & 1 deletion src/lib/blkdata_svc/blkdata_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ BlkDataService::~BlkDataService() = default;

// first-time boot path
void BlkDataService::create_vdev(uint64_t size, HSDevType devType, uint32_t blk_size, blk_allocator_type_t alloc_type,
chunk_selector_type_t chunk_sel_type, uint32_t num_chunks) {
chunk_selector_type_t chunk_sel_type, uint32_t num_chunks, uint32_t chunk_size) {
hs_vdev_context vdev_ctx;
vdev_ctx.type = hs_vdev_type_t::DATA_VDEV;

Expand All @@ -48,6 +48,7 @@ void BlkDataService::create_vdev(uint64_t size, HSDevType devType, uint32_t blk_
.vdev_size = size,
.num_chunks = num_chunks,
.blk_size = blk_size,
.chunk_size = chunk_size,
.dev_type = devType,
.alloc_type = alloc_type,
.chunk_sel_type = chunk_sel_type,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/homestore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,11 @@ void HomeStore::format_and_start(std::map< uint32_t, hs_format_params >&& format
} else if ((svc_type & HS_SERVICE::DATA) && has_data_service()) {
m_data_service->create_vdev(pct_to_size(fparams.size_pct, fparams.dev_type), fparams.dev_type,
fparams.block_size, fparams.alloc_type, fparams.chunk_sel_type,
fparams.num_chunks);
fparams.num_chunks, fparams.chunk_size);
} else if ((svc_type & HS_SERVICE::REPLICATION) && has_repl_data_service()) {
m_data_service->create_vdev(pct_to_size(fparams.size_pct, fparams.dev_type), fparams.dev_type,
fparams.block_size, fparams.alloc_type, fparams.chunk_sel_type,
fparams.num_chunks);
fparams.num_chunks, fparams.chunk_size);
}
}

Expand Down
Loading