From f654129e94fa10afa44a8c188a879d7079b9eeed Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Fri, 26 Aug 2016 09:04:02 +0200 Subject: [PATCH] compat: disable aio when necessary --- kernel/mars.h | 5 ++++- kernel/mars_aio.c | 13 +++++++++++-- kernel/mars_aio.h | 1 + kernel/sy_old/sy_generic.c | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/kernel/mars.h b/kernel/mars.h index 8a395c21..5cf0d31b 100644 --- a/kernel/mars.h +++ b/kernel/mars.h @@ -381,8 +381,11 @@ extern const struct generic_brick_type *_bio_brick_type; extern const struct generic_brick_type *_aio_brick_type; extern const struct generic_brick_type *_sio_brick_type; -#ifndef CONFIG_MARS_PREFER_SIO +#if !defined(CONFIG_MARS_PREFER_SIO) && defined(HAS_MARS_PREPATCH) +#define ENABLE_MARS_AIO +#endif +#ifdef ENABLE_MARS_AIO /* Kludge: our kernel threads will have no mm context, but need one * for stuff like ioctx_alloc() / aio_setup_ring() etc * which expect userspace resources. diff --git a/kernel/mars_aio.c b/kernel/mars_aio.c index fcdeb732..85693f15 100644 --- a/kernel/mars_aio.c +++ b/kernel/mars_aio.c @@ -46,7 +46,7 @@ #define MARS_MAX_AIO 512 #define MARS_MAX_AIO_READ 32 -static struct timing_stats timings[3] = {}; +struct timing_stats timings[3] = {}; struct threshold aio_submit_threshold = { .thr_ban = &mars_global_ban, @@ -90,6 +90,8 @@ EXPORT_SYMBOL_GPL(aio_sync_mode); ////////////////// some helpers ////////////////// +#ifdef ENABLE_MARS_AIO + static inline void _enqueue(struct aio_threadinfo *tinfo, struct aio_mref_aspect *mref_a, int prio, bool at_end) { @@ -1068,7 +1070,7 @@ void aio_reset_statistics(struct aio_brick *brick) } } - +#endif /* ENABLE_MARS_AIO */ //////////////// object / aspect constructors / destructors /////////////// static int aio_mref_aspect_init_fn(struct generic_aspect *_ini) @@ -1089,6 +1091,7 @@ static void aio_mref_aspect_exit_fn(struct generic_aspect *_ini) MARS_MAKE_STATICS(aio); +#ifdef ENABLE_MARS_AIO ////////////////////// brick constructors / destructors //////////////////// static int aio_brick_construct(struct aio_brick *brick) @@ -1240,16 +1243,22 @@ static const struct aio_output_type *aio_output_types[] = { &aio_output_type, }; +#endif /* ENABLE_MARS_AIO */ + const struct aio_brick_type aio_brick_type = { .type_name = "aio_brick", .brick_size = sizeof(struct aio_brick), .max_inputs = 0, .max_outputs = 1, +#ifdef ENABLE_MARS_AIO .master_ops = &aio_brick_ops, .aspect_types = aio_aspect_types, .default_input_types = aio_input_types, .default_output_types = aio_output_types, .brick_construct = &aio_brick_construct, +#else /* ENABLE_MARS_AIO */ + .aspect_types = aio_aspect_types, /* dummy, shut up gcc */ +#endif /* ENABLE_MARS_AIO */ }; EXPORT_SYMBOL_GPL(aio_brick_type); diff --git a/kernel/mars_aio.h b/kernel/mars_aio.h index 29872282..fa467e12 100644 --- a/kernel/mars_aio.h +++ b/kernel/mars_aio.h @@ -27,6 +27,7 @@ #include #include +#include "mars.h" #include "lib_mapfree.h" #define AIO_SUBMIT_MAX_LATENCY 1000 // 1 ms diff --git a/kernel/sy_old/sy_generic.c b/kernel/sy_old/sy_generic.c index 99312c82..66bdeb27 100644 --- a/kernel/sy_old/sy_generic.c +++ b/kernel/sy_old/sy_generic.c @@ -1925,7 +1925,7 @@ struct mars_brick *make_brick_all( MARS_DBG("substitute bio by aio\n"); } } -#ifdef CONFIG_MARS_PREFER_SIO +#ifndef ENABLE_MARS_AIO if (!brick && new_brick_type == _aio_brick_type && _sio_brick_type) { new_brick_type = _sio_brick_type; MARS_DBG("substitute aio by sio\n");