mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
scst: Disable I/O context sharing for kernel v4.21 and later kernels (merge r7855 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.3.x@7885 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include <linux/bsg-lib.h> /* struct bsg_job */
|
||||
#endif
|
||||
#include <linux/eventpoll.h>
|
||||
#include <linux/iocontext.h>
|
||||
#include <linux/scatterlist.h> /* struct scatterlist */
|
||||
#include <linux/slab.h> /* kmalloc() */
|
||||
#include <linux/stddef.h> /* sizeof_field() */
|
||||
@@ -405,6 +406,39 @@ static inline ssize_t call_write_iter(struct file *file, struct kiocb *kio,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* <linux/iocontext.h> */
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) || \
|
||||
LINUX_VERSION_CODE >= KERNEL_VERSION(4, 21, 0)
|
||||
|
||||
static inline struct io_context *
|
||||
scst_get_task_io_context(struct task_struct *task,
|
||||
gfp_t gfp_flags, int node)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void scst_put_io_context(struct io_context *ioc)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void scst_ioc_task_link(struct io_context *ioc)
|
||||
{
|
||||
}
|
||||
|
||||
#define get_task_io_context scst_get_task_io_context
|
||||
#define put_io_context scst_put_io_context
|
||||
#define ioc_task_link scst_ioc_task_link
|
||||
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) && \
|
||||
LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
|
||||
static inline struct io_context *get_task_io_context(struct task_struct *task,
|
||||
gfp_t gfp_flags, int node)
|
||||
{
|
||||
WARN_ON_ONCE(task != current);
|
||||
return get_io_context(gfp_flags, node);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* <linux/kernel.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
|
||||
|
||||
@@ -5012,13 +5012,7 @@ static int scst_ioc_keeper_thread(void *arg)
|
||||
|
||||
sBUG_ON(aic_keeper->aic != NULL);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
|
||||
aic_keeper->aic = get_task_io_context(current, GFP_KERNEL, NUMA_NO_NODE);
|
||||
#else
|
||||
aic_keeper->aic = get_io_context(GFP_KERNEL, -1);
|
||||
#endif
|
||||
#endif
|
||||
TRACE_DBG("Alloced new async IO context %p (aic %p)",
|
||||
aic_keeper->aic, aic_keeper);
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ struct scst_cmd_thread_t {
|
||||
};
|
||||
|
||||
static inline bool scst_set_io_context(struct scst_cmd *cmd,
|
||||
struct io_context **old)
|
||||
struct io_context **old)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
|
||||
return false;
|
||||
@@ -253,7 +253,8 @@ static inline bool scst_set_io_context(struct scst_cmd *cmd,
|
||||
|
||||
EXTRACHECKS_BUG_ON(old == NULL);
|
||||
|
||||
if (cmd->cmd_threads == &scst_main_cmd_threads) {
|
||||
if (cmd->cmd_threads == &scst_main_cmd_threads &&
|
||||
cmd->tgt_dev->async_io_context) {
|
||||
EXTRACHECKS_BUG_ON(in_interrupt());
|
||||
/*
|
||||
* No need for any ref counting action, because io_context
|
||||
@@ -265,8 +266,9 @@ static inline bool scst_set_io_context(struct scst_cmd *cmd,
|
||||
TRACE_DBG("io_context %p (tgt_dev %p)", current->io_context,
|
||||
cmd->tgt_dev);
|
||||
EXTRACHECKS_BUG_ON(current->io_context == NULL);
|
||||
} else
|
||||
} else {
|
||||
res = false;
|
||||
}
|
||||
|
||||
return res;
|
||||
#endif
|
||||
|
||||
@@ -5344,12 +5344,8 @@ static void scst_ioctx_get(struct scst_cmd_threads *p_cmd_threads)
|
||||
* io_context 0.
|
||||
*/
|
||||
if (p_cmd_threads->io_context == NULL) {
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
|
||||
p_cmd_threads->io_context = get_task_io_context(current,
|
||||
GFP_KERNEL, NUMA_NO_NODE);
|
||||
#else
|
||||
p_cmd_threads->io_context = get_io_context(GFP_KERNEL, -1);
|
||||
#endif
|
||||
TRACE_DBG("Alloced new IO context %p "
|
||||
"(p_cmd_threads %p)", p_cmd_threads->io_context,
|
||||
p_cmd_threads);
|
||||
|
||||
Reference in New Issue
Block a user