]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: export the geometry of realtime groups to userspace
authorDarrick J. Wong <djwong@kernel.org>
Wed, 7 Aug 2024 23:04:34 +0000 (16:04 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Sat, 10 Aug 2024 06:54:48 +0000 (23:54 -0700)
Source kernel commit: f5a734e12dae026218c45e5f46fe771492f2249d

Create an ioctl so that the kernel can report the status of realtime
groups to userspace.

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

index 65c30118e3dd3ab951b4972140c59b197df7f426..06e8e18ad4c35017c86bfe0a109e686728d1bf9e 100644 (file)
@@ -971,6 +971,22 @@ struct xfs_getparents_by_handle {
        struct xfs_getparents           gph_request;
 };
 
+/*
+ * Output for XFS_IOC_RTGROUP_GEOMETRY
+ */
+struct xfs_rtgroup_geometry {
+       __u32 rg_number;        /* i/o: rtgroup number */
+       __u32 rg_length;        /* o: length in blocks */
+       __u32 rg_sick;          /* o: sick things in ag */
+       __u32 rg_checked;       /* o: checked metadata in ag */
+       __u32 rg_flags;         /* i/o: flags for this ag */
+       __u32 rg_pad;           /* o: zero */
+       __u64 rg_reserved[13];  /* o: zero */
+};
+#define XFS_RTGROUP_GEOM_SICK_SUPER    (1U << 0)  /* superblock */
+#define XFS_RTGROUP_GEOM_SICK_BITMAP   (1U << 1)  /* rtbitmap */
+#define XFS_RTGROUP_GEOM_SICK_SUMMARY  (1U << 2)  /* rtsummary */
+
 /*
  * ioctl commands that are used by Linux filesystems
  */
@@ -1009,6 +1025,7 @@ struct xfs_getparents_by_handle {
 #define XFS_IOC_GETPARENTS     _IOWR('X', 62, struct xfs_getparents)
 #define XFS_IOC_GETPARENTS_BY_HANDLE _IOWR('X', 63, struct xfs_getparents_by_handle)
 #define XFS_IOC_SCRUBV_METADATA        _IOWR('X', 64, struct xfs_scrub_vec_head)
+#define XFS_IOC_RTGROUP_GEOMETRY _IOWR('X', 65, struct xfs_rtgroup_geometry)
 
 /*
  * ioctl commands that replace IRIX syssgi()'s
index 7e77e2df9704abda49f882e3818a48ca5ae8541b..2da64555434d5a9c81ee13d939e2a1459dfbc1d2 100644 (file)
@@ -288,6 +288,8 @@ xfs_inode_is_healthy(struct xfs_inode *ip)
 
 void xfs_fsop_geom_health(struct xfs_mount *mp, struct xfs_fsop_geom *geo);
 void xfs_ag_geom_health(struct xfs_perag *pag, struct xfs_ag_geometry *ageo);
+void xfs_rtgroup_geom_health(struct xfs_rtgroup *rtg,
+               struct xfs_rtgroup_geometry *rgeo);
 void xfs_bulkstat_health(struct xfs_inode *ip, struct xfs_bulkstat *bs);
 
 #define xfs_metadata_is_sick(error) \
index ca0b70afe4718011dcf95cb3c0ee5f159359527f..6a78dc66be092a9b00fb10732d27453e31f9a41f 100644 (file)
@@ -267,6 +267,20 @@ xfs_rtgroup_trans_join(
        }
 }
 
+/* Retrieve rt group geometry. */
+int
+xfs_rtgroup_get_geometry(
+       struct xfs_rtgroup      *rtg,
+       struct xfs_rtgroup_geometry *rgeo)
+{
+       /* Fill out form. */
+       memset(rgeo, 0, sizeof(*rgeo));
+       rgeo->rg_number = rtg->rtg_rgno;
+       rgeo->rg_length = rtg->rtg_extents * rtg->rtg_mount->m_sb.sb_rextsize;
+       xfs_rtgroup_geom_health(rtg, rgeo);
+       return 0;
+}
+
 #ifdef CONFIG_PROVE_LOCKING
 static struct lock_class_key xfs_rtginode_lock_class;
 
index 9bf6cb35020382180358d1c1f999280aa940a7de..2d4bb09ad16fa9d5d197b6cb243da68c9b5c20c0 100644 (file)
@@ -249,6 +249,9 @@ void xfs_rtgroup_unlock(struct xfs_rtgroup *rtg, unsigned int rtglock_flags);
 void xfs_rtgroup_trans_join(struct xfs_trans *tp, struct xfs_rtgroup *rtg,
                unsigned int rtglock_flags);
 
+int xfs_rtgroup_get_geometry(struct xfs_rtgroup *rtg,
+               struct xfs_rtgroup_geometry *rgeo);
+
 int xfs_rtginode_mkdir_parent(struct xfs_mount *mp);
 int xfs_rtginode_load_parent(struct xfs_trans *tp);
 
@@ -277,6 +280,7 @@ struct xfs_buf *xfs_rtgroup_log_super(struct xfs_trans *tp,
 # define xfs_rtgroup_lock(rtg, gf)             ((void)0)
 # define xfs_rtgroup_unlock(rtg, gf)           ((void)0)
 # define xfs_rtgroup_trans_join(tp, rtg, gf)   ((void)0)
+# define xfs_rtgroup_get_geometry(rtg, rgeo)   (-EOPNOTSUPP)
 # define xfs_rtginode_mkdir_parent(...)                (-EOPNOTSUPP)
 # define xfs_rtginode_load_parent(...)         (-EOPNOTSUPP)
 # define xfs_rtgroup_update_super(bp, sb_bp)   ((void)0)