mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-02 04:46:46 -05:00
Default to 8 MiB of blocks for the IO cache
This commit is contained in:
parent
e2c4399e28
commit
377352e64f
1 changed files with 11 additions and 4 deletions
15
cmdline/io.c
15
cmdline/io.c
|
|
@ -56,10 +56,17 @@ void io_init(struct snapraid_io* io, struct snapraid_state* state,
|
||||||
pthread_cond_init(&io->write_sched, 0);
|
pthread_cond_init(&io->write_sched, 0);
|
||||||
|
|
||||||
io->state = state;
|
io->state = state;
|
||||||
if (io_cache == 0)
|
if (io_cache == 0) {
|
||||||
io->io_max = 32;
|
/* default is 8 MiB of cache */
|
||||||
else
|
/* this seems to be a good tradeoff between speed and memory usage */
|
||||||
|
io->io_max = 8 * 1024 * 1024 / state->block_size;
|
||||||
|
if (io->io_max < IO_MIN)
|
||||||
|
io->io_max = IO_MIN;
|
||||||
|
if (io->io_max > IO_MAX)
|
||||||
|
io->io_max = IO_MAX;
|
||||||
|
} else {
|
||||||
io->io_max = io_cache;
|
io->io_max = io_cache;
|
||||||
|
}
|
||||||
|
|
||||||
assert(io->io_max >= IO_MIN && io->io_max <= IO_MAX);
|
assert(io->io_max >= IO_MIN && io->io_max <= IO_MAX);
|
||||||
|
|
||||||
|
|
@ -72,7 +79,7 @@ void io_init(struct snapraid_io* io, struct snapraid_state* state,
|
||||||
allocated += state->block_size * buffer_max;
|
allocated += state->block_size * buffer_max;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_progress("Using %u MiB of memory for the IO cache.\n", (unsigned)(allocated / MEBI));
|
msg_progress("Using %u MiB of memory for %u blocks of IO cache.\n", (unsigned)(allocated / MEBI), io->io_max);
|
||||||
|
|
||||||
if (parity_writer) {
|
if (parity_writer) {
|
||||||
io->reader_max = handle_max;
|
io->reader_max = handle_max;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue