-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fixed the number of chunks issue #415
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,8 +220,10 @@ void PhysicalDev::submit_batch() { m_drive_iface->submit_batch(); } | |
|
||
//////////////////////////// Chunk Creation/Load related methods ///////////////////////////////////////// | ||
void PhysicalDev::format_chunks() { | ||
m_chunk_info_slots = std::make_unique< sisl::Bitset >(hs_super_blk::chunk_info_bitmap_size(m_dev_info)); | ||
m_chunk_info_slots = std::make_unique< sisl::Bitset >(std::max(1u, hs_super_blk::max_chunks_in_pdev(m_dev_info))); | ||
auto bitmap_mem = m_chunk_info_slots->serialize(m_pdev_info.dev_attr.align_size); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are asking the bitset library to serialize based on pdev align size. So I don't see anything wrong here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in |
||
HS_REL_ASSERT_LE(bitmap_mem->size(), hs_super_blk::chunk_info_bitmap_size(m_dev_info), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see however the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe change
|
||
"Chunk info serialized bitmap mismatch with expected size"); | ||
write_super_block(bitmap_mem->cbytes(), bitmap_mem->size(), hs_super_blk::chunk_sb_offset()); | ||
} | ||
|
||
|
@@ -234,7 +236,7 @@ std::vector< shared< Chunk > > PhysicalDev::create_chunks(const std::vector< uin | |
|
||
try { | ||
while (chunks_remaining > 0) { | ||
auto b = m_chunk_info_slots->get_next_contiguous_n_reset_bits(0u, chunks_remaining); | ||
auto b = m_chunk_info_slots->get_next_contiguous_n_reset_bits(0u, std::nullopt, 1u, chunks_remaining); | ||
if (b.nbits == 0) { throw std::out_of_range("System has no room for additional chunk"); } | ||
|
||
auto buf = hs_utils::iobuf_alloc(chunk_info::size * b.nbits, sisl::buftag::superblk, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add
alignment_size = 4096
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't understand the comment, why would I need to alignment_size here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you specified alignment when initializing the bitset , and use same alignment configuration for
serialize()
, theserialize()
is free, otherwise it is a copy.c.f https://github.com/eBay/sisl/blob/03282536e309252d85319bebf4b227be0be6f9fe/include/sisl/fds/bitset.hpp#L647
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now , when we call
max_chunks_in_pdev
, we calculate the max_chunks_num using the following code.however , we have superblk and vdevinfo in the starting part of a pdev, which will also take some space of a pdev. so should we take into account this when calculating?