/* Allocates a new configfs_dirent and links it to the parent configfs_dirent  */
static struct configfs_dirent* configfs_new_dirent(struct configfs_dirent *parent_sd, void *element, int type)
/* Allocates a new configfs_dirent and links it to the parent configfs_dirent  */
static struct configfs_dirent* configfs_new_dirent(struct configfs_dirent *parent_sd, void *element, int type)
{
	struct configfs_dirent * sd;
	sd = kmem_cache_zalloc(configfs_dir_cachep, GFP_KERNEL);
	if (!sd)
		return ERR_PTR(-ENOMEM);
	atomic_set(&sd->s_count, 1);
	INIT_LIST_HEAD(&sd->s_links);
	INIT_LIST_HEAD(&sd->s_children);
	sd->s_element = element;
	sd->s_type = type;
	configfs_init_dirent_depth(sd);
	spin_lock(&configfs_dirent_lock);
	if (parent_sd->s_type & CONFIGFS_USET_DROPPING) {
		spin_unlock(&configfs_dirent_lock);
		kmem_cache_free(configfs_dir_cachep, sd);
		return ERR_PTR(-ENOENT);
	}
	list_add(&sd->s_sibling, &parent_sd->s_children);
	spin_unlock(&configfs_dirent_lock);
	return sd;
}