]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - scrub/phase4.c
2 * Copyright (C) 2018 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it would be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
24 #include <sys/types.h>
26 #include <sys/statvfs.h>
31 #include "workqueue.h"
32 #include "xfs_scrub.h"
38 /* Phase 4: Repair filesystem. */
40 /* Process all the action items. */
42 xfs_process_action_items(
43 struct scrub_ctx
*ctx
)
47 pthread_mutex_lock(&ctx
->lock
);
48 if (moveon
&& ctx
->errors_found
== 0 && want_fstrim
) {
52 pthread_mutex_unlock(&ctx
->lock
);
57 /* Fix everything that needs fixing. */
60 struct scrub_ctx
*ctx
)
62 return xfs_process_action_items(ctx
);
65 /* Run the optimize-only phase if there are no errors. */
68 struct scrub_ctx
*ctx
)
71 * In preen mode, corruptions are immediately recorded as errors,
72 * so if there are any corruptions on the filesystem errors_found
73 * will be non-zero and we won't do anything.
75 if (ctx
->errors_found
) {
76 str_info(ctx
, ctx
->mntpoint
,
77 _("Errors found, please re-run with -y."));
81 return xfs_process_action_items(ctx
);
84 /* Estimate how much work we're going to do. */
86 xfs_estimate_repair_work(
87 struct scrub_ctx
*ctx
,
89 unsigned int *nr_threads
,