/* Miscellaneous superblock corruption */
#define PR_0_MISC_CORRUPT_SUPER 0x00000B
-/* Error determing physical device size of filesystem */
+/* Error determining physical device size of filesystem */
#define PR_0_GETSIZE_ERROR 0x00000C
/* Inode count in the superblock incorrect */
/* Invalid quota inode number */
#define PR_0_INVALID_QUOTA_INO 0x00004F
+/* Inode count in the superblock incorrect */
+#define PR_0_INODE_COUNT_BIG 0x000050
+
+/* Meta_bg and resize_inode are not compatible, remove resize_inode*/
+#define PR_0_DISABLE_RESIZE_INODE 0x000051
+
+/* Orphan file contains holes */
+#define PR_0_ORPHAN_FILE_HOLE 0x000052
+
+/* Orphan file block has wrong magic */
+#define PR_0_ORPHAN_FILE_BAD_MAGIC 0x000053
+
+/* Orphan file block has wrong checksum */
+#define PR_0_ORPHAN_FILE_BAD_CHECKSUM 0x000054
+
+/* Orphan file size isn't multiple of blocks size */
+#define PR_0_ORPHAN_FILE_WRONG_SIZE 0x000055
+
+/* Invalid s_min_extra_isize */
+#define PR_0_MIN_EXTRA_ISIZE_INVALID 0x000056
+
+/* Invalid s_want_extra_isize */
+#define PR_0_WANT_EXTRA_ISIZE_INVALID 0x000057
+
+/* Clear EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE flag */
+#define PR_0_CLEAR_EXTRA_ISIZE 0x000058
/*
* Pass 1 errors
#define PR_1_EXTENTS_SET 0x01005A
/* inode is in extents format, but superblock is missing EXTENTS feature */
-/* inode has extents, superblock missing INCOMPAT_EXTENTS feature */
#define PR_1_EXTENT_FEATURE 0x01005B
/* inode missing EXTENTS_FL, but is an extent inode */
/* Inode leaf has a duplicate extent mapping */
#define PR_1_EXTENT_COLLISION 0x01007D
-/* Error allocating memory for encrypted directory list */
-#define PR_1_ALLOCATE_ENCRYPTED_DIRLIST 0x01007E
+/* Error allocating memory for encrypted inode list */
+#define PR_1_ALLOCATE_ENCRYPTED_INODE_LIST 0x01007E
/* Inode extent tree could be more shallow */
#define PR_1_EXTENT_BAD_MAX_DEPTH 0x01007F
/* Inode has illegal EA value inode */
#define PR_1_ATTR_VALUE_EA_INODE 0x010083
+/* Inode has bad timestamp */
+#define PR_1_INODE_BAD_TIME 0x010084
+
/* Parent inode has invalid EA entry. EA inode does not have
* EXT4_EA_INODE_FL flag. Delete EA entry? */
#define PR_1_ATTR_NO_EA_INODE_FL 0x010085
/* EA inode for parent inode does not have EXT4_EA_INODE_FL flag */
#define PR_1_ATTR_SET_EA_INODE_FL 0x010086
+/* Offer to clear uninitialized flag on an extent */
+#define PR_1_CLEAR_UNINIT_EXTENT 0x010087
+
+/* Casefold flag set on a non-directory */
+#define PR_1_CASEFOLD_NONDIR 0x010088
+
+/* Casefold flag set, but file system is missing the casefold feature */
+#define PR_1_CASEFOLD_FEATURE 0x010089
+
+/* Inode has encrypt flag but no encryption extended attribute */
+#define PR_1_MISSING_ENCRYPTION_XATTR 0x01008A
+
+/* Encrypted inode has corrupt encryption extended attribute */
+#define PR_1_CORRUPT_ENCRYPTION_XATTR 0x01008B
+
+/* Error allocating memory for casefolded directory list */
+#define PR_1_ALLOCATE_CASEFOLDED_DIRLIST 0x01008C
+
+/* Htree directory should use SipHash but does not */
+#define PR_1_HTREE_NEEDS_SIPHASH 0x01008D
+
+/* Htree directory uses SipHash but should not */
+#define PR_1_HTREE_CANNOT_SIPHASH 0x01008E
+
+/* Orphan file inode is not a regular file */
+#define PR_1_ORPHAN_FILE_BAD_MODE 0x01008F
+
+/* Orphan file inode is not in use, but contains data */
+#define PR_1_ORPHAN_FILE_NOT_CLEAR 0x010090
+
+/* Warning for user that all inodes need to be expanded atleast by
+ * s_min_extra_isize
+ */
+#define PR_1_EXPAND_EISIZE_WARNING 0x010091
+
+/* Expand the inode */
+#define PR_1_EXPAND_EISIZE 0x010092
+
+/* Delete an EA so that EXTRA_ISIZE may be enabled */
+#define PR_1_EISIZE_DELETE_EA 0x010093
+
+/* An EA needs to be deleted by e2fsck is being run with -p or -y */
+#define PR_1_EA_BLK_NOSPC 0x010094
+
+/* Disable EXTRA_ISIZE feature as inode cannot be expanded
+ * without deletion of an EA
+ */
+#define PR_1_CLEAR_EXTRA_ISIZE 0x010095
+
+/* invalid inode creation time */
+#define PR_1_CRTIME_BAD 0x010096
+
+/* Symlink missing NUL terminator */
+#define PR_1_SYMLINK_NUL 0x010097
+
+/* Failed to goto block group */
+#define PR_1_SCAN_GOTO 0x0100A0
/*
* Pass 1b errors
/* Duplicate/bad block range in inode */
#define PR_1B_DUP_RANGE 0x011008
+/* Inode is badly corrupt (badness value = ) */
+#define PR_1B_INODE_TOOBAD 0x011009
+
/* Pass 1C: Scan directories for inodes with dup blocks. */
#define PR_1C_PASS_HEADER 0x012000
-/* Pass 1D: Reconciling duplicate blocks */
+/* Pass 1D: Reconciling multiply-claimed blocks */
#define PR_1D_PASS_HEADER 0x013000
-/* File has duplicate blocks */
+/* File has multiply-claimed blocks */
#define PR_1D_DUP_FILE 0x013001
/* List of files sharing duplicate blocks */
/* Couldn't clone file (error) */
#define PR_1D_CLONE_ERROR 0x013008
+/* File with shared blocks found */
+#define PR_1D_DISCONNECT_QUESTION 0x013009
+
+/* Couldn't unlink file (error) */
+#define PR_1D_DISCONNECT_ERROR 0x01300A
+
+
/*
* Pass 1e --- rebuilding extent trees
*/
/* Directory entry has deleted or unused inode */
#define PR_2_UNUSED_INODE 0x020003
-/* Directry entry is link to '.' */
+/* Directory entry is link to '.' */
#define PR_2_LINK_DOT 0x020004
/* Directory entry points to inode now located in a bad block */
/* Directory entry contains a link to a directory */
#define PR_2_LINK_DIR 0x020006
-/* Directory entry contains a link to the root directry */
+/* Directory entry contains a link to the root directory */
#define PR_2_LINK_ROOT 0x020007
/* Directory entry has illegal characters in its name */
/* Clear invalid HTREE directory */
#define PR_2_HTREE_CLEAR 0x020038
-/* Clear the htree flag forcibly */
-/* #define PR_2_HTREE_FCLR 0x020039 */
+/* Filesystem has large directories, but has no such flag in superblock */
+#define PR_2_FEATURE_LARGE_DIRS 0x020039
/* Bad block in htree interior node */
#define PR_2_HTREE_BADBLK 0x02003A
/* Encrypted directory entry is too short */
#define PR_2_BAD_ENCRYPTED_NAME 0x020050
+/* Encrypted directory contains unencrypted file */
+#define PR_2_UNENCRYPTED_FILE 0x020051
+
+/* Encrypted directory contains file with different encryption policy */
+#define PR_2_INCONSISTENT_ENCRYPTION_POLICY 0x020052
+
+/* Encoded directory entry has illegal characters in its name */
+#define PR_2_BAD_ENCODED_NAME 0x020053
+
+/* Non-unique filename found, but can't rename */
+#define PR_2_NON_UNIQUE_FILE_NO_RENAME 0x020054
+
+/* Inode is badly corrupt (badness value = ) */
+#define PR_2_INODE_TOOBAD 0x020055
+
+/* Entry dirdata length set incorrectly */
+#define PR_2_CLEAR_DIRDATA 0x020056
+
/*
* Pass 3 errors
*/
/* Lost+found is encrypted */
#define PR_3_LPF_ENCRYPTED 0x03001B
+/* Recursively looped directory inode */
+#define PR_3_LOOPED_DIR 0x03001D
+
/*
- * Pass 3a --- rehashing diretories
+ * Pass 3a --- rehashing directories
*/
/* Pass 3a: Reindexing directories */
#define PR_3A_PASS_HEADER 0x031000
/* Extended attribute inode ref count wrong */
#define PR_4_EA_INODE_REF_COUNT 0x040005
+/* directory exceeds max links, but no DIR_NLINK feature in superblock */
+#define PR_4_DIR_NLINK_FEATURE 0x040006
+
+/* Directory ref count set to overflow but it doesn't have to be */
+#define PR_4_DIR_OVERFLOW_REF_COUNT 0x040007
+
/*
* Pass 5 errors
*/
/* Inode range not used, but marked in bitmap */
#define PR_5_INODE_RANGE_UNUSED 0x050016
-/* Inode rangeused, but not marked used in bitmap */
+/* Inode range used, but not marked used in bitmap */
#define PR_5_INODE_RANGE_USED 0x050017
/* Block in use but group is marked BLOCK_UNINIT */
/* Block bitmap checksum does not match */
#define PR_5_BLOCK_BITMAP_CSUM_INVALID 0x05001B
+/* Expand the inodes which need a new EA block */
+#define PR_5_EXPAND_EISIZE 0x05001C
+
/*
* Post-Pass 5 errors
*/
/* Error updating quota information */
#define PR_6_WRITE_QUOTAS 0x060006
+/* Orphan file without a journal */
+#define PR_6_ORPHAN_FILE_WITHOUT_JOURNAL 0x060007
+
+/* Orphan file truncation failed */
+#define PR_6_ORPHAN_FILE_TRUNC_FAILED 0x060008
+
+/* Failed to initialize orphan file */
+#define PR_6_ORPHAN_FILE_CORRUPTED 0x060009
+
+/* Cannot fix corrupted orphan file with invalid bitmaps */
+#define PR_6_ORPHAN_FILE_BITMAP_INVALID 0x06000A
+
+/* Orphan file creation failed */
+#define PR_6_ORPHAN_FILE_CREATE_FAILED 0x06000B
+
+/* Orphan file block contains data */
+#define PR_6_ORPHAN_BLOCK_DIRTY 0x06000C
+
+/* orphan_present set but orphan file is empty */
+#define PR_6_ORPHAN_PRESENT_CLEAN_FILE 0x06000D
+
+/* orphan_present set but orphan_file is not */
+#define PR_6_ORPHAN_PRESENT_NO_FILE 0x06000E
+
+/* Orphan file size isn't multiple of blocks size */
+#define PR_6_ORPHAN_FILE_WRONG_SIZE 0x06000F
+
+/* Orphan file contains holes */
+#define PR_6_ORPHAN_FILE_HOLE 0x060010
/*
* Function declarations
*/
-int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx);
+#define fix_problem(ctx, code, pctx) \
+ fix_problem_bad(ctx, code, pctx, 1)
+#define fix_problem_notbad(ctx, code, pctx) \
+ fix_problem_bad(ctx, code, pctx, 0)
+#define fix_problem_bad(ctx, code, pctx, badness) \
+ fix_problem_loc(ctx, code, pctx, badness, __func__, __LINE__)
+int fix_problem_loc(e2fsck_t ctx, problem_t code, struct problem_context *pctx,
+ int badness, const char *func, const int line);
int end_problem_latch(e2fsck_t ctx, int mask);
int set_latch_flags(int mask, int setflags, int clearflags);
int get_latch_flags(int mask, int *value);