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

ThinProvision: skip all zero buffers #318

Closed
wants to merge 3 commits into from
Closed

ThinProvision: skip all zero buffers #318

wants to merge 3 commits into from

Conversation

shosseinimotlagh
Copy link
Contributor

No description provided.

return result;
}

static std::vector< std::pair< int, int > > compute_range_intervals(const uint8_t* buf, size_t page_size,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for later extension on subranges

@shosseinimotlagh shosseinimotlagh changed the title Thin skip all zero Thin skip all zero buffers Feb 12, 2024
@shosseinimotlagh shosseinimotlagh changed the base branch from thin_provisioning to stable/v3.x February 12, 2024 16:41
@shosseinimotlagh shosseinimotlagh changed the title Thin skip all zero buffers ThinProvision: skip all zero buffers Feb 12, 2024
@@ -18,7 +18,6 @@ AlignOperands: false
AlignTrailingComments: true
AllowShortBlocksOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
AllowShortBlocksOnASingleLine: true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verbose (line 19)

Copy link
Contributor

@raakella1 raakella1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please open the PR against thin prov branch.

@shosseinimotlagh shosseinimotlagh changed the base branch from stable/v3.x to thin_provisioning February 22, 2024 19:05
std::vector< bool > empty_blocks;

auto is_buf_empty = [](const uint8_t* buf, size_t size) -> bool {
return buf[0] == 0 && !std::memcmp(buf, buf + 1, size - 1);
Copy link
Contributor

@yamingk yamingk Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as we discussed, you are going to change it with the intel crc api to detect zerod crc then do a bitwise compare, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

affirmative. I will make this change and will update this pr

@@ -142,6 +142,8 @@ table Generic {
// percentage of cache used to create indx mempool. It should be more than 100 to
// take into account some floating buffers in writeback cache.
indx_mempool_percent : uint32 = 110;

boot_thin_provisioning: bool = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the deployment plan to enable this feature in production if this is defaulted to false?

@@ -335,7 +335,105 @@ indx_tbl* Volume::recover_indx_tbl(btree_super_block& sb, btree_cp_sb& cp_info)
return static_cast< indx_tbl* >(tbl);
}

static std::vector< std::pair< int, int > > get_true_intervals(const std::vector< bool >& empty_blocks) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any place using this api as well as copmute_range_intervals, can we remove them unless there is a plan to use them in the near future?

return is_iovec_zero(iface_req->iovecs);
}

static std::string print_ranges(lba_t start_lba, const std::vector< std::pair< int, int > >& intervals) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one also can be removed if not going to be used

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put these three APIs that are currently not used together and make an #if 0 around them, so that it would be easier for others to read and understand this thin-provisioning code? Also put comment that these apis are for future usage if we support paritial zero detection.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

@@ -2758,6 +2795,9 @@ int main(int argc, char* argv[]) {
gcfg.app_mem_size_in_gb = SISL_OPTIONS["app_mem_size_in_gb"].as< uint32_t >();
gcfg.vol_copy_file_path = SISL_OPTIONS["vol_copy_file_path"].as< std::string >();
const auto io_size_in_kb = SISL_OPTIONS["io_size"].as< uint32_t >();
gcfg.p_zero_buffer = SISL_OPTIONS["p_zero_buffer"].as< uint32_t >();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as we discussed, would suggest to add a basic zero write/read test case:

  1. populate real data from LBA [0, 2MB]
  2. write all zeros to [128K, 128K + 32K]
  3. read LBA from [128K, 128K + 32K], verify all zeros are returned.

Another basic test:
Similar as above one, only skip the 1st step, e.g. write zeros to LBAs that has never been written before.

This is to verify that new writes and/or overwrite with all zeros both works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me. I am adding it to the PR

@shosseinimotlagh shosseinimotlagh deleted the thin_skip_all_zero branch March 5, 2024 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants