Add bandwidth limit feature --bw-limit

This commit is contained in:
Allan Clark 2025-03-27 12:57:41 -07:00 • committed by Andrea Mazzoleni
parent 15a5fac6e9
commit 5886923bb1
19 changed files with 205 additions and 5 deletions

View file

@ -877,6 +877,15 @@ void io_init(struct snapraid_io* io, struct snapraid_state* state,
io->state = state;
/* initialize bandwidth limiting */
bw_init(&io->bw, state->opt.bwlimit);
/* set IO context in handles */
for (i = 0; i < handle_max; ++i)
handle_map[i].bw = &io->bw;
for (i = 0; i < parity_handle_max; ++i)
parity_handle_map[i].bw = &io->bw;
#if HAVE_THREAD
if (io_cache == 0) {
/* default is 16 MiB of cache */