Skip to content

Commit

Permalink
Apply comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shosseinimotlagh committed Sep 19, 2024
1 parent e7453e4 commit 1fbb18d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/engine/blkstore/blkstore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ class BlkStore {
hints.is_contiguous = true;
HS_DBG_ASSERT_LE(nblks, BlkId::max_blks_in_op(), "nblks {} more than max blks {}", nblks,
BlkId::max_blks_in_op());
return (m_vdev.alloc_contiguous_blk(nblks, hints, out_blkid));
return (m_vdev.alloc_contiguous_blk(static_cast< blk_count_t >(nblks), hints, out_blkid));
}

/* Allocate a new block of the size based on the hints provided */
Expand All @@ -341,13 +341,15 @@ class BlkStore {
// pages * 4096 bytes/page).
uint32_t nblks{static_cast< uint32_t >(size / m_pagesz)};
if (nblks <= BlkId::max_blks_in_op()) {
return (m_vdev.alloc_blk(nblks, hints, out_blkid));
auto max_val = std::numeric_limits< blk_count_t >::max();
HS_DBG_ASSERT_LE(nblks, max_val, "max_blks_in_op must be less than {}", max_val);
return (m_vdev.alloc_blk(static_cast< blk_count_t >(nblks), hints, out_blkid));
} else {
while (nblks != 0) {
static thread_local std::vector< BlkId > result_blkid{};
result_blkid.clear();
const uint32_t nblks_op{std::min(static_cast< uint32_t >(BlkId::max_blks_in_op()), nblks)};
const auto ret{m_vdev.alloc_blk(nblks_op, hints, result_blkid)};
const auto ret{m_vdev.alloc_blk(static_cast< blk_count_t >(nblks_op), hints, result_blkid)};
if (ret != BlkAllocStatus::SUCCESS) { return ret; }
out_blkid.insert(std::end(out_blkid), std::make_move_iterator(std::begin(result_blkid)),
std::make_move_iterator(std::end(result_blkid)));
Expand Down
2 changes: 1 addition & 1 deletion src/homeblks/volume/tests/vol_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2607,7 +2607,7 @@ SISL_OPTION_GROUP(
(oob_unmap_enable, "", "oob_unmap_enable", "out-of-band unmap enable 0 or 1",
::cxxopts::value< uint32_t >()->default_value("0"), "flag"),
(max_disk_capacity, "", "max_disk_capacity", "max disk capacity",
::cxxopts::value< uint64_t >()->default_value("20"), "GB"),
::cxxopts::value< uint64_t >()->default_value("10"), "GB"),
(max_volume, "", "max_volume", "max volume", ::cxxopts::value< uint64_t >()->default_value("50"), "number"),
(max_num_writes, "", "max_num_writes", "max num of writes", ::cxxopts::value< uint64_t >()->default_value("100000"),
"number"),
Expand Down
2 changes: 1 addition & 1 deletion src/homeblks/volume/tool/hs_svc_tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ SISL_OPTION_GROUP(hs_svc_tool,
(device_list, "", "device_list", "List of device paths",
::cxxopts::value< std::vector< std::string > >(), "path [...]"),
(dev_size_gb, "", "dev_size_gb", "size of each device in GB",
::cxxopts::value< uint64_t >()->default_value("10"), "number"),
::cxxopts::value< uint64_t >()->default_value("5"), "number"),
(zero_boot_sb, "", "zero_boot_sb", "mark homestore init state",
::cxxopts::value< bool >()->default_value("false"), "true or false"),
(spdk, "", "spdk", "spdk", ::cxxopts::value< bool >()->default_value("false"), "true or false"));
Expand Down

0 comments on commit 1fbb18d

Please sign in to comment.