mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-25 18:40:19 -04:00
Validate that the total disk buffer memory does not exceed 256 MiB
This commit is contained in:
parent
65e1eac061
commit
33d96adbce
1 changed files with 12 additions and 0 deletions
|
|
@ -224,6 +224,18 @@ static void state_config_check(struct snapraid_state* state, const char* path, t
|
|||
{
|
||||
tommy_node* i;
|
||||
unsigned l, s;
|
||||
size_t disk_count;
|
||||
|
||||
/* check total memory budget for block buffers (max 256 MiB) */
|
||||
disk_count = tommy_list_count(&state->disklist) + state->level;
|
||||
if (disk_count > (256 * 1024) / (state->block_size / KIBI)) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal(EUSER, "The combination of %zu disks and %u KiB 'blocksize' in '%s' exceeds the 256 MiB limit.\n",
|
||||
disk_count, state->block_size / KIBI, path);
|
||||
log_fatal(EUSER, "Please reduce the 'blocksize' or the number of disks.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/* check for parity level */
|
||||
if (state->raid_mode == RAID_MODE_VANDERMONDE_RAID) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue