Re: [PATCH 2/2] blk-ioprio: remove per-disk structure

From: Christoph Hellwig
Date: Fri Jul 12 2024 - 01:27:24 EST


On Fri, Jul 12, 2024 at 09:10:30AM +0800, Yu Kuai wrote:
> > As one can see in the output of git grep -nHEB1 '>pd_(alloc|free)_fn\(',
> > none of the pd_alloc_fn / pd_free_fn callers checks whether or not these
> > pointers are NULL. Hence my question why this patch does not trigger any
> > NULL pointer dereferences?
>
> Because the blkcg_deactivate_policy() is removed as well, there are no
> callers now... blkcg_policy_register() is still called to make sure
> cpd_(alloc|free)_fn will still be called.

Can you throw in a patch documenting this? Any maybe add a check
that pd_alloc_fn / pd_free_fn exist in blkcg_activate_policy and
WARN and return an error otherwise?