@@ -2135,7 +2135,7 @@ void do_bmap(int argc, char *argv[])
errcode = ext2fs_bmap2(current_fs, ino, 0, 0, 0, blk, 0, &pblk);
if (errcode) {
- com_err("argv[0]", errcode,
+ com_err(argv[0], errcode,
"while mapping logical block %llu\n", blk);
return;
}
@@ -266,6 +266,13 @@ errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
}
addr_per_block = (blk_t) fs->blocksize >> 2;
+ /*
+ * If an inode has inline data, that means that it doesn't have
+ * any blocks and we shouldn't map any blocks for it.
+ */
+ if (inode->i_flags & EXT4_INLINE_DATA_FL)
+ return EXT2_ET_INLINE_DATA_NO_BLOCK;
+
if (!block_buf) {
retval = ext2fs_get_array(2, fs->blocksize, &buf);
if (retval)
@@ -503,4 +503,7 @@ ec EXT2_ET_EA_NO_SPACE,
ec EXT2_ET_NO_INLINE_DATA,
"Inode doesn't have inline data"
+ec EXT2_ET_INLINE_DATA_NO_BLOCK,
+ "No block for an inode with inline data"
+
end