]> www.infradead.org Git - users/willy/linux.git/commit
blkcg: update blkg_lookup_create() to do locking
authorDennis Zhou <dennis@kernel.org>
Wed, 5 Dec 2018 17:10:27 +0000 (12:10 -0500)
committerJens Axboe <axboe@kernel.dk>
Wed, 5 Dec 2018 17:19:33 +0000 (10:19 -0700)
commit7241bdb167ed07751f11f7b3580c476c5b80a9ba
treea3c3db7d6adf7c7db37c0fa80c70574acbceaaee
parentab4c63c9be16f4dad7ad7c6a2221c3b0701476e9
blkcg: update blkg_lookup_create() to do locking

To know when to create a blkg, the general pattern is to do a
blkg_lookup() and if that fails, lock and do the lookup again, and if
that fails finally create. It doesn't make much sense for everyone who
wants to do creation to write this themselves.

This changes blkg_lookup_create() to do locking and implement this
pattern. The old blkg_lookup_create() is renamed to
__blkg_lookup_create().  If a call site wants to do its own error
handling or already owns the queue lock, they can use
__blkg_lookup_create(). This will be used in upcoming patches.

Signed-off-by: Dennis Zhou <dennis@kernel.org>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Acked-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Liu Bo <bo.liu@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-cgroup.c
block/blk-iolatency.c
include/linux/blk-cgroup.h