@@ -1188,6 +1188,16 @@ static int process_block(ext2_filsys fs, blk_t *block_nr,
return ret;
}
+static int process_block_ind(ext2_filsys fs, blk_t *block_nr,
+ e2_blkcnt_t blockcnt, blk_t ref_block,
+ int ref_offset, void *priv_data)
+{
+ if (blockcnt >= 0)
+ return 0;
+ return process_block(fs, block_nr, blockcnt, ref_block, ref_offset,
+ priv_data);
+}
+
/*
* Progress callback
*/
@@ -1302,6 +1312,18 @@ static errcode_t inode_scan_and_fix(ext2_resize_t rfs)
if (ext2fs_inode_has_valid_blocks(inode) &&
(rfs->bmap || pb.is_dir)) {
pb.ino = ino;
+ if (inode->i_flags & EXT4_EXTENTS_FL) {
+ /*
+ * With extent-based files, we have
+ * to translate all of the interior
+ * node blocks first.
+ */
+ retval = ext2fs_block_iterate2(rfs->old_fs,
+ ino, 0, block_buf,
+ process_block_ind, &pb);
+ if (retval)
+ goto errout;
+ }
retval = ext2fs_block_iterate2(rfs->old_fs,
ino, 0, block_buf,
process_block, &pb);