aio: v3 obey CONFIG_MARS_CANNOT_USE_AIO_ANYMORE

This commit is contained in:
Thomas Schoebel-Theuer 2022-10-18 18:48:42 +02:00 committed by Thomas Schoebel-Theuer
parent 122c0bba8b
commit bbf1255007
4 changed files with 30 additions and 3 deletions

View File

@ -473,6 +473,10 @@ extern const struct generic_brick_type *_qio_brick_type;
extern const struct generic_brick_type *_aio_brick_type;
extern const struct generic_brick_type *_sio_brick_type;
#if defined(CONFIG_MARS_CANNOT_USE_AIO_ANYMORE) /* starting with kernel v5.10 */
#define ENABLE_MARS_QIO
#else /* !defined(CONFIG_MARS_CANNOT_USE_AIO_ANYMORE) */
/* QIO may only work for kernels 5.1 <= $to_check <= 5.9 but Frankensteins are unknown */
#if defined(IOCB_NOWAIT) && \
/* see dde0c2e79848298cc25621ad080d47f94dbd7cce */ \
defined(IOCB_DSYNC) && \
@ -481,15 +485,16 @@ extern const struct generic_brick_type *_sio_brick_type;
!defined(CONFIG_MARS_PREFER_SIO) && \
1
#define ENABLE_MARS_QIO
#else
#else /* check whether AIO can be used in addition at kernels < v5.10 */
#if !defined(CONFIG_MARS_PREFER_SIO) && \
(defined(MARS_HAS_PREPATCH) || \
defined(MARS_HAS_PREPATCH_V2) || \
defined(MARS_HAS_PREPATCH_V3a) || \
1)
0) /* When there is no prepatch, AIO cannot work anymore */
#define ENABLE_MARS_AIO
#endif
#endif
#endif /* !CONFIG_MARS_CANNOT_USE_AIO_ANYMORE */
#if defined(ENABLE_MARS_QIO)
# define any_io_brick_type qio_brick_type

View File

@ -23,13 +23,14 @@
/* HISTORIC - please avoid this ASAP
*/
#include <linux/module.h>
#if !defined(CONFIG_MARS_CANNOT_USE_AIO_ANYMORE)
//#define BRICK_DEBUGGING
#define MARS_DEBUGGING
//#define IO_DEBUGGING
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/string.h>
#include <linux/list.h>
@ -1438,3 +1439,17 @@ void exit_mars_aio(void)
MARS_DBG("exit_aio()\n");
aio_unregister_brick_type();
}
#else /* !CONFIG_MARS_CANNOT_USE_AIO_ANYMORE */
int __init init_mars_aio(void)
{
/* empty */
return 0;
}
void exit_mars_aio(void)
{
}
#endif /* !CONFIG_MARS_CANNOT_USE_AIO_ANYMORE */

View File

@ -25,6 +25,8 @@
*/
#ifndef MARS_AIO_H
#define MARS_AIO_H
#include <linux/module.h>
#if !defined(CONFIG_MARS_CANNOT_USE_AIO_ANYMORE)
#include <linux/aio.h>
#include <linux/syscalls.h>
@ -124,4 +126,5 @@ struct aio_output {
MARS_TYPES(aio);
#endif /* !CONFIG_MARS_CANNOT_USE_AIO_ANYMORE */
#endif

View File

@ -533,10 +533,12 @@ struct ctl_table io_tuning_table[] = {
THRESHOLD_ENTRIES(&bio_submit_threshold, "bio_submit"),
THRESHOLD_ENTRIES(&bio_io_threshold[0], "bio_io_r"),
THRESHOLD_ENTRIES(&bio_io_threshold[1], "bio_io_w"),
#if !defined(CONFIG_MARS_CANNOT_USE_AIO_ANYMORE)
THRESHOLD_ENTRIES(&aio_submit_threshold, "aio_submit"),
THRESHOLD_ENTRIES(&aio_io_threshold[0], "aio_io_r"),
THRESHOLD_ENTRIES(&aio_io_threshold[1], "aio_io_w"),
THRESHOLD_ENTRIES(&aio_sync_threshold, "aio_sync"),
#endif /* !CONFIG_MARS_CANNOT_USE_AIO_ANYMORE */
INT_ENTRY("if_nr_requests", if_nr_requests, 0600),
#if defined(MARS_HAS_BIO_IO_ACCT) || defined(MARS_HAS_GENERIC_BLK_ACCOUNTING)
INT_ENTRY("if_io_acct", mars_io_acct, 0600),
@ -620,7 +622,9 @@ struct ctl_table mars_table[] = {
INT_ENTRY("show_statistics_server", server_show_statist, 0600),
INT_ENTRY("show_connections", global_show_connections, 0600),
#endif
#if !defined(CONFIG_MARS_CANNOT_USE_AIO_ANYMORE)
INT_ENTRY("aio_sync_mode", aio_sync_mode, 0600),
#endif /* !CONFIG_MARS_CANNOT_USE_AIO_ANYMORE */
#ifdef CONFIG_MARS_DEBUG
INT_ENTRY("debug_crash_mode", mars_crash_mode, 0600),
INT_ENTRY("debug_hang_mode", mars_hang_mode, 0600),