]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
blkcg: replace blkcg_policy->pd_size with ->pd_alloc/free_fn() methods
authorTejun Heo <tj@kernel.org>
Tue, 18 Aug 2015 21:55:11 +0000 (14:55 -0700)
committerJens Axboe <axboe@fb.com>
Tue, 18 Aug 2015 22:49:16 +0000 (15:49 -0700)
commit001bea73e70efdf48a9e00188cf302f6b6aed2bf
tree73797e7ac03b5e3e4fd9a3dc90c43f89b1ed57e0
parent3e41871046bfe0ba7d122a1f14f0c1db2dca0256
blkcg: replace blkcg_policy->pd_size with ->pd_alloc/free_fn() methods

A blkg (blkcg_gq) represents the relationship between a cgroup and
request_queue.  Each active policy has a pd (blkg_policy_data) on each
blkg.  The pd's were allocated by blkcg core and each policy could
request to allocate extra space at the end by setting
blkcg_policy->pd_size larger than the size of pd.

This is a bit unusual but was done this way mostly to simplify error
handling and all the existing use cases could be handled this way;
however, this is becoming too restrictive now that percpu memory can
be allocated without blocking.

This introduces two new mandatory blkcg_policy methods - pd_alloc_fn()
and pd_free_fn() - which are used to allocate and release pd for a
given policy.  As pd allocation is now done from policy side, it can
simply allocate a larger area which embeds pd at the beginning.  This
change makes ->pd_size pointless.  Removed.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-cgroup.c
block/blk-throttle.c
block/cfq-iosched.c
include/linux/blk-cgroup.h