mirror of https://github.com/schoebel/mars
compat: disable aio when necessary
This commit is contained in:
parent
0c714a8bfc
commit
f654129e94
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <linux/aio.h>
|
||||
#include <linux/syscalls.h>
|
||||
|
||||
#include "mars.h"
|
||||
#include "lib_mapfree.h"
|
||||
|
||||
#define AIO_SUBMIT_MAX_LATENCY 1000 // 1 ms
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue