mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Fixes the percentage computation in scrub.
This commit is contained in:
parent
210975556e
commit
0489c98bb0
1 changed files with 19 additions and 10 deletions
29
scrub.c
29
scrub.c
|
|
@ -100,10 +100,14 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
|
|||
continue;
|
||||
}
|
||||
|
||||
/* if we reached the count limit */
|
||||
if (countmax >= countlimit) {
|
||||
/* skip it */
|
||||
continue;
|
||||
/* if the time is less than the limit, always include */
|
||||
/* otherwise, check if we reaced the count max */
|
||||
if (blocktime == timelimit) {
|
||||
/* if we reached the count limit */
|
||||
if (countmax >= countlimit) {
|
||||
/* skip it */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -153,10 +157,14 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
|
|||
continue;
|
||||
}
|
||||
|
||||
/* if we reached the count limit */
|
||||
if (recountmax >= countlimit) {
|
||||
/* skip it */
|
||||
continue;
|
||||
/* if the time is less than the limit, always include */
|
||||
/* otherwise, check if we reaced the count max */
|
||||
if (blocktime == timelimit) {
|
||||
/* if we reached the count limit */
|
||||
if (recountmax >= countlimit) {
|
||||
/* skip it */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -463,7 +471,7 @@ int state_scrub(struct snapraid_state* state, int percentage, int olderthan)
|
|||
recentlimit = now;
|
||||
} else if (percentage != -1 || olderthan != -1) {
|
||||
if (percentage != -1)
|
||||
countlimit = blockmax * percentage / 100;
|
||||
countlimit = (blockmax * percentage + 99) / 100;
|
||||
else
|
||||
countlimit = blockmax;
|
||||
if (olderthan != -1)
|
||||
|
|
@ -512,8 +520,9 @@ int state_scrub(struct snapraid_state* state, int percentage, int olderthan)
|
|||
timelimit = info_get_time(infomap[countlimit - 1]);
|
||||
|
||||
/* don't scrub too recent blocks */
|
||||
if (timelimit > recentlimit)
|
||||
if (timelimit > recentlimit) {
|
||||
timelimit = recentlimit;
|
||||
}
|
||||
} else {
|
||||
/* we don't have a time limit based on quota */
|
||||
timelimit = recentlimit;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue