configure: Update generic_acct wrapper to kernel 5.8

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga 2020-12-11 20:10:24 +01:00
parent fb86060592
commit bbd0cb57a5
2 changed files with 114 additions and 82 deletions

View File

@ -9,18 +9,21 @@
check() { check() {
cur_name=$(basename $2) cur_name=$(basename $2)
config_file_path=$1 config_file_path=$1
if compile_module $cur_name "generic_start_io_acct(NULL, 0, 0, NULL)" "linux/bio.h" if compile_module $cur_name "bio_start_io_acct(NULL)" "linux/blkdev.h"
then then
echo $cur_name "1" >> $config_file_path echo $cur_name "1" >> $config_file_path
elif compile_module $cur_name "generic_start_io_acct(0, 0, NULL)" "linux/bio.h" elif compile_module $cur_name "generic_start_io_acct(NULL, 0, 0, NULL)" "linux/bio.h"
then then
echo $cur_name "2" >> $config_file_path echo $cur_name "2" >> $config_file_path
elif compile_module $cur_name "part_round_stats(1, 1)" "linux/genhd.h" elif compile_module $cur_name "generic_start_io_acct(0, 0, NULL)" "linux/bio.h"
then then
echo $cur_name "3" >> $config_file_path echo $cur_name "3" >> $config_file_path
elif compile_module $cur_name "part_round_stats(NULL, 1, 1)" "linux/genhd.h" elif compile_module $cur_name "part_round_stats(1, 1)" "linux/genhd.h"
then then
echo $cur_name "4" >> $config_file_path echo $cur_name "4" >> $config_file_path
elif compile_module $cur_name "part_round_stats(NULL, 1, 1)" "linux/genhd.h"
then
echo $cur_name "5" >> $config_file_path
else else
echo $cur_name "X" >> $config_file_path echo $cur_name "X" >> $config_file_path
fi fi
@ -30,45 +33,72 @@ apply() {
case "$1" in case "$1" in
"1") "1")
add_function " add_function "
static inline void cas_generic_start_io_acct(struct request_queue *q, static inline unsigned long long cas_generic_start_io_acct(
int rw, unsigned long sectors, struct hd_struct *part) { struct request_queue *q, struct bio *bio,
generic_start_io_acct(q, rw, sectors, part); struct hd_struct *part)
{
return bio_start_io_acct(bio);
}" }"
add_function " add_function "
static inline void cas_generic_end_io_acct(struct request_queue *q, static inline void cas_generic_end_io_acct(struct request_queue *q,
int rw, struct hd_struct *part, unsigned long start_time) struct bio *bio, struct hd_struct *part,
unsigned long start_time)
{ {
generic_end_io_acct(q, rw, part, start_time); bio_end_io_acct(bio, start_time);
}" ;; }" ;;
"2") "2")
add_function " add_function "
static inline void cas_generic_start_io_acct(struct request_queue *q, static inline unsigned long long cas_generic_start_io_acct(
int rw, unsigned long sectors, struct hd_struct *part) struct request_queue *q, struct bio *bio,
struct hd_struct *part)
{ {
generic_start_io_acct(rw, sectors, part); generic_start_io_acct(q, bio_data_dir(bio), bio_sectors(bio), part);
return jiffies;
}" }"
add_function " add_function "
static inline void cas_generic_end_io_acct(struct request_queue *q, static inline void cas_generic_end_io_acct(struct request_queue *q,
int rw, struct hd_struct *part, unsigned long start_time) struct bio *bio, struct hd_struct *part,
unsigned long start_time)
{ {
generic_end_io_acct(rw, part, start_time); generic_end_io_acct(q, bio_data_dir(bio), part, start_time);
}" ;; }" ;;
"3") "3")
add_function " add_function "
static inline void cas_generic_start_io_acct(struct request_queue *q, static inline unsigned long long cas_generic_start_io_acct(
int rw, unsigned long sectors, struct hd_struct *part) struct request_queue *q, struct bio *bio,
struct hd_struct *part)
{ {
int cpu = part_stat_lock(); generic_start_io_acct(bio_data_dir(bio), bio_sectors(bio), part);
part_round_stats(cpu, part); return jiffies;
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 " add_function "
static inline void cas_generic_end_io_acct(struct request_queue *q, static inline void cas_generic_end_io_acct(struct request_queue *q,
int rw, struct hd_struct *part, unsigned long start_time) struct bio *bio, struct hd_struct *part,
unsigned long start_time)
{ {
generic_end_io_acct(bio_data_dir(bio), part, start_time);
}" ;;
"4")
add_function "
static inline unsigned long long cas_generic_start_io_acct(
struct request_queue *q, struct bio *bio,
struct hd_struct *part)
{
int rw = bio_data_dir(bio);
int cpu = part_stat_lock();
part_round_stats(cpu, part);
part_stat_inc(cpu, part, ios[rw]);
part_stat_add(cpu, part, sectors[rw], bio_sectors(bio));
part_inc_in_flight(part, rw);
part_stat_unlock();
return jiffies;
}"
add_function "
static inline void cas_generic_end_io_acct(struct request_queue *q,
struct bio *bio, struct hd_struct *part,
unsigned long start_time)
{
int rw = bio_data_dir(bio);
unsigned long duration = jiffies - start_time; unsigned long duration = jiffies - start_time;
int cpu = part_stat_lock(); int cpu = part_stat_lock();
part_stat_add(cpu, part, ticks[rw], duration); part_stat_add(cpu, part, ticks[rw], duration);
@ -76,22 +106,27 @@ apply() {
part_dec_in_flight(part, rw); part_dec_in_flight(part, rw);
part_stat_unlock(); part_stat_unlock();
}" ;; }" ;;
"4") "5")
add_function " add_function "
static inline void cas_generic_start_io_acct(struct request_queue *q, static inline unsigned long long cas_generic_start_io_acct(
int rw, unsigned long sectors, struct hd_struct *part) struct request_queue *q, struct bio *bio,
struct hd_struct *part)
{ {
int rw = bio_data_dir(bio);
int cpu = part_stat_lock(); int cpu = part_stat_lock();
part_round_stats(NULL, cpu, part); part_round_stats(NULL, cpu, part);
part_stat_inc(cpu, part, ios[rw]); part_stat_inc(cpu, part, ios[rw]);
part_stat_add(cpu, part, sectors[rw], sectors); part_stat_add(cpu, part, sectors[rw], bio_sectors(bio));
part_inc_in_flight(NULL, part, rw); part_inc_in_flight(NULL, part, rw);
part_stat_unlock(); part_stat_unlock();
return jiffies;
}" }"
add_function " add_function "
static inline void cas_generic_end_io_acct(struct request_queue *q, static inline void cas_generic_end_io_acct(struct request_queue *q,
int rw, struct hd_struct *part, unsigned long start_time) struct bio *bio, struct hd_struct *part,
unsigned long start_time)
{ {
int rw = bio_data_dir(bio);
unsigned long duration = jiffies - start_time; unsigned long duration = jiffies - start_time;
int cpu = part_stat_lock(); int cpu = part_stat_lock();
part_stat_add(cpu, part, ticks[rw], duration); part_stat_add(cpu, part, ticks[rw], duration);

View File

@ -57,12 +57,11 @@ static void _blockdev_set_bio_data(struct blk_data *data, struct bio *bio)
#endif #endif
} }
static inline void _blockdev_start_io_acct(struct bio *bio) static inline unsigned long long _blockdev_start_io_acct(struct bio *bio)
{ {
struct gendisk *gd = CAS_BIO_GET_DEV(bio); struct gendisk *gd = CAS_BIO_GET_DEV(bio);
cas_generic_start_io_acct(gd->queue, bio_data_dir(bio), return cas_generic_start_io_acct(gd->queue, bio, &gd->part0);
bio_sectors(bio), &gd->part0);
} }
static inline void _blockdev_end_io_acct(struct bio *bio, static inline void _blockdev_end_io_acct(struct bio *bio,
@ -70,8 +69,7 @@ static inline void _blockdev_end_io_acct(struct bio *bio,
{ {
struct gendisk *gd = CAS_BIO_GET_DEV(bio); struct gendisk *gd = CAS_BIO_GET_DEV(bio);
cas_generic_end_io_acct(gd->queue, bio_data_dir(bio), cas_generic_end_io_acct(gd->queue, bio, &gd->part0, start_time);
&gd->part0, start_time);
} }
void block_dev_start_bio_fast(struct ocf_io *io) void block_dev_start_bio_fast(struct ocf_io *io)
@ -79,7 +77,7 @@ void block_dev_start_bio_fast(struct ocf_io *io)
struct blk_data *data = ocf_io_get_data(io); struct blk_data *data = ocf_io_get_data(io);
struct bio *bio = data->master_io_req; struct bio *bio = data->master_io_req;
_blockdev_start_io_acct(bio); data->start_time = _blockdev_start_io_acct(bio);
} }
void block_dev_complete_bio_fast(struct ocf_io *io, int error) void block_dev_complete_bio_fast(struct ocf_io *io, int error)
@ -761,7 +759,6 @@ static int _blockdev_make_request_fast(struct casdsk_disk *dsk,
_blockdev_set_bio_data(data, bio); _blockdev_set_bio_data(data, bio);
data->master_io_req = bio; data->master_io_req = bio;
data->start_time = jiffies;
io = ocf_core_new_io(core, cache_priv->io_queues[smp_processor_id()], io = ocf_core_new_io(core, cache_priv->io_queues[smp_processor_id()],
CAS_BIO_BISECTOR(bio) << SECTOR_SHIFT, CAS_BIO_BISECTOR(bio) << SECTOR_SHIFT,