[PATCH 1/4] dump.f2fs: show extra attr only when feature is enabled

From: Chao Yu
Date: Thu Nov 16 2017 - 06:52:56 EST


If we don't turn on the feature, don't show related info in dumped data.

Signed-off-by: Chao Yu <yuchao0@xxxxxxxxxx>
---
fsck/mount.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/fsck/mount.c b/fsck/mount.c
index 653dcf391da7..c094f940ee1b 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -222,10 +222,15 @@ void print_inode_info(struct f2fs_sb_info *sbi,
le32_to_cpu(inode->i_ext.blk_addr),
le32_to_cpu(inode->i_ext.len));

- DISP_u16(inode, i_extra_isize);
- DISP_u16(inode, i_inline_xattr_size);
- DISP_u32(inode, i_projid);
- DISP_u32(inode, i_inode_checksum);
+ if (c.feature & cpu_to_le32(F2FS_FEATURE_EXTRA_ATTR)) {
+ DISP_u16(inode, i_extra_isize);
+ if (c.feature & cpu_to_le32(F2FS_FEATURE_FLEXIBLE_INLINE_XATTR))
+ DISP_u16(inode, i_inline_xattr_size);
+ if (c.feature & cpu_to_le32(F2FS_FEATURE_PRJQUOTA))
+ DISP_u32(inode, i_projid);
+ if (c.feature & cpu_to_le32(F2FS_FEATURE_INODE_CHKSUM))
+ DISP_u32(inode, i_inode_checksum);
+ }

DISP_u32(inode, i_addr[ofs]); /* Pointers to data blocks */
DISP_u32(inode, i_addr[ofs + 1]); /* Pointers to data blocks */
--
2.15.0.55.gc2ece9dc4de6