return ret;
 }
 
-static int btrfs_add_nondir(struct btrfs_trans_handle *trans,
-                           struct btrfs_inode *dir, struct dentry *dentry,
-                           struct btrfs_inode *inode, int backref, u64 index)
-{
-       int err = btrfs_add_link(trans, dir, inode,
-                                dentry->d_name.name, dentry->d_name.len,
-                                backref, index);
-       if (err > 0)
-               err = -EEXIST;
-       return err;
-}
-
 static int btrfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
                       struct dentry *dentry, umode_t mode, dev_t rdev)
 {
        if (err)
                goto out_unlock;
 
-       err = btrfs_add_nondir(trans, BTRFS_I(dir), dentry, BTRFS_I(inode),
-                       0, index);
+       err = btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode),
+                            dentry->d_name.name, dentry->d_name.len, 0, index);
        if (err)
                goto out_unlock;
 
        if (err)
                goto out_unlock;
 
-       err = btrfs_add_nondir(trans, BTRFS_I(dir), dentry, BTRFS_I(inode),
-                       0, index);
+       err = btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode),
+                            dentry->d_name.name, dentry->d_name.len, 0, index);
        if (err)
                goto out_unlock;
 
        ihold(inode);
        set_bit(BTRFS_INODE_COPY_EVERYTHING, &BTRFS_I(inode)->runtime_flags);
 
-       err = btrfs_add_nondir(trans, BTRFS_I(dir), dentry, BTRFS_I(inode),
-                       1, index);
+       err = btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode),
+                            dentry->d_name.name, dentry->d_name.len, 1, index);
 
        if (err) {
                drop_inode = 1;
        if (ret)
                goto out;
 
-       ret = btrfs_add_nondir(trans, BTRFS_I(dir), dentry,
-                               BTRFS_I(inode), 0, index);
+       ret = btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode),
+                            dentry->d_name.name, dentry->d_name.len, 0, index);
        if (ret)
                goto out;
 
         * elsewhere above.
         */
        if (!err)
-               err = btrfs_add_nondir(trans, BTRFS_I(dir), dentry,
-                               BTRFS_I(inode), 0, index);
+               err = btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode),
+                                    dentry->d_name.name, dentry->d_name.len, 0,
+                                    index);
        if (err)
                goto out_unlock;