node_blk->i.i_ctime_nsec = 0;
node_blk->i.i_mtime_nsec = 0;
node_blk->i.i_generation = 0;
- node_blk->i.i_current_depth = cpu_to_le32(1);
+ if (de->file_type == F2FS_FT_DIR)
+ node_blk->i.i_current_depth = cpu_to_le32(1);
+ else
+ node_blk->i.i_current_depth = cpu_to_le32(0);
node_blk->i.i_xattr_nid = 0;
node_blk->i.i_flags = 0;
node_blk->i.i_inline = F2FS_INLINE_XATTR;
unsigned char *en;
u32 namelen;
unsigned int idx = 0;
+ unsigned short i_gc_failures;
int need_fix = 0;
int ret;
}
}
+ i_gc_failures = le16_to_cpu(node_blk->i.i_gc_failures);
+ if (ftype == F2FS_FT_REG_FILE && i_gc_failures) {
+
+ DBG(1, "Regular Inode: 0x%x [%s] depth: %d\n\n",
+ le32_to_cpu(node_blk->footer.ino), en,
+ i_gc_failures);
+
+ if (c.fix_on) {
+ node_blk->i.i_gc_failures = cpu_to_le16(0);
+ need_fix = 1;
+ FIX_MSG("Regular: 0x%x reset i_gc_failures from 0x%x to 0x00",
+ nid, i_gc_failures);
+ }
+ }
+
free(en);
if (ftype == F2FS_FT_SYMLINK && i_blocks && i_size == 0) {
__le32 i_ctime_nsec; /* change time in nano scale */
__le32 i_mtime_nsec; /* modification time in nano scale */
__le32 i_generation; /* file version (for NFS) */
- __le32 i_current_depth; /* only for directory depth */
+ union {
+ __le32 i_current_depth; /* only for directory depth */
+ __le16 i_gc_failures; /*
+ * # of gc failures on pinned file.
+ * only for regular files.
+ */
+ };
__le32 i_xattr_nid; /* nid to save xattr */
__le32 i_flags; /* file attributes */
__le32 i_pino; /* parent inode number */
raw_node->i.i_generation = 0;
raw_node->i.i_xattr_nid = 0;
raw_node->i.i_flags = FS_IMMUTABLE_FL;
- raw_node->i.i_current_depth = cpu_to_le32(1);
+ raw_node->i.i_current_depth = cpu_to_le32(0);
raw_node->i.i_dir_level = DEF_DIR_LEVEL;
if (c.feature & cpu_to_le32(F2FS_FEATURE_EXTRA_ATTR)) {