mirror of
https://github.com/schoebel/mars
synced 2025-02-21 14:56:55 +00:00
compat: adapt to RHEL 7
This commit is contained in:
parent
39e84726aa
commit
534e2ce7db
@ -24,6 +24,7 @@
|
||||
#ifndef _MARS_COMPAT
|
||||
#define _MARS_COMPAT
|
||||
|
||||
#include <generated/uapi/linux/version.h>
|
||||
#include <linux/major.h>
|
||||
|
||||
/* Detect 5c0ba4e0762e6dabd14a5c276652e2defec38de7
|
||||
@ -136,11 +137,6 @@ extern int _compat_unlink(
|
||||
#define MARS_HAS_SET_DEV
|
||||
#endif
|
||||
|
||||
/* adapt to 4e1b2d52a80d79296a5d899d73249748dea71a53 and many others */
|
||||
#ifdef bio_op
|
||||
#define MARS_HAS_NEW_BIO_OP
|
||||
#endif
|
||||
|
||||
#ifdef bio_end_sector
|
||||
#define MARS_HAS_VOID_RELEASE
|
||||
#endif
|
||||
@ -311,4 +307,16 @@ extern int _compat_unlink(
|
||||
#define WRITE_ONCE(dst,src) ACCESS_ONCE(dst) = (src)
|
||||
#endif
|
||||
|
||||
|
||||
/* specialized compat for RHEL / CentOS / etc */
|
||||
|
||||
#ifdef RHEL_MAJOR
|
||||
|
||||
#if RHEL_MAJOR <= 7
|
||||
#undef MARS_HAS_NEW_BIO_OP
|
||||
#define MARS_HAS_PART_STATS_QUEUE
|
||||
#endif
|
||||
|
||||
#endif /* RHEL_MAJOR */
|
||||
|
||||
#endif /* _MARS_COMPAT */
|
||||
|
@ -152,7 +152,11 @@ void _if_start_io_acct(struct if_input *input, struct bio_wrapper *biow)
|
||||
const int cpu = part_stat_lock();
|
||||
|
||||
(void)cpu;
|
||||
#ifdef MARS_HAS_PART_STATS_QUEUE
|
||||
part_round_stats(input->q, cpu, &input->disk->part0);
|
||||
#else
|
||||
part_round_stats(cpu, &input->disk->part0);
|
||||
#endif
|
||||
part_stat_inc(cpu, &input->disk->part0, ios[rw]);
|
||||
// remove_this
|
||||
#ifdef MARS_HAS_BVEC_ITER
|
||||
@ -163,7 +167,11 @@ void _if_start_io_acct(struct if_input *input, struct bio_wrapper *biow)
|
||||
part_stat_add(cpu, &input->disk->part0, sectors[rw], bio->bi_size >> 9);
|
||||
#endif
|
||||
// end_remove_this
|
||||
#ifdef MARS_HAS_PART_STATS_QUEUE
|
||||
part_inc_in_flight(input->q, &input->disk->part0, rw);
|
||||
#else
|
||||
part_inc_in_flight(&input->disk->part0, rw);
|
||||
#endif
|
||||
part_stat_unlock();
|
||||
biow->start_time = jiffies;
|
||||
}
|
||||
@ -177,8 +185,13 @@ void _if_end_io_acct(struct if_input *input, struct bio_wrapper *biow)
|
||||
const int cpu = part_stat_lock();
|
||||
(void)cpu;
|
||||
part_stat_add(cpu, &input->disk->part0, ticks[rw], duration);
|
||||
#ifdef MARS_HAS_PART_STATS_QUEUE
|
||||
part_round_stats(input->q, cpu, &input->disk->part0);
|
||||
part_dec_in_flight(input->q, &input->disk->part0, rw);
|
||||
#else
|
||||
part_round_stats(cpu, &input->disk->part0);
|
||||
part_dec_in_flight(&input->disk->part0, rw);
|
||||
#endif
|
||||
part_stat_unlock();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user