{0},
};
+static const struct flag_map rtgroup_flags[] = {
+ {
+ .mask = XFS_RTGROUP_GEOM_SICK_SUPER,
+ .descr = "superblock",
+ },
+ {
+ .mask = XFS_RTGROUP_GEOM_SICK_BITMAP,
+ .descr = "realtime bitmap",
+ },
+ {
+ .mask = XFS_RTGROUP_GEOM_SICK_SUMMARY,
+ .descr = "realtime summary",
+ },
+ {0},
+};
+
static const struct flag_map inode_flags[] = {
{
.mask = XFS_BS_SICK_INODE,
return 0;
}
+/* Report on a rt group's health. */
+static int
+report_rtgroup_sick(
+ xfs_rgnumber_t rgno)
+{
+ struct xfs_rtgroup_geometry rgeo = { 0 };
+ char descr[256];
+ int ret;
+
+ ret = -xfrog_rtgroup_geometry(file->xfd.fd, rgno, &rgeo);
+ if (ret) {
+ xfrog_perror(ret, "rtgroup_geometry");
+ return 1;
+ }
+ snprintf(descr, sizeof(descr) - 1, _("rtgroup %u"), rgno);
+ report_sick(descr, rtgroup_flags, rgeo.rg_sick, rgeo.rg_checked);
+ return 0;
+}
+
/* Report on an inode's health. */
static int
report_inode_health(
return error;
}
-#define OPT_STRING ("a:cfi:nq")
+#define OPT_STRING ("a:cfi:nqr:")
/* Report on health problems in XFS filesystem. */
static int
{
unsigned long long x;
xfs_agnumber_t agno;
+ xfs_rgnumber_t rgno;
bool default_report = true;
int c;
int ret;
case 'q':
quiet = true;
break;
+ case 'r':
+ default_report = false;
+ errno = 0;
+ x = strtoll(optarg, NULL, 10);
+ if (!errno && x >= NULLRGNUMBER)
+ errno = ERANGE;
+ if (errno) {
+ perror("rtgroup health");
+ return 1;
+ }
+ break;
default:
return command_usage(&health_cmd);
}
if (ret)
return 1;
break;
+ case 'r':
+ rgno = strtoll(optarg, NULL, 10);
+ ret = report_rtgroup_sick(rgno);
+ if (ret)
+ return 1;
+ break;
default:
break;
}
if (ret)
return 1;
}
+ for (rgno = 0; rgno < file->xfd.fsgeom.rgcount; rgno++) {
+ ret = report_rtgroup_sick(rgno);
+ if (ret)
+ return 1;
+ }
if (comprehensive) {
ret = report_bulkstat_health(NULLAGNUMBER);
if (ret)
" -i inum -- Report health of a given inode number.\n"
" -n -- Try to report file names.\n"
" -q -- Only report unhealthy metadata.\n"
+" -r rgno -- Report health of the given realtime group.\n"
" paths -- Report health of the given file path.\n"
"\n"));
.cfunc = health_f,
.argmin = 0,
.argmax = -1,
- .args = "[-a agno] [-c] [-f] [-i inum] [-n] [-q] [paths]",
+ .args = "[-a agno] [-c] [-f] [-i inum] [-n] [-q] [-r rgno] [paths]",
.flags = CMD_FLAG_ONESHOT,
.help = health_help,
};