[thin_check] Support fixing leaked metadata blocks

- The leaked blocks are defined as allocated but not used ones,
  i.e., expected ref-count == 0 and actual ref-count <= 2.
- Blocks with expected ref-count > 0, or actual ref-count > 2,
  are treated as unrepairable leaks.
- The fixing processing won't be executed if there's any
  unrepairable leak or errors.
- The fixing process implicitly clearing the superblock
  needs_check flag if there's no error.
This commit is contained in:
Ming-Hung Tsai
2020-07-14 17:57:29 +08:00
parent 7be6b91420
commit 49efa06ffa
3 changed files with 232 additions and 61 deletions

View File

@@ -40,17 +40,20 @@ namespace thin_provisioning {
check_options();
bool check_conformance();
void set_superblock_only();
void set_skip_mappings();
void set_override_mapping_root(bcache::block_address b);
void set_metadata_snap();
void set_ignore_non_fatal();
void set_fix_metadata_leaks();
bool use_metadata_snap_;
data_mapping_options data_mapping_opts_;
space_map_options sm_opts_;
boost::optional<bcache::block_address> override_mapping_root_;
bool ignore_non_fatal_;
bool fix_metadata_leaks_;
};
enum output_options {
@@ -59,7 +62,7 @@ namespace thin_provisioning {
};
base::error_state
check_metadata(persistent_data::block_manager::ptr bm,
check_metadata(std::string const &path,
check_options const &check_opts,
output_options output_opts);
}