On Mon, Mar 17, 2025 at 10:29:24AM +0800, Chen Linxuan <chenlinxuan@xxxxxxxxxxxxx> wrote: > This patch improve the returned error code of blkcg_policy_register(). > > 1. Move the validation check for cpd/pd_alloc_fn and cpd/pd_free_fn > function pairs to the start of blkcg_policy_register(). This ensures > we immediately return -EINVAL if the function pairs are not correctly > provided, rather than returning -ENOSPC after locking and unlocking > mutexes unnecessarily. > > Those locks should not contention any problems, as error of policy > registration is a super cold path. > > 2. Return -ENOMEM when cpd_alloc_fn() failed. > > Co-authored-by: Wen Tao <wentao@xxxxxxxxxxxxx> > Signed-off-by: Wen Tao <wentao@xxxxxxxxxxxxx> > Signed-off-by: Chen Linxuan <chenlinxuan@xxxxxxxxxxxxx> > --- > block/blk-cgroup.c | 22 ++++++++++++---------- > 1 file changed, 12 insertions(+), 10 deletions(-) Reviewed-by: Michal Koutný <mkoutny@xxxxxxxx>
Attachment:
signature.asc
Description: PGP signature