+// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2018 Oracle. All Rights Reserved.
- *
* Author: Darrick J. Wong <darrick.wong@oracle.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include <stdio.h>
-#include <stdbool.h>
+#include "xfs.h"
#include <stdint.h>
#include <string.h>
#include <pthread.h>
#include <sys/statvfs.h>
-#include "workqueue.h"
-#include "xfs.h"
-#include "xfs_fs.h"
-#include "path.h"
+#include "libfrog/workqueue.h"
+#include "libfrog/paths.h"
#include "xfs_scrub.h"
#include "common.h"
#include "spacemap.h"
memcpy(head->fmh_keys, keys, sizeof(struct fsmap) * 2);
head->fmh_count = FSMAP_NR;
- while ((error = ioctl(ctx->mnt_fd, FS_IOC_GETFSMAP, head)) == 0) {
+ while ((error = ioctl(ctx->mnt.fd, FS_IOC_GETFSMAP, head)) == 0) {
for (i = 0, p = head->fmh_recs;
i < head->fmh_entries;
i++, p++) {
off64_t bperag;
bool moveon;
- bperag = (off64_t)ctx->geo.agblocks *
- (off64_t)ctx->geo.blocksize;
+ bperag = (off64_t)ctx->mnt.fsgeom.agblocks *
+ (off64_t)ctx->mnt.fsgeom.blocksize;
snprintf(descr, DESCR_BUFSZ, _("dev %d:%d AG %u fsmap"),
major(ctx->fsinfo.fs_datadev),
ret = workqueue_create(&wq, (struct xfs_mount *)ctx,
scrub_nproc_workqueue(ctx));
if (ret) {
- str_error(ctx, ctx->mntpoint, _("Could not create workqueue."));
+ str_liberror(ctx, ret, _("creating fsmap workqueue"));
return false;
}
if (ctx->fsinfo.fs_rt) {
ret = workqueue_add(&wq, xfs_scan_rt_blocks,
- ctx->geo.agcount + 1, &sbx);
+ ctx->mnt.fsgeom.agcount + 1, &sbx);
if (ret) {
sbx.moveon = false;
- str_error(ctx, ctx->mntpoint,
-_("Could not queue rtdev fsmap work."));
+ str_liberror(ctx, ret, _("queueing rtdev fsmap work"));
goto out;
}
}
if (ctx->fsinfo.fs_log) {
ret = workqueue_add(&wq, xfs_scan_log_blocks,
- ctx->geo.agcount + 2, &sbx);
+ ctx->mnt.fsgeom.agcount + 2, &sbx);
if (ret) {
sbx.moveon = false;
- str_error(ctx, ctx->mntpoint,
-_("Could not queue logdev fsmap work."));
+ str_liberror(ctx, ret, _("queueing logdev fsmap work"));
goto out;
}
}
- for (agno = 0; agno < ctx->geo.agcount; agno++) {
+ for (agno = 0; agno < ctx->mnt.fsgeom.agcount; agno++) {
ret = workqueue_add(&wq, xfs_scan_ag_blocks, agno, &sbx);
if (ret) {
sbx.moveon = false;
- str_error(ctx, ctx->mntpoint,
-_("Could not queue AG %u fsmap work."), agno);
+ str_liberror(ctx, ret, _("queueing per-AG fsmap work"));
break;
}
}