Whamcloud - gitweb
debugfs: handle inline_data feature in bmap command
authorZheng Liu <wenqing.lz@taobao.com>
Fri, 6 Dec 2013 09:58:04 +0000 (17:58 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 4 Mar 2014 13:46:14 +0000 (08:46 -0500)
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>
lib/ext2fs/bmap.c
lib/ext2fs/ext2_err.et.in

index db2fd72..c1d0e6f 100644 (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)
index a7c8902..7638470 100644 (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