void phase3(xfs_mount_t *mp) { int i, j; do_log(_("Phase 3 - for each AG...\n")); if (!no_modify) do_log(_(" - scan and clear agi unlinked lists...\n")); else do_log(_(" - scan (but don't clear) agi unlinked lists...\n")); set_progress_msg(PROG_FMT_AGI_UNLINKED, (__uint64_t) glob_agcount); /* first clear the agi unlinked AGI list */ if (!no_modify) { for (i = 0; i < mp->m_sb.sb_agcount; i++) process_agi_unlinked(mp, i); } /* now look at possibly bogus inodes */ for (i = 0; i < mp->m_sb.sb_agcount; i++) { check_uncertain_aginodes(mp, i); PROG_RPT_INC(prog_rpt_done[i], 1); } print_final_rpt(); /* ok, now that the tree's ok, let's take a good look */ do_log(_( " - process known inodes and perform inode discovery...\n")); set_progress_msg(PROG_FMT_PROCESS_INO, (__uint64_t) mp->m_sb.sb_icount); process_ags(mp); print_final_rpt(); /* * process newly discovered inode chunks */ do_log(_(" - process newly discovered inodes...\n")); set_progress_msg(PROG_FMT_NEW_INODES, (__uint64_t) glob_agcount); do { /* * have to loop until no ag has any uncertain * inodes */ j = 0; for (i = 0; i < mp->m_sb.sb_agcount; i++) { j += process_uncertain_aginodes(mp, i); #ifdef XR_INODE_TRACE fprintf(stderr, "\t\t phase 3 - process_uncertain_inodes returns %d\n", j); #endif PROG_RPT_INC(prog_rpt_done[i], 1); } } while (j != 0); print_final_rpt(); }
void phase3( struct xfs_mount *mp, int scan_threads) { int i, j; int *counts; work_queue_t wq; do_log(_("Phase 3 - for each AG...\n")); if (!no_modify) do_log(_(" - scan and clear agi unlinked lists...\n")); else do_log(_(" - scan (but don't clear) agi unlinked lists...\n")); set_progress_msg(PROG_FMT_AGI_UNLINKED, (__uint64_t) glob_agcount); /* first clear the agi unlinked AGI list */ if (!no_modify) { for (i = 0; i < mp->m_sb.sb_agcount; i++) process_agi_unlinked(mp, i); } /* now look at possibly bogus inodes */ for (i = 0; i < mp->m_sb.sb_agcount; i++) { check_uncertain_aginodes(mp, i); PROG_RPT_INC(prog_rpt_done[i], 1); } print_final_rpt(); /* ok, now that the tree's ok, let's take a good look */ do_log(_( " - process known inodes and perform inode discovery...\n")); set_progress_msg(PROG_FMT_PROCESS_INO, (__uint64_t) mp->m_sb.sb_icount); process_ags(mp); print_final_rpt(); /* * process newly discovered inode chunks */ do_log(_(" - process newly discovered inodes...\n")); set_progress_msg(PROG_FMT_NEW_INODES, (__uint64_t) glob_agcount); counts = calloc(sizeof(*counts), mp->m_sb.sb_agcount); if (!counts) { do_abort(_("no memory for uncertain inode counts\n")); return; } do { /* * have to loop until no ag has any uncertain * inodes */ j = 0; memset(counts, 0, mp->m_sb.sb_agcount * sizeof(*counts)); create_work_queue(&wq, mp, scan_threads); for (i = 0; i < mp->m_sb.sb_agcount; i++) queue_work(&wq, do_uncertain_aginodes, i, &counts[i]); destroy_work_queue(&wq); /* tally up the counts */ for (i = 0; i < mp->m_sb.sb_agcount; i++) j += counts[i]; } while (j != 0); free(counts); print_final_rpt(); }