Enable configure script to compile test modules in parallel.

This patch significantly reduces time needed to prepare config file.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2019-07-11 09:21:31 -04:00
parent 13c51041ff
commit 9473cf9795
36 changed files with 355 additions and 261 deletions

36
configure vendored
View File

@ -19,16 +19,37 @@ SCRIPTPATH=`realpath $SCRIPTPATH`
CONFIG_FILES=`ls $SCRIPTPATH/configure.d/*.conf | sort` CONFIG_FILES=`ls $SCRIPTPATH/configure.d/*.conf | sort`
FILES_COUNT=`echo $CONFIG_FILES | wc -w` FILES_COUNT=`echo $CONFIG_FILES | wc -w`
CONFIG_FILE="config.out"
generate_config() { generate_config() {
rm -f config.out rm -f ${CONFIG_FILE}
touch ${CONFIG_FILE}
declare -a pid_list
progress=0 progress=0
# Compile each test module in backgorund
echo "Preparing configuration"
for file in $CONFIG_FILES; do for file in $CONFIG_FILES; do
progress=$((progress+1)) progress=$((progress+1))
echo -ne "Generating configuration: $progress/$FILES_COUNT\033[0K\r" # $1 - Action to be performed
CONF="$(/bin/bash $file "check")" # $2 - File with stored configuration
echo "$(basename $file) $CONF" >> config.out # $3 - Name of called script (since script is running as subprocess
# it has to be passed explicitly
source $file "check" "${SCRIPTPATH}/${CONFIG_FILE}" "$file" &
pid_list+=($!)
done done
echo ""
# Wait for all compilation processes to finish
for i in "${pid_list[@]}"; do
wait $i &> /dev/null
done
grep "X" ${SCRIPTPATH}/${CONFIG_FILE} &> /dev/null
if [ $? -eq 0 ] ; then
echo "ERROR! Following steps failed while preparing config:"
grep "X" ${SCRIPTPATH}/${CONFIG_FILE} | cut -f1 -d ' '
exit 1
fi
} }
generate_header() { generate_header() {
@ -37,15 +58,14 @@ generate_header() {
for file in $CONFIG_FILES; do for file in $CONFIG_FILES; do
progress=$((progress+1)) progress=$((progress+1))
echo -ne "Configuring OpenCAS: $progress/$FILES_COUNT\033[0K\r" echo -ne "Configuring OpenCAS: $progress/$FILES_COUNT\033[0K\r"
CONF=$(cat config.out | awk -v file=$(basename $file) '{ if ($1 == file) print $2 }') CONF=$(cat ${CONFIG_FILE} | awk -v file=$(basename $file) '{ if ($1 == file) print $2 }')
/bin/bash $file "apply" "$CONF" /bin/bash $file "apply" "$CONF" "$file"
done done
echo "" echo ""
} }
if [ -z "$1" ]; then if [ -z "$1" ]; then
generate_config generate_config
CONFIG_FILE="config.out"
else else
CONFIG_FILE="$1" CONFIG_FILE="$1"
fi fi

View File

@ -4,14 +4,17 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "struct bio *b;blk_rq_append_bio(NULL, &b)" "linux/blkdev.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct bio *b;blk_rq_append_bio(NULL, &b)" "linux/blkdev.h"
then then
echo "1" echo $cur_name 1 >> $config_file_path
else else
echo "2" echo $cur_name 2 >> $config_file_path
fi fi
} }

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "lookup_bdev(\"some_path\")" "linux/fs.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "lookup_bdev(\"some_path\")" "linux/fs.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "lookup_bdev(\"some_path\", 0)" "linux/fs.h" elif compile_module $cur_name "lookup_bdev(\"some_path\", 0)" "linux/fs.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,20 +4,22 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "bio_clone(NULL, 0)" "linux/bio.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "bio_clone(NULL, 0)" "linux/bio.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "bio_clone_kmalloc(NULL, 0)" "linux/bio.h" elif compile_module $cur_name "bio_clone_kmalloc(NULL, 0)" "linux/bio.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
elif compile_module "bio_clone_fast(NULL, 0, NULL)" "linux/bio.h" elif compile_module $cur_name "bio_clone_fast(NULL, 0, NULL)" "linux/bio.h"
then then
echo "3" echo $cur_name "3" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "struct bio b;b.bi_end_io(NULL, 0)" "linux/bio.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct bio b;b.bi_end_io(NULL, 0)" "linux/bio.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "struct bio b;b.bi_end_io(NULL)" "linux/bio.h" elif compile_module $cur_name "struct bio b;b.bi_end_io(NULL)" "linux/bio.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,22 +4,25 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "bio_op(NULL)" "linux/bio.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "bio_op(NULL)" "linux/bio.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "REQ_OP_MASK" "linux/blk_types.h" elif compile_module $cur_name "REQ_OP_MASK" "linux/blk_types.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
elif compile_module "REQ_OP_DISCARD" "linux/blk_types.h" elif compile_module $cur_name "REQ_OP_DISCARD" "linux/blk_types.h"
then then
echo "3" echo $cur_name "3" >> $config_file_path
elif compile_module "REQ_DISCARD" "linux/blk_types.h" elif compile_module $cur_name "REQ_DISCARD" "linux/blk_types.h"
then then
echo "4" echo $cur_name "4" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,17 +4,17 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "struct bio b;b.bi_status" "linux/bio.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct bio b;b.bi_status" "linux/bio.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "struct bio b;b.bi_error" "linux/bio.h" elif compile_module $cur_name "struct bio b;b.bi_error" "linux/bio.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
else
echo "X"
fi fi
} }

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "struct bio b;b.bi_opf" "linux/bio.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct bio b;b.bi_opf" "linux/bio.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "struct bio b;b.bi_rw" "linux/bio.h" elif compile_module $cur_name "struct bio b;b.bi_rw" "linux/bio.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "struct bio b;b.bi_iter.bi_size" "linux/bio.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct bio b;b.bi_iter.bi_size" "linux/bio.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "struct bio b;b.bi_size" "linux/bio.h" elif compile_module $cur_name "struct bio b;b.bi_size" "linux/bio.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "struct bio b;&bio_iovec(&b)" "linux/bio.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct bio b;&bio_iovec(&b)" "linux/bio.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
else else
echo "2" echo $cur_name "2" >> $config_file_path
fi fi
} }

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "blk_rq_set_block_pc(NULL)" "linux/blkdev.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "blk_rq_set_block_pc(NULL)" "linux/blkdev.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
else else
echo "2" echo $cur_name "2" >> $config_file_path
fi fi
} }

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "deamonize(\"some_name\", NULL)" "linux/sched.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "deamonize(\"some_name\", NULL)" "linux/sched.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
else else
echo "2" echo $cur_name "2" >> $config_file_path
fi fi
} }

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "struct dentry dentry;dentry.d_u.d_alias" "linux/dcache.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct dentry dentry;dentry.d_u.d_alias" "linux/dcache.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "struct dentry dentry;dentry.d_alias" "linux/dcache.h" elif compile_module $cur_name "struct dentry dentry;dentry.d_alias" "linux/dcache.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "struct queue_limits q;q.discard_zeroes_data" "linux/blkdev.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct queue_limits q;q.discard_zeroes_data" "linux/blkdev.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
else else
echo "2" echo $cur_name "2" >> $config_file_path
fi fi
} }

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "REQ_PREFLUSH" "linux/blk_types.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "REQ_PREFLUSH" "linux/blk_types.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "REQ_FLUSH" "linux/blk_types.h" elif compile_module $cur_name "REQ_FLUSH" "linux/blk_types.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,23 +4,25 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "generic_start_io_acct(NULL, 0, 0, NULL)" "linux/bio.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "generic_start_io_acct(NULL, 0, 0, NULL)" "linux/bio.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "generic_start_io_acct(0, 0, NULL)" "linux/bio.h" elif compile_module $cur_name "generic_start_io_acct(0, 0, NULL)" "linux/bio.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
elif compile_module "part_round_stats(1, 1)" "linux/genhd.h" elif compile_module $cur_name "part_round_stats(1, 1)" "linux/genhd.h"
then then
echo "3" echo $cur_name "3" >> $config_file_path
elif compile_module "part_round_stats(NULL, 1, 1)" "linux/genhd.h" elif compile_module $cur_name "part_round_stats(NULL, 1, 1)" "linux/genhd.h"
then then
echo "4" echo $cur_name "4" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "global_zone_page_state(1)" "linux/mm.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "global_zone_page_state(1)" "linux/mm.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "global_page_state(1)" "linux/mm.h" elif compile_module $cur_name "global_page_state(1)" "linux/mm.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "struct hlist_node list" "linux/types.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct hlist_node list" "linux/types.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "struct list_head list" "linux/list.h" elif compile_module $cur_name "struct list_head list" "linux/list.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "struct file file;file.f_inode" "linux/fs.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct file file;file.f_inode" "linux/fs.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "struct file file;file->f_dentry->d_inode" "linux/fs.h" elif compile_module $cur_name "struct file file;file->f_dentry->d_inode" "linux/fs.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "vm_munmap(0, 0)" "linux/mm.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "vm_munmap(0, 0)" "linux/mm.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "do_munmap(NULL, 0)" "linux/mm.h" elif compile_module $cur_name "do_munmap(NULL, 0)" "linux/mm.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "blk_queue_bounce(NULL, NULL);" "linux/blkdev.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "blk_queue_bounce(NULL, NULL);" "linux/blkdev.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
else else
echo "2" echo $cur_name "2" >> $config_file_path
fi fi
} }

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "struct request_queue q;q.limits.chunk_sectors" "linux/blkdev.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct request_queue q;q.limits.chunk_sectors" "linux/blkdev.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
else else
echo "2" echo $cur_name "2" >> $config_file_path
fi fi
} }

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "blk_queue_flag_set(0, NULL)" "linux/blkdev.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "blk_queue_flag_set(0, NULL)" "linux/blkdev.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
else else
echo "2" echo $cur_name "2" >> $config_file_path
fi fi
} }

View File

@ -4,21 +4,23 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
# RHEL 7.3 # RHEL 7.3
check() { check() {
if compile_module "struct queue_limits q;q.limits_aux" "linux/blkdev.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct queue_limits q;q.limits_aux" "linux/blkdev.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "struct queue_limits q;q.max_write_zeroes_sectors" "linux/blkdev.h" elif compile_module $cur_name "struct queue_limits q;q.max_write_zeroes_sectors" "linux/blkdev.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
elif compile_module "struct queue_limits q;q.max_write_same_sectors" "linux/blkdev.h" elif compile_module $cur_name "struct queue_limits q;q.max_write_same_sectors" "linux/blkdev.h"
then then
echo "3" echo $cur_name "3" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "REQ_TYPE_FS" "linux/blkdev.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "REQ_TYPE_FS" "linux/blkdev.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
else else
echo "2" echo $cur_name "2" >> $config_file_path
fi fi
} }

View File

@ -4,7 +4,7 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
# submit_bio() can be defined in "bio.h" or in "fs.h" # submit_bio() can be defined in "bio.h" or in "fs.h"
# If it is defind in fs.h, three possibilities are available: # If it is defind in fs.h, three possibilities are available:
@ -12,20 +12,22 @@
# * it takes two arguments and returns non-void # * it takes two arguments and returns non-void
# * it takse two arguments and is void-type # * it takse two arguments and is void-type
check() { check() {
if compile_module "submit_bio(NULL)" "linux/bio.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "submit_bio(NULL)" "linux/bio.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "submit_bio(NULL)" "linux/fs.h" elif compile_module $cur_name "submit_bio(NULL)" "linux/fs.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
elif compile_module "void *t=submit_bio(0, NULL)" "linux/fs.h" elif compile_module $cur_name "void *t=submit_bio(0, NULL)" "linux/fs.h"
then then
echo "3" echo $cur_name "4" >> $config_file_path
elif compile_module "submit_bio(0, NULL)" "linux/fs.h" elif compile_module $cur_name "submit_bio(0, NULL)" "linux/fs.h"
then then
echo "4" echo $cur_name "4" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -1,26 +0,0 @@
#!/bin/bash
#
# Copyright(c) 2012-2019 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
check() {
if compile_module "struct bio b;b.bi_write_hint" "linux/bio.h"
then
echo "1"
else
echo "X"
fi
}
apply() {
case "$1" in
"1")
add_define "CAS_WLTH_SUPPORT \\
1" ;;
esac
}
conf_run $@

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "WRITE" "linux/blk_types.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "WRITE" "linux/blk_types.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "REQ_WRITE" "linux/blk_types.h" elif compile_module $cur_name "REQ_WRITE" "linux/blk_types.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,22 +4,24 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "WRITE_FUA" "linux/fs.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "WRITE_FUA" "linux/fs.h"
then then
if compile_module "BIO_FUA" "linux/bio.h" if compile_module $cur_name "BIO_FUA" "linux/bio.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
else else
echo "2" echo $cur_name "2" >> $config_file_path
fi fi
elif compile_module "REQ_FUA" "linux/blk_types.h" elif compile_module $cur_name "REQ_FUA" "linux/blk_types.h"
then then
echo "3" echo $cur_name "3" >> $config_file_path
else else
echo "4" echo $cur_name "4" >> $config_file_path
fi fi
} }

28
configure.d/1_wtlh.conf Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
#
# Copyright(c) 2012-2019 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. $(dirname $3)/conf_framework
check() {
cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "struct bio b;b.bi_write_hint" "linux/bio.h"
then
echo $cur_name "1" >> $config_file_path
fi
}
apply() {
case "$1" in
"1")
add_define "CAS_WLTH_SUPPORT \\
1" ;;
*)
exit 1
esac
}
conf_run $@

View File

@ -4,20 +4,22 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "RQF_SOFTBARRIER" "linux/blkdev.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "RQF_SOFTBARRIER" "linux/blkdev.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "REQ_SOFTBARRIER" "linux/blk_types.h" elif compile_module $cur_name "REQ_SOFTBARRIER" "linux/blk_types.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
elif compile_module "BIO_RW_BARRIER" "linux/fs.h" elif compile_module $cur_name "BIO_RW_BARRIER" "linux/fs.h"
then then
echo "3" echo $cur_name "3" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,22 +4,24 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "WRITE_FLUSH_FUA" "linux/fs.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "WRITE_FLUSH_FUA" "linux/fs.h"
then then
if compile_module "BIO_FUA" "linux/bio.h" if compile_module $cur_name "BIO_FUA" "linux/bio.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
else else
echo "2" echo $cur_name "2" >> $config_file_path
fi fi
elif compile_module "REQ_PREFLUSH" "linux/blk_types.h" elif compile_module $cur_name "REQ_PREFLUSH" "linux/blk_types.h"
then then
echo "3" echo $cur_name "3" >> $config_file_path
else else
echo "4" echo $cur_name "4" >> $config_file_path
fi fi
} }

View File

@ -4,14 +4,16 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "blk_make_request(NULL, NULL, 0)" "linux/blkdev.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "blk_make_request(NULL, NULL, 0)" "linux/blkdev.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
else else
echo "2" echo $cur_name "2" >> $config_file_path
fi fi
} }

View File

@ -4,17 +4,19 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "blk_queue_write_cache(NULL, 0, 0)" "linux/blkdev.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "blk_queue_write_cache(NULL, 0, 0)" "linux/blkdev.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
elif compile_module "struct request_queue rq;rq.flush_flags" "linux/blkdev.h" elif compile_module $cur_name "struct request_queue rq;rq.flush_flags" "linux/blkdev.h"
then then
echo "2" echo $cur_name "2" >> $config_file_path
else else
echo "X" echo $cur_name "X" >> $config_file_path
fi fi
} }

View File

@ -4,22 +4,24 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear # SPDX-License-Identifier: BSD-3-Clause-Clear
# #
. `dirname $0`/conf_framework . $(dirname $3)/conf_framework
check() { check() {
if compile_module "WRITE_FLUSH" "linux/fs.h" cur_name=$(basename $2)
config_file_path=$1
if compile_module $cur_name "WRITE_FLUSH" "linux/fs.h"
then then
if compile_module "BIO_FLUSH" "linux/bio.h" if compile_module $cur_name "BIO_FLUSH" "linux/bio.h"
then then
echo "1" echo $cur_name "1" >> $config_file_path
else else
echo "2" echo $cur_name "2" >> $config_file_path
fi fi
elif compile_module "REQ_PREFLUSH" "linux/blk_types.h" elif compile_module $cur_name "REQ_PREFLUSH" "linux/blk_types.h"
then then
echo "3" echo $cur_name "3" >> $config_file_path
else else
echo "4" echo $cur_name "4" >> $config_file_path
fi fi
} }

View File

@ -6,8 +6,6 @@
SCRIPTPATH=`dirname $0` SCRIPTPATH=`dirname $0`
SCRIPTPATH=`realpath $SCRIPTPATH` SCRIPTPATH=`realpath $SCRIPTPATH`
MODULE_FILE=$SCRIPTPATH/test_mod.c
OBJ_MOD=$SCRIPTPATH/test_mod.o
KERNEL_DIR="${KERNEL_DIR:-/lib/modules/$(uname -r)/build/}" KERNEL_DIR="${KERNEL_DIR:-/lib/modules/$(uname -r)/build/}"
KERNEL_VER="$(cd $KERNEL_DIR; make kernelversion)" KERNEL_VER="$(cd $KERNEL_DIR; make kernelversion)"
NPROC=`nproc` NPROC=`nproc`
@ -23,33 +21,40 @@ add_function() {
} }
compile_module(){ compile_module(){
if [ $# -gt 1 ] if [ $# -gt 2 ]
then then
INCLUDE="#include <$2>" INCLUDE="#include <$3>"
else else
INCLUDE="" INCLUDE=""
fi fi
config_file=$1
test_module_dir=$SCRIPTPATH/configure.d/${config_file}_dir
test_module_file=$test_module_dir/test_mod.c
test_module_obj=$test_module_dir/test_mod.o
mkdir -p $test_module_dir
cp -f $SCRIPTPATH/configure.d/Makefile $test_module_dir
############# TEST MODULE ############# ############# TEST MODULE #############
cat > $MODULE_FILE <<- EOF cat > $test_module_file <<- EOF
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
$INCLUDE $INCLUDE
int init_module(void) { int init_module(void) {
$1; $2;
return 0; return 0;
} }
void cleanup_module(void) {}; void cleanup_module(void) {};
EOF EOF
####################################### #######################################
make -C $SCRIPTPATH KERNEL_DIR=${KERNEL_DIR} &> /dev/null make -C $test_module_dir KERNEL_DIR=${KERNEL_DIR} &> /dev/null
local ret=$? local ret=$?
if [ $ret -eq 0 ]; then
make -C $SCRIPTPATH clean &> /dev/null rm -Rf $test_module_dir
fi
return $ret return $ret
} }
@ -60,9 +65,12 @@ kernel_not_supp_fail() {
exit 1 exit 1
} }
# $1 - name of function to be called
# $2 - path to file with valid configs
# $3 - name of processed template file
conf_run() { conf_run() {
case "$1" in case "$1" in
"check") check ;; "check") check $2 $3;;
"apply") apply $2 ;; "apply") apply $2 ;;
esac esac
} }