• T
    blkcg: let blkcg core handle policy private data allocation · 0381411e
    Tejun Heo 提交于
    Currently, blkg's are embedded in private data blkcg policy private
    data structure and thus allocated and freed by policies.  This leads
    to duplicate codes in policies, hinders implementing common part in
    blkcg core with strong semantics, and forces duplicate blkg's for the
    same cgroup-q association.
    
    This patch introduces struct blkg_policy_data which is a separate data
    structure chained from blkg.  Policies specifies the amount of private
    data it needs in its blkio_policy_type->pdata_size and blkcg core
    takes care of allocating them along with blkg which can be accessed
    using blkg_to_pdata().  blkg can be determined from pdata using
    pdata_to_blkg().  blkio_alloc_group_fn() method is accordingly updated
    to blkio_init_group_fn().
    
    For consistency, tg_of_blkg() and cfqg_of_blkg() are replaced with
    blkg_to_tg() and blkg_to_cfqg() respectively, and functions to map in
    the reverse direction are added.
    
    Except that policy specific data now lives in a separate data
    structure from blkg, this patch doesn't introduce any functional
    difference.
    
    This will be used to unify blkg's for different policies.
    Signed-off-by: NTejun Heo <tj@kernel.org>
    Cc: Vivek Goyal <vgoyal@redhat.com>
    Signed-off-by: NJens Axboe <axboe@kernel.dk>
    0381411e
blk-throttle.c 30.8 KB