/* File creation. Allocate an inode, and we're done..  */
static int hugetlbfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
/* File creation. Allocate an inode, and we're done..  */
static int hugetlbfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
{
	struct inode *inode;
	int error = -ENOSPC;
	gid_t gid;
	if (dir->i_mode & S_ISGID) {
		gid = dir->i_gid;
		if (S_ISDIR(mode))
			mode |= S_ISGID;
	} else {
		gid = current_fsgid();
	}
	inode = hugetlbfs_get_inode(dir->i_sb, current_fsuid(), gid, mode, dev);
	if (inode) {
		dir->i_ctime = dir->i_mtime = CURRENT_TIME;
		d_instantiate(dentry, inode);
		dget(dentry);
		error = 0;
	}
	return error;
}