Re: [PATCH 2/2] fs: Remove kiocb->ki_complete

Jens Axboe
2020-07-09T03:25:08Z

On 7/8/20 4:26 PM, Matthew Wilcox (Oracle) wrote:
> +void unregister_kiocb_completion(int id)
> +{
> + ki_cmpls[id - 1] = NULL;
> +}
> +EXPORT_SYMBOL(unregister_kiocb_completion);

This should have a limit check (<= 0 || > max).

> void complete_kiocb(struct kiocb *iocb, long ret, long ret2)
> {
> - iocb->ki_complete(iocb, ret, ret2);
> + unsigned int id = kiocb_completion_id(iocb);
> +
> + if (id > 0)
> + ki_cmpls[id - 1](iocb, ret, ret2);
> }

I'd make id == 0 be a dummy funciton to avoid this branch.

--
Jens Axboe