summaryrefslogtreecommitdiff
path: root/block/blk-ioc.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-11-26 12:58:12 +0100
committerJens Axboe <axboe@kernel.dk>2021-11-29 06:41:29 -0700
commit50569c24be61eafb3efa06e2a3ccd447f75ae1b0 (patch)
treef62df93e17dfa8409aef6b77eddf9bf7f47d2183 /block/blk-ioc.c
parent222ee581b84582dc472d5395b77d7e0cb5268d1c (diff)
block: remove get_io_context_active
Fold it into it's only caller, and remove a lof of the debug checks that are not needed. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20211126115817.2087431-10-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-ioc.c')
-rw-r--r--block/blk-ioc.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/block/blk-ioc.c b/block/blk-ioc.c
index 3ba15c867dfa..cc4eb2ba87f7 100644
--- a/block/blk-ioc.c
+++ b/block/blk-ioc.c
@@ -173,7 +173,7 @@ EXPORT_SYMBOL_GPL(put_io_context);
* put_io_context_active - put active reference on ioc
* @ioc: ioc of interest
*
- * Undo get_io_context_active(). If active reference reaches zero after
+ * Put an active reference to an ioc. If active reference reaches zero after
* put, @ioc can never issue further IOs and ioscheds are notified.
*/
static void put_io_context_active(struct io_context *ioc)
@@ -333,11 +333,9 @@ int __copy_io(unsigned long clone_flags, struct task_struct *tsk)
* Share io context with parent, if CLONE_IO is set
*/
if (clone_flags & CLONE_IO) {
- get_io_context_active(ioc);
-
- WARN_ON_ONCE(atomic_read(&ioc->nr_tasks) <= 0);
+ atomic_long_inc(&ioc->refcount);
+ atomic_inc(&ioc->active_ref);
atomic_inc(&ioc->nr_tasks);
-
tsk->io_context = ioc;
} else if (ioprio_valid(ioc->ioprio)) {
new_ioc = get_task_io_context(tsk, GFP_KERNEL, NUMA_NO_NODE);