[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1375436989-18948-12-git-send-email-wenqing.lz@taobao.com>
Date: Fri, 2 Aug 2013 17:49:38 +0800
From: Zheng Liu <gnehzuil.liu@...il.com>
To: linux-ext4@...r.kernel.org
Cc: Theodore Ts'o <tytso@....edu>, Zheng Liu <wenqing.lz@...bao.com>
Subject: [PATCH v1 11/22] debugfs: handle inline_data feature in bmap command
From: Zheng Liu <wenqing.lz@...bao.com>
If an inode has inline data, bmap command will return the physical block
of this inode.
Signed-off-by: Theodore Ts'o <tytso@....edu>
Signed-off-by: Zheng Liu <wenqing.lz@...bao.com>
---
lib/ext2fs/bmap.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/lib/ext2fs/bmap.c b/lib/ext2fs/bmap.c
index aadd22e..408cd37 100644
--- a/lib/ext2fs/bmap.c
+++ b/lib/ext2fs/bmap.c
@@ -264,6 +264,21 @@ errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
block_buf = buf;
}
+ if (inode->i_flags & EXT4_INLINE_DATA_FL) {
+ unsigned long group, pblock, offset;
+
+ group = (ino - 1) / EXT2_INODES_PER_GROUP(fs->super);
+ if (group > fs->group_desc_count)
+ return EXT2_ET_BAD_INODE_NUM;
+ offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) *
+ EXT2_INODE_SIZE(fs->super);
+ pblock = offset >> EXT2_BLOCK_SIZE_BITS(fs->super);
+ if (!ext2fs_inode_table_loc(fs, (unsigned) group))
+ return EXT2_ET_MISSING_INODE_TABLE;
+ *phys_blk = ext2fs_inode_table_loc(fs, group) + pblock;
+ goto done;
+ }
+
if (inode->i_flags & EXT4_EXTENTS_FL) {
retval = ext2fs_extent_open2(fs, ino, inode, &handle);
if (retval)
--
1.7.9.7
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists