mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-05 06:10:13 -05:00
Add a new test option to force parity update
This commit is contained in:
parent
a9701d3e7c
commit
62aba9228a
3 changed files with 9 additions and 1 deletions
|
|
@ -248,6 +248,7 @@ void config(char* conf, size_t conf_size, const char* argv0)
|
||||||
#define OPT_NO_WARNINGS 286
|
#define OPT_NO_WARNINGS 286
|
||||||
#define OPT_TEST_FAKE_UUID 287
|
#define OPT_TEST_FAKE_UUID 287
|
||||||
#define OPT_TEST_MATCH_FIRST_UUID 288
|
#define OPT_TEST_MATCH_FIRST_UUID 288
|
||||||
|
#define OPT_TEST_FORCE_PARITY_UPDATE 289
|
||||||
|
|
||||||
#if HAVE_GETOPT_LONG
|
#if HAVE_GETOPT_LONG
|
||||||
struct option long_options[] = {
|
struct option long_options[] = {
|
||||||
|
|
@ -372,6 +373,9 @@ struct option long_options[] = {
|
||||||
/* Match first UUID */
|
/* Match first UUID */
|
||||||
{ "test-match-first-uuid", 0, 0, OPT_TEST_MATCH_FIRST_UUID },
|
{ "test-match-first-uuid", 0, 0, OPT_TEST_MATCH_FIRST_UUID },
|
||||||
|
|
||||||
|
/* Force parity update even if all the data is not changed */
|
||||||
|
{ "test-force-parity-update", 0, 0, OPT_TEST_FORCE_PARITY_UPDATE },
|
||||||
|
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -747,6 +751,9 @@ int main(int argc, char* argv[])
|
||||||
case OPT_TEST_MATCH_FIRST_UUID :
|
case OPT_TEST_MATCH_FIRST_UUID :
|
||||||
opt.match_first_uuid = 1;
|
opt.match_first_uuid = 1;
|
||||||
break;
|
break;
|
||||||
|
case OPT_TEST_FORCE_PARITY_UPDATE :
|
||||||
|
opt.force_parity_update = 1;
|
||||||
|
break;
|
||||||
default :
|
default :
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
log_fatal("Unknown option '%c'\n", (char)c);
|
log_fatal("Unknown option '%c'\n", (char)c);
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,7 @@ struct snapraid_option {
|
||||||
int expected_missing; /**< If missing files are expected and should not be reported. */
|
int expected_missing; /**< If missing files are expected and should not be reported. */
|
||||||
int fake_uuid; /**< Set fakes UUID for testing. */
|
int fake_uuid; /**< Set fakes UUID for testing. */
|
||||||
int match_first_uuid; /**< Force the matching of the first UUID. */
|
int match_first_uuid; /**< Force the matching of the first UUID. */
|
||||||
|
int force_parity_update; /**< Force parity update even if data is not changed. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -554,7 +554,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari
|
||||||
/* have the hash cleared (::clear_past_hash flag), and then they won't never match the hash. */
|
/* have the hash cleared (::clear_past_hash flag), and then they won't never match the hash. */
|
||||||
/* We are treating only CHG blocks created at runtime. */
|
/* We are treating only CHG blocks created at runtime. */
|
||||||
/* In such case, we can avoid to update parity, because it would be the same as before */
|
/* In such case, we can avoid to update parity, because it would be the same as before */
|
||||||
parity_needs_to_be_updated = 0;
|
parity_needs_to_be_updated = state->opt.force_parity_update;
|
||||||
|
|
||||||
/* if the block is marked as bad, we force the parity update */
|
/* if the block is marked as bad, we force the parity update */
|
||||||
/* because the bad block may be the result of a wrong parity */
|
/* because the bad block may be the result of a wrong parity */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue