mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-20 06:56:28 -05:00
Add bandwidth limit feature --bw-limit
This commit is contained in:
parent
15a5fac6e9
commit
5886923bb1
19 changed files with 205 additions and 5 deletions
|
|
@ -888,9 +888,20 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
|
|||
char esc_buffer[ESC_MAX];
|
||||
char esc_buffer_alt[ESC_MAX];
|
||||
bit_vect_t* block_enabled;
|
||||
struct snapraid_bw bw;
|
||||
|
||||
handle = handle_mapping(state, &diskmax);
|
||||
|
||||
/* initialize the bandwith context */
|
||||
bw_init(&bw, state->opt.bwlimit);
|
||||
|
||||
/* share the bandwidth context with all handles */
|
||||
for (j = 0; j < diskmax; ++j)
|
||||
handle[j].bw = &bw;
|
||||
for (j = 0; j < state->level; ++j)
|
||||
if (parity[j])
|
||||
parity[j]->bw = &bw;
|
||||
|
||||
/* we need 1 * data + 2 * parity + 1 * zero */
|
||||
buffermax = diskmax + 2 * state->level + 1;
|
||||
|
||||
|
|
@ -2085,4 +2096,3 @@ int state_check(struct snapraid_state* state, int fix, block_off_t blockstart, b
|
|||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue