]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs: convey metadata health events to the health monitor
authorDarrick J. Wong <djwong@kernel.org>
Sun, 22 Feb 2026 22:41:04 +0000 (14:41 -0800)
committerAndrey Albershteyn <aalbersh@kernel.org>
Wed, 8 Apr 2026 19:39:56 +0000 (21:39 +0200)
Source kernel commit: 5eb4cb18e445d09f64ef4b7c8fdc3b2296cb0702

Connect the filesystem metadata health event collection system to the
health monitor so that xfs can send events to xfs_healer as it collects
information.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_fs.h
libxfs/xfs_health.h

index 59de6ab69fb31925ed92e2c8a9cfc842b8490777..04e1dcf61257d0f89d51906106074d1b460a3118 100644 (file)
@@ -1008,6 +1008,12 @@ struct xfs_rtgroup_geometry {
 /* affects the whole fs */
 #define XFS_HEALTH_MONITOR_DOMAIN_MOUNT                (0)
 
+/* metadata health events */
+#define XFS_HEALTH_MONITOR_DOMAIN_FS           (1)
+#define XFS_HEALTH_MONITOR_DOMAIN_AG           (2)
+#define XFS_HEALTH_MONITOR_DOMAIN_INODE                (3)
+#define XFS_HEALTH_MONITOR_DOMAIN_RTGROUP      (4)
+
 /* Health monitor event types */
 
 /* status of the monitor itself */
@@ -1017,11 +1023,37 @@ struct xfs_rtgroup_geometry {
 /* filesystem was unmounted */
 #define XFS_HEALTH_MONITOR_TYPE_UNMOUNT                (2)
 
+/* metadata health events */
+#define XFS_HEALTH_MONITOR_TYPE_SICK           (3)
+#define XFS_HEALTH_MONITOR_TYPE_CORRUPT                (4)
+#define XFS_HEALTH_MONITOR_TYPE_HEALTHY                (5)
+
 /* lost events */
 struct xfs_health_monitor_lost {
        __u64   count;
 };
 
+/* fs/rt metadata */
+struct xfs_health_monitor_fs {
+       /* XFS_FSOP_GEOM_SICK_* flags */
+       __u32   mask;
+};
+
+/* ag/rtgroup metadata */
+struct xfs_health_monitor_group {
+       /* XFS_{AG,RTGROUP}_SICK_* flags */
+       __u32   mask;
+       __u32   gno;
+};
+
+/* inode metadata */
+struct xfs_health_monitor_inode {
+       /* XFS_BS_SICK_* flags */
+       __u32   mask;
+       __u32   gen;
+       __u64   ino;
+};
+
 struct xfs_health_monitor_event {
        /* XFS_HEALTH_MONITOR_DOMAIN_* */
        __u32   domain;
@@ -1039,6 +1071,9 @@ struct xfs_health_monitor_event {
         */
        union {
                struct xfs_health_monitor_lost lost;
+               struct xfs_health_monitor_fs fs;
+               struct xfs_health_monitor_group group;
+               struct xfs_health_monitor_inode inode;
        } e;
 
        /* zeroes */
index b31000f7190ce5ccda6d082b07575af536ec3cb7..1d45cf5789e86438b20fc3c8aec22a612e2203ff 100644 (file)
@@ -289,4 +289,9 @@ void xfs_bulkstat_health(struct xfs_inode *ip, struct xfs_bulkstat *bs);
 #define xfs_metadata_is_sick(error) \
        (unlikely((error) == -EFSCORRUPTED || (error) == -EFSBADCRC))
 
+unsigned int xfs_healthmon_inode_mask(unsigned int sick_mask);
+unsigned int xfs_healthmon_rtgroup_mask(unsigned int sick_mask);
+unsigned int xfs_healthmon_perag_mask(unsigned int sick_mask);
+unsigned int xfs_healthmon_fs_mask(unsigned int sick_mask);
+
 #endif /* __XFS_HEALTH_H__ */