open-cas-linux/configure.d/1_bio_max_vecs.conf
Michal Mielewczyk 4753374b1b Change CAS_BIO_MAX_VECS value
Previously when user tried to allocate to big bio he recieved NULL. As the
behavior was changed to `BUG()` passing out of range value is no longer legal.

Limiting the requested bio size to BIO_MAX_PAGES (on the older kernels) or to
BIO_MAX_VECS (on the newer ones) eliminates the problem as the macros represent
the max possible value.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2022-12-28 13:59:20 +01:00

32 lines
609 B
Bash

#!/bin/bash
#
# Copyright(c) 2022 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
. $(dirname $3)/conf_framework.sh
check() {
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "int n; n = BIO_MAX_VECS;" "linux/bio.h"
then
echo $cur_name 1 >> $config_file_path
else
echo $cur_name 2 >> $config_file_path
fi
}
apply() {
case "$1" in
"1")
add_define "CAS_BIO_MAX_VECS ((uint32_t)BIO_MAX_VECS)" ;;
"2")
add_define "CAS_BIO_MAX_VECS ((uint32_t)BIO_MAX_PAGES)" ;;
*)
exit 1
esac
}
conf_run $@