c
// Increment reference count when scheduling work
atomic_inc(&io_data->refcount);

// Decrement reference count and free if zero in the worker function
if (atomic_dec_and_test(&io_data->refcount)) {
    kfree(io_data->kiocb);
    kfree(io_data);
}
