]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: refactor verify_dfsbno_range
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 10 Jul 2020 19:35:45 +0000 (15:35 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 10 Jul 2020 19:35:45 +0000 (15:35 -0400)
Refactor this function to use libxfs type checking helpers.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/libxfs_api_defs.h
repair/dinode.c

index c03f0efa9f384f389b26991d87d199467d1da4b3..69f79a0887ef693e4b69cd60c19abdb183cffdd1 100644 (file)
 #define xfs_verify_agbno               libxfs_verify_agbno
 #define xfs_verify_cksum               libxfs_verify_cksum
 #define xfs_verify_dir_ino             libxfs_verify_dir_ino
+#define xfs_verify_fsbno               libxfs_verify_fsbno
 #define xfs_verify_ino                 libxfs_verify_ino
 #define xfs_verify_rtbno               libxfs_verify_rtbno
 #define xfs_zero_extent                        libxfs_zero_extent
index b343534c9421d934fddad0ced11ab3c3c50981c8..135703d9897c5f354f6eab58edcf89678f7344e9 100644 (file)
@@ -228,31 +228,23 @@ verify_dfsbno(xfs_mount_t *mp,
 #define XR_DFSBNORANGE_OVERFLOW        3
 
 static __inline int
-verify_dfsbno_range(xfs_mount_t        *mp,
-               xfs_fsblock_t   fsbno,
-               xfs_filblks_t   count)
+verify_dfsbno_range(
+       struct xfs_mount        *mp,
+       xfs_fsblock_t           fsbno,
+       xfs_filblks_t           count)
 {
-       xfs_agnumber_t  agno;
-       xfs_agblock_t   agbno;
-       xfs_sb_t        *sbp = &mp->m_sb;;
-
        /* the start and end blocks better be in the same allocation group */
-       agno = XFS_FSB_TO_AGNO(mp, fsbno);
-       if (agno != XFS_FSB_TO_AGNO(mp, fsbno + count - 1)) {
+       if (XFS_FSB_TO_AGNO(mp, fsbno) !=
+           XFS_FSB_TO_AGNO(mp, fsbno + count - 1)) {
                return XR_DFSBNORANGE_OVERFLOW;
        }
 
-       agbno = XFS_FSB_TO_AGBNO(mp, fsbno);
-       if (verify_ag_bno(sbp, agno, agbno)) {
+       if (!libxfs_verify_fsbno(mp, fsbno))
                return XR_DFSBNORANGE_BADSTART;
-       }
-
-       agbno = XFS_FSB_TO_AGBNO(mp, fsbno + count - 1);
-       if (verify_ag_bno(sbp, agno, agbno)) {
+       if (!libxfs_verify_fsbno(mp, fsbno + count - 1))
                return XR_DFSBNORANGE_BADEND;
-       }
 
-       return (XR_DFSBNORANGE_VALID);
+       return XR_DFSBNORANGE_VALID;
 }
 
 static int