/* Lightweight file lookup - no refcnt increment if fd table isn't shared. You can use this only if it is guranteed that the current task already holds a refcnt to that file. That check has to be done at fget() only and a flag is returned to be passed to the corresponding fput_light(). There must not be a cloning between an fget_light/fput_light pair.  */
struct file* fget_light(unsigned int fd, int *fput_needed)
/* Lightweight file lookup - no refcnt increment if fd table isn't shared. You can use this only if it is guranteed that the current task already holds a refcnt to that file. That check has to be done at fget() only and a flag is returned to be passed to the corresponding fput_light(). There must not be a cloning between an fget_light/fput_light pair.  */
struct file* fget_light(unsigned int fd, int *fput_needed)
{
	struct file *file;
	struct files_struct *files = current->files;
	*fput_needed = 0;
	if (likely((atomic_read(&files->count) == 1))) {
		file = fcheck_files(files, fd);
	} else {
		rcu_read_lock();
		file = fcheck_files(files, fd);
		if (file) {
			if (atomic_long_inc_not_zero(&file->f_count))
				*fput_needed = 1;
			else
				file = NULL;
		}
		rcu_read_unlock();
	}
	return file;
}