@@ -17,6 +17,11 @@
*/
static struct kmem_cache *iocontext_cachep;
+static inline void free_io_context(struct io_context *ioc)
+{
+ kmem_cache_free(iocontext_cachep, ioc);
+}
+
/**
* get_io_context - increment reference count to io_context
* @ioc: io_context to get
@@ -129,7 +134,7 @@ static void ioc_release_fn(struct work_struct *work)
spin_unlock_irq(&ioc->lock);
- kmem_cache_free(iocontext_cachep, ioc);
+ free_io_context(ioc);
}
/**
@@ -164,7 +169,7 @@ void put_io_context(struct io_context *ioc)
}
if (free_ioc)
- kmem_cache_free(iocontext_cachep, ioc);
+ free_io_context(ioc);
}
/**
@@ -278,7 +283,7 @@ int create_task_io_context(struct task_struct *task, gfp_t gfp_flags, int node)
(task == current || !(task->flags & PF_EXITING)))
task->io_context = ioc;
else
- kmem_cache_free(iocontext_cachep, ioc);
+ free_io_context(ioc);
ret = task->io_context ? 0 : -EBUSY;
Prepare for putting bio poll queue into io_context, so add one helper for free io_context. Signed-off-by: Ming Lei <ming.lei@redhat.com> --- block/blk-ioc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)