open-cas-linux/configure.d/1_generic_acct.conf
Michal Mielewczyk 9473cf9795 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>
2019-07-12 03:00:18 -04:00

108 lines
3.2 KiB
Bash

#!/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 "generic_start_io_acct(NULL, 0, 0, NULL)" "linux/bio.h"
then
echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "generic_start_io_acct(0, 0, NULL)" "linux/bio.h"
then
echo $cur_name "2" >> $config_file_path
elif compile_module $cur_name "part_round_stats(1, 1)" "linux/genhd.h"
then
echo $cur_name "3" >> $config_file_path
elif compile_module $cur_name "part_round_stats(NULL, 1, 1)" "linux/genhd.h"
then
echo $cur_name "4" >> $config_file_path
else
echo $cur_name "X" >> $config_file_path
fi
}
apply() {
case "$1" in
"1")
add_function "
static inline void cas_generic_start_io_acct(struct request_queue *q,
int rw, unsigned long sectors, struct hd_struct *part) {
generic_start_io_acct(q, rw, sectors, part);
}"
add_function "
static inline void cas_generic_end_io_acct(struct request_queue *q,
int rw, struct hd_struct *part, unsigned long start_time)
{
generic_end_io_acct(q, rw, part, start_time);
}" ;;
"2")
add_function "
static inline void cas_generic_start_io_acct(struct request_queue *q,
int rw, unsigned long sectors, struct hd_struct *part)
{
generic_start_io_acct(rw, sectors, part);
}"
add_function "
static inline void cas_generic_end_io_acct(struct request_queue *q,
int rw, struct hd_struct *part, unsigned long start_time)
{
generic_end_io_acct(rw, part, start_time);
}" ;;
"3")
add_function "
static inline void cas_generic_start_io_acct(struct request_queue *q,
int rw, unsigned long sectors, struct hd_struct *part)
{
int cpu = part_stat_lock();
part_round_stats(cpu, part);
part_stat_inc(cpu, part, ios[rw]);
part_stat_add(cpu, part, sectors[rw], sectors);
part_inc_in_flight(part, rw);
part_stat_unlock();
}"
add_function "
static inline void cas_generic_end_io_acct(struct request_queue *q,
int rw, struct hd_struct *part, unsigned long start_time)
{
unsigned long duration = jiffies - start_time;
int cpu = part_stat_lock();
part_stat_add(cpu, part, ticks[rw], duration);
part_round_stats(cpu, part);
part_dec_in_flight(part, rw);
part_stat_unlock();
}" ;;
"4")
add_function "
static inline void cas_generic_start_io_acct(struct request_queue *q,
int rw, unsigned long sectors, struct hd_struct *part)
{
int cpu = part_stat_lock();
part_round_stats(NULL, cpu, part);
part_stat_inc(cpu, part, ios[rw]);
part_stat_add(cpu, part, sectors[rw], sectors);
part_inc_in_flight(NULL, part, rw);
part_stat_unlock();
}"
add_function "
static inline void cas_generic_end_io_acct(struct request_queue *q,
int rw, struct hd_struct *part, unsigned long start_time)
{
unsigned long duration = jiffies - start_time;
int cpu = part_stat_lock();
part_stat_add(cpu, part, ticks[rw], duration);
part_round_stats(NULL, cpu, part);
part_dec_in_flight(NULL, part, rw);
part_stat_unlock();
}" ;;
*)
exit 1
esac
}
conf_run $@