/* Only the l_start, l_len and l_whence fields of the 'struct space_resv' are used here, rest are ignored.  */
int ioctl_preallocate(struct file *filp, void __user *argp)
/* Only the l_start, l_len and l_whence fields of the 'struct space_resv' are used here, rest are ignored.  */
int ioctl_preallocate(struct file *filp, void __user *argp)
{
	struct inode *inode = filp->f_path.dentry->d_inode;
	struct space_resv sr;
	if (copy_from_user(&sr, argp, sizeof(sr)))
		return -EFAULT;
	switch (sr.l_whence) {
	case SEEK_SET:
		break;
	case SEEK_CUR:
		sr.l_start += filp->f_pos;
		break;
	case SEEK_END:
		sr.l_start += i_size_read(inode);
		break;
	default:
		return -EINVAL;
	}
	return do_fallocate(filp, FALLOC_FL_KEEP_SIZE, sr.l_start, sr.l_len);
}