diff options
author | Christoph Hellwig <hch@lst.de> | 2021-12-09 07:31:22 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-12-16 10:59:01 -0700 |
commit | 0aed2f162bbc7853fe91c0d70492ea73c4e9cb07 (patch) | |
tree | 6e3e60626ffaabf7d6a6c99e4301764709c38637 /block | |
parent | 8a2ba1785c5803d59a63b6320ff54fd4a37a41ce (diff) | |
download | linux-0aed2f162bbc7853fe91c0d70492ea73c4e9cb07.tar.bz2 |
block: simplify struct io_context refcounting
Don't hold a reference to ->refcount for each active reference, but
just one for all active references.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20211209063131.18537-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-ioc.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/block/blk-ioc.c b/block/blk-ioc.c index 96336c2134ef..9cde3906be3c 100644 --- a/block/blk-ioc.c +++ b/block/blk-ioc.c @@ -180,10 +180,8 @@ static void put_io_context_active(struct io_context *ioc) { struct io_cq *icq; - if (!atomic_dec_and_test(&ioc->active_ref)) { - put_io_context(ioc); + if (!atomic_dec_and_test(&ioc->active_ref)) return; - } spin_lock_irq(&ioc->lock); hlist_for_each_entry(icq, &ioc->icq_list, ioc_node) { @@ -335,7 +333,6 @@ 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) { - atomic_long_inc(&ioc->refcount); atomic_inc(&ioc->active_ref); tsk->io_context = ioc; } else if (ioprio_valid(ioc->ioprio)) { |