diff options
author | Zhihao Cheng <chengzhihao1@huawei.com> | 2024-11-11 17:08:09 +0800 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2024-11-11 10:32:46 +0100 |
commit | 83b7477eae174e974237685f83f0fec4fb794892 (patch) | |
tree | cb5e6c3b0e9de5178124fb761e44466b092a55e2 /ubifs-utils/libubifs/ubifs.h | |
parent | 47c1cfd5e8ec289597f7342f88e103811511f0a8 (diff) |
fsck.ubifs: check and correct the space statistics
This is the 12/18 step of fsck. Check and correct the space statistics.
There could be following steps and possible errors:
Step 1. Exit for check mode, if %FR_LPT_CORRUPTED or %FR_LPT_INCORRECT
is set in lpt status, the exit code should have %FSCK_UNCORRECTED.
Step 2. Check lpt status, if %FR_LPT_CORRUPTED is set in lpt status,
normal mode with 'no' answer will exit, other modes will rebuild lpt.
Step 3. Traverse LPT nodes, check the correctness of nnode and pnode,
compare LEB scanning result with LEB properties.
a. LPT node is corrupted, normal mode with 'no' answer will exit,
rebuild lpt for other modes.
b. Incorrect nnode/pnode, normal mode with 'no' answer will exit,
other other modes will correct the nnode/pnode.
c. Inconsistent comparing result, normal mode with 'no' answer
will exit, other modes will correct the space statistics.
Step 4. Check and correct the lprops table information.
Step 5. Set gc lnum(ubifs_rcvry_gc_commit / take_gc_lnum).
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubifs-utils/libubifs/ubifs.h')
-rw-r--r-- | ubifs-utils/libubifs/ubifs.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ubifs-utils/libubifs/ubifs.h b/ubifs-utils/libubifs/ubifs.h index 45c4105..a4b05a6 100644 --- a/ubifs-utils/libubifs/ubifs.h +++ b/ubifs-utils/libubifs/ubifs.h @@ -1563,6 +1563,7 @@ enum { FR_H_BUD_CORRUPTED = 0, /* Bud LEB is corrupted */ FR_H_TNC_DATA_CORRUPTED, /* Data searched from TNC is corrupted */ FR_H_ORPHAN_CORRUPTED, /* Orphan LEB is corrupted */ + FR_H_LTAB_INCORRECT, /* Lprops table is incorrect */ }; /* Callback functions for failure(which can be handled by fsck) happens. */ static inline void set_failure_reason_callback(const struct ubifs_info *c, @@ -1734,6 +1735,7 @@ int ubifs_fixup_free_space(struct ubifs_info *c); /* replay.c */ int ubifs_validate_entry(struct ubifs_info *c, const struct ubifs_dent_node *dent); +int take_ihead(struct ubifs_info *c); int ubifs_replay_journal(struct ubifs_info *c); /* gc.c */ @@ -1754,7 +1756,7 @@ int ubifs_clear_orphans(struct ubifs_info *c); int ubifs_calc_dflt_lpt_geom(struct ubifs_info *c, int *main_lebs, int *big_lpt); int ubifs_calc_lpt_geom(struct ubifs_info *c); int ubifs_create_lpt(struct ubifs_info *c, struct ubifs_lprops *lps, int lp_cnt, - u8 *hash); + u8 *hash, bool free_ltab); int ubifs_lpt_init(struct ubifs_info *c, int rd, int wr); struct ubifs_lprops *ubifs_lpt_lookup(struct ubifs_info *c, int lnum); struct ubifs_lprops *ubifs_lpt_lookup_dirty(struct ubifs_info *c, int lnum); @@ -1795,6 +1797,7 @@ int ubifs_lpt_end_commit(struct ubifs_info *c); int ubifs_lpt_post_commit(struct ubifs_info *c); void ubifs_free_lpt_nodes(struct ubifs_info *c); void ubifs_lpt_free(struct ubifs_info *c, int wr_only); +int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum); /* lprops.c */ const struct ubifs_lprops *ubifs_change_lp(struct ubifs_info *c, |