static int io_sqe_files_unregister(struct io_ring_ctx *ctx)
{
	struct fixed_file_data *data = ctx->file_data;
	unsigned nr_tables, i;

	if (!data)
		return -ENXIO;

	percpu_ref_kill_and_confirm(&data->refs, io_file_ref_kill);
	flush_work(&data->ref_work);
	wait_for_completion(&data->done);
	io_ring_file_ref_flush(data);
	percpu_ref_exit(&data->refs);

	__io_sqe_files_unregister(ctx);
	nr_tables = DIV_ROUND_UP(ctx->nr_user_files, IORING_MAX_FILES_TABLE);
	for (i = 0; i < nr_tables; i++)
		kfree(data->table[i].files);
	kfree(data->table);
	kfree(data);
	ctx->file_data = NULL;
	ctx->nr_user_files = 0;
	return 0;
}
static int io_sqe_files_unregister(struct io_ring_ctx *ctx)
{
	struct fixed_file_data *data = ctx->file_data;
	unsigned nr_tables, i;

	if (!data)
		return -ENXIO;

	percpu_ref_kill_and_confirm(&data->refs, io_file_ref_kill);
	flush_work(&data->ref_work);
	wait_for_completion(&data->done);
	io_ring_file_ref_flush(data);
	percpu_ref_exit(&data->refs);

	__io_sqe_files_unregister(ctx);
	nr_tables = DIV_ROUND_UP(ctx->nr_user_files, IORING_MAX_FILES_TABLE);
	for (i = 0; i < nr_tables; i++)
		kfree(data->table[i].files);
	kfree(data->table);
	kfree(data);
	ctx->file_data = NULL;
	ctx->nr_user_files = 0;
	return 0;
}