mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Add a new undocumented --filter-block-error option
This commit is contained in:
parent
6e717a8239
commit
836fd6b1e0
3 changed files with 28 additions and 5 deletions
|
|
@ -801,8 +801,21 @@ static int block_is_enabled(struct snapraid_state* state, block_off_t i, struct
|
|||
unsigned j;
|
||||
unsigned l;
|
||||
|
||||
/* filter for bad blocks */
|
||||
if (state->opt.badblockonly) {
|
||||
snapraid_info info;
|
||||
|
||||
/* get block specific info */
|
||||
info = info_get(&state->infoarr, i);
|
||||
|
||||
/*
|
||||
* Filter specifically only for bad blocks
|
||||
*/
|
||||
return info_get_bad(info);
|
||||
}
|
||||
|
||||
/* filter for the parity */
|
||||
if (state->opt.badonly) {
|
||||
if (state->opt.badfileonly) {
|
||||
snapraid_info info;
|
||||
|
||||
/* get block specific info */
|
||||
|
|
|
|||
|
|
@ -315,6 +315,7 @@ struct option long_options[] = {
|
|||
{ "filter-disk", 1, 0, 'd' },
|
||||
{ "filter-missing", 0, 0, 'm' },
|
||||
{ "filter-error", 0, 0, 'e' },
|
||||
{ "filter-block-error", 0, 0, 'b' },
|
||||
{ "percentage", 1, 0, 'p' }, /* legacy name for --plan */
|
||||
{ "plan", 1, 0, 'p' },
|
||||
{ "older-than", 1, 0, 'o' },
|
||||
|
|
@ -478,7 +479,7 @@ struct option long_options[] = {
|
|||
};
|
||||
#endif
|
||||
|
||||
#define OPTIONS "c:f:d:mep:o:S:B:L:i:l:ZEUDNFRahTC:vqHVG"
|
||||
#define OPTIONS "c:f:d:mebp:o:S:B:L:i:l:ZEUDNFRahTC:vqHVG"
|
||||
|
||||
volatile int global_interrupt = 0;
|
||||
|
||||
|
|
@ -627,10 +628,18 @@ int main(int argc, char* argv[])
|
|||
opt.expected_missing = 1;
|
||||
break;
|
||||
case 'e' :
|
||||
/* when processing only error, we filter both files and blocks */
|
||||
/* when processing only error, we filter files */
|
||||
/* and we apply fixes only to synced ones */
|
||||
filter_error = 1;
|
||||
opt.badonly = 1;
|
||||
opt.badfileonly = 1;
|
||||
opt.syncedonly = 1;
|
||||
break;
|
||||
case 'b' :
|
||||
/* when processing only block with error, we filter both files and blocks */
|
||||
/* and we apply fixes only to synced ones */
|
||||
filter_error = 1;
|
||||
opt.badfileonly = 1;
|
||||
opt.badblockonly = 1;
|
||||
opt.syncedonly = 1;
|
||||
break;
|
||||
case 'p' :
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@ extern volatile int global_interrupt;
|
|||
struct snapraid_option {
|
||||
int gui; /**< Gui output. */
|
||||
int auditonly; /**< In check, checks only the hash and not the parity. */
|
||||
int badonly; /**< In fix, fixes only the blocks marked as bad. */
|
||||
int badfileonly; /**< In fix, fixes only files marked as bad. */
|
||||
int badblockonly; /**< In fix, fixes only the blocks marked as bad. */
|
||||
int syncedonly; /**< In fix, fixes only files that are synced. */
|
||||
int prehash; /**< Enables the prehash mode for sync. */
|
||||
unsigned io_error_limit; /**< Max number of input/output errors before aborting. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue