On large SSDs filled with lots of data, fsck.f2fs can be very long to finish. For instance, on my 1TB SSD filled at 99%, it takes literally 5 minutes to complete.
Currently, the only way to have some feedback is to enable debug output, but it is very verbose and doesn't tell the actual progress. This patch implements a simple progress report in the longest running part of the check (in fsck_chk_node_blk). The number of checked node / total valid nodes is printed every 1000 nodes checked, and the percentage of progress is also calculated and printed. Signed-off-by: Antoine Viallon <[email protected]> --- fsck/fsck.c | 9 +++++++++ fsck/fsck.h | 1 + 2 files changed, 10 insertions(+) diff --git a/fsck/fsck.c b/fsck/fsck.c index ecd87af..7a64339 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -546,6 +546,15 @@ int fsck_chk_node_blk(struct f2fs_sb_info *sbi, struct f2fs_inode *inode, node_blk = (struct f2fs_node *)calloc(BLOCK_SZ, 1); ASSERT(node_blk != NULL); + /* Progress report */ + sbi->fsck->chk.checked_blk_cnt++; + + if (sbi->fsck->chk.checked_blk_cnt % 1000 == 0) + printf("[FSCK] Checked node %lu / %u (%.2f%%)\n", + sbi->fsck->chk.checked_blk_cnt, + sbi->total_valid_node_count, + 100 * (float)(sbi->fsck->chk.checked_blk_cnt) / sbi->total_valid_node_count); + if (sanity_check_nid(sbi, nid, node_blk, ftype, ntype, &ni)) goto err; diff --git a/fsck/fsck.h b/fsck/fsck.h index 11846e1..dd679b5 100644 --- a/fsck/fsck.h +++ b/fsck/fsck.h @@ -91,6 +91,7 @@ struct f2fs_fsck { struct orphan_info orphani; struct chk_result { + u64 checked_blk_cnt; u64 valid_blk_cnt; u32 valid_nat_entry_cnt; u32 valid_node_cnt; -- 2.34.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
