From patchwork Sat Sep 22 04:00:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [05/21,v5] libext2fs: handle inline_data in block iterator function Date: Fri, 21 Sep 2012 18:00:53 -0000 From: Zheng Liu X-Patchwork-Id: 186079 Message-Id: <1348286469-31690-6-git-send-email-wenqing.lz@taobao.com> To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, Zheng Liu From: Zheng Liu We needn't traverse blocks for an inode which has inline data because no block belongs to it. After appling this patch, the following commands in debugfs can handle inline_data feature: - icheck - blocks - filefrag In some places, block iterator functions are used to traverse blocks of directory. In this case, we need to check whether inode has inline_data flag or not, and handle it manually. Signed-off-by: Zheng Liu --- lib/ext2fs/block.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/lib/ext2fs/block.c b/lib/ext2fs/block.c index 68dcb03..4abcedf 100644 --- a/lib/ext2fs/block.c +++ b/lib/ext2fs/block.c @@ -345,6 +345,13 @@ errcode_t ext2fs_block_iterate3(ext2_filsys fs, return ctx.errcode; /* + * If an inode has inline data, we needn't traverse its blocks + * because no block belong to this inode. + */ + if (inode.i_flags & EXT4_INLINE_DATA_FL) + return ctx.errcode; + + /* * Check to see if we need to limit large files */ if (flags & BLOCK_FLAG_NO_LARGE) {