debugfs: handle inline_data feature in bmap command

No physical block mapping if an inode has inline data.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
pu
Zheng Liu 2013-12-06 17:58:04 +08:00 committed by Theodore Ts'o
parent 8f3428d899
commit f5f6c020ca
2 changed files with 10 additions and 0 deletions

View File

@ -321,6 +321,13 @@ errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
if (ext2fs_file_block_offset_too_big(fs, inode, block))
return EXT2_ET_FILE_TOO_BIG;
/*
* 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)

View File

@ -506,4 +506,7 @@ ec EXT2_ET_MISSING_EA_FEATURE,
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