blkcg: convert blkg_lookup_create to find closest blkg
authorDennis Zhou (Facebook) <dennisszhou@gmail.com>
Tue, 11 Sep 2018 18:41:28 +0000 (14:41 -0400)
committerJens Axboe <axboe@kernel.dk>
Sat, 22 Sep 2018 02:29:05 +0000 (20:29 -0600)
commit07b05bcc3213ac9f8c28c9d835b4bf3d5798cc60
treeefab6cd44e334f64c1a98ae1b57a6894d9130c23
parent49f4c2dc2b5066e9211101c59cc0828e81d41614
blkcg: convert blkg_lookup_create to find closest blkg

There are several scenarios where blkg_lookup_create can fail. Examples
include the blkcg dying, request_queue is dying, or simply being OOM. At
the end of the day, most handle this by simply falling back to the
q->root_blkg and calling it a day.

This patch implements the notion of closest blkg. During
blkg_lookup_create, if it fails to create, return the closest blkg
found or the q->root_blkg. blkg_try_get_closest is introduced and used
during association so a bio is always attached to a blkg.

Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Dennis Zhou <dennisszhou@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bio.c
block/blk-cgroup.c
include/linux/blk-cgroup.h