*/
 static int get_inode_info(struct btrfs_root *root,
                          u64 ino, u64 *size, u64 *gen,
-                         u64 *mode, u64 *uid, u64 *gid)
+                         u64 *mode, u64 *uid, u64 *gid,
+                         u64 *rdev)
 {
        int ret;
        struct btrfs_inode_item *ii;
                *uid = btrfs_inode_uid(path->nodes[0], ii);
        if (gid)
                *gid = btrfs_inode_gid(path->nodes[0], ii);
+       if (rdev)
+               *rdev = btrfs_inode_rdev(path->nodes[0], ii);
 
 out:
        btrfs_free_path(path);
         * There are inodes that have extents that lie behind it's i_size. Don't
         * accept clones from these extents.
         */
-       ret = get_inode_info(found->root, ino, &i_size, NULL, NULL, NULL, NULL);
+       ret = get_inode_info(found->root, ino, &i_size, NULL, NULL, NULL, NULL,
+                       NULL);
        if (ret < 0)
                return ret;
 
        u64 right_gen;
 
        ret = get_inode_info(sctx->send_root, ino, NULL, &left_gen, NULL, NULL,
-                       NULL);
+                       NULL, NULL);
        if (ret < 0 && ret != -ENOENT)
                goto out;
        left_ret = ret;
                right_ret = -ENOENT;
        } else {
                ret = get_inode_info(sctx->parent_root, ino, NULL, &right_gen,
-                               NULL, NULL, NULL);
+                               NULL, NULL, NULL, NULL);
                if (ret < 0 && ret != -ENOENT)
                        goto out;
                right_ret = ret;
        btrfs_release_path(path);
 
        ret = get_inode_info(root, found_key.offset, NULL, dir_gen, NULL, NULL,
-                       NULL);
+                       NULL, NULL);
        if (ret < 0)
                goto out;
 
 
        if (other_inode > sctx->send_progress) {
                ret = get_inode_info(sctx->parent_root, other_inode, NULL,
-                               who_gen, NULL, NULL, NULL);
+                               who_gen, NULL, NULL, NULL, NULL);
                if (ret < 0)
                        goto out;
 
        }
 
        ret = get_inode_info(sctx->send_root, ow_inode, NULL, &gen, NULL, NULL,
-                       NULL);
+                       NULL, NULL);
        if (ret < 0)
                goto out;
 
        fs_path_reset(fctx->cur_path);
 
        ret = get_inode_info(sctx->send_root, di_key->objectid,
-                       NULL, &di_gen, &di_mode, NULL, NULL);
+                       NULL, &di_gen, &di_mode, NULL, NULL, NULL);
        if (ret < 0)
                goto out;
 
                return -ENOMEM;
 
        ret = get_inode_info(sctx->send_root, dir, NULL, &gen, NULL, NULL,
-                       NULL);
+                       NULL, NULL);
        if (ret < 0)
                goto out;
 
                return -ENOMEM;
 
        ret = get_inode_info(sctx->parent_root, dir, NULL, &gen, NULL, NULL,
-                       NULL);
+                       NULL, NULL);
        if (ret < 0)
                goto out;
 
 
        if (clone_root2 == sctx->send_root) {
                ret = get_inode_info(sctx->send_root, clone_root->ino, NULL,
-                               &gen, NULL, NULL, NULL);
+                               &gen, NULL, NULL, NULL, NULL);
                if (ret < 0)
                        goto out;
                ret = get_cur_path(sctx, clone_root->ino, gen, p);
                goto out;
 
        ret = get_inode_info(sctx->send_root, sctx->cur_ino, NULL, NULL,
-                       &left_mode, &left_uid, &left_gid);
+                       &left_mode, &left_uid, &left_gid, NULL);
        if (ret < 0)
                goto out;
 
                } else {
                        ret = get_inode_info(sctx->parent_root, sctx->cur_ino,
                                        NULL, NULL, &right_mode, &right_uid,
-                                       &right_gid);
+                                       &right_gid, NULL);
                        if (ret < 0)
                                goto out;