/* Goal: Once we split the thing into several virtual filesystems, we will get rid of magical ranges (and this comment, BTW).  */
static unsigned int get_inode_number(void)
/* Goal: Once we split the thing into several virtual filesystems, we will get rid of magical ranges (and this comment, BTW).  */
static unsigned int get_inode_number(void)
{
	unsigned int i;
	int error;
retry:
	if (ida_pre_get(&proc_inum_ida, GFP_KERNEL) == 0)
		return 0;
	spin_lock(&proc_inum_lock);
	error = ida_get_new(&proc_inum_ida, &i);
	spin_unlock(&proc_inum_lock);
	if (error == -EAGAIN)
		goto retry;
	else if (error)
		return 0;
	if (i > UINT_MAX - PROC_DYNAMIC_FIRST) {
		spin_lock(&proc_inum_lock);
		ida_remove(&proc_inum_ida, i);
		spin_unlock(&proc_inum_lock);
		return 0;
	}
	return PROC_DYNAMIC_FIRST + i;
}