From: Zheng Liu Date: Fri, 6 Dec 2013 09:58:04 +0000 (+0800) Subject: debugfs: handle inline_data feature in bmap command X-Git-Tag: v1.43-WIP-2015-05-18~340 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=f5f6c020cac429a5484ad0fdaccb44f127912075;p=tools%2Fe2fsprogs.git debugfs: handle inline_data feature in bmap command No physical block mapping if an inode has inline data. Signed-off-by: Zheng Liu Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/ext2fs/bmap.c b/lib/ext2fs/bmap.c index db2fd72..c1d0e6f 100644 --- a/lib/ext2fs/bmap.c +++ b/lib/ext2fs/bmap.c @@ -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) diff --git a/lib/ext2fs/ext2_err.et.in b/lib/ext2fs/ext2_err.et.in index a7c8902..7638470 100644 --- a/lib/ext2fs/ext2_err.et.in +++ b/lib/ext2fs/ext2_err.et.in @@ -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