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

Jens Axboe
2020-07-08T22:39:36Z

On 7/8/20 4:26 PM, Matthew Wilcox (Oracle) wrote:
> @@ -341,12 +343,25 @@ struct kiocb {
> randomized_struct_fields_end
> };
>
> +static inline int kiocb_completion_id(struct kiocb *kiocb)
> +{
> + return kiocb->ki_flags >> _IOCB_COMPLETION_SHIFT;
> +}
> +
> +static inline void kiocb_set_completion(struct kiocb *kiocb, int id)
> +{
> + kiocb->ki_flags = (kiocb->ki_flags & (~IOCB_COMPLETION_FNS)) |
> + (id << _IOCB_COMPLETION_SHIFT);
> +}
> +
> static inline bool is_sync_kiocb(struct kiocb *kiocb)
> {
> - return kiocb->ki_complete == NULL;
> + return kiocb_completion_id(kiocb) == 0;
> }
>
> void complete_kiocb(struct kiocb *kiocb, long ret, long ret2);
> +int register_kiocb_completion(void (*)(struct kiocb *, long, long));
> +void unregister_kiocb_completion(int id);

Same here, you seem to mix and match whether you prefix with kiocb or
not. Why not make them all kiocb_*?

kiocb_register_completion() and so forth.

--
Jens Axboe