]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: remove verify_dfsbno
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)
Replace this homegrown helper with its libxfs equivalent.

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>
repair/attr_repair.c
repair/dinode.c
repair/dinode.h
repair/prefetch.c
repair/scan.c

index 5f8840339143a715b0e138c6c710872040786cb3..6cec0f7075d5937479fb164b31b92a16fef84c2e 100644 (file)
@@ -1092,7 +1092,7 @@ process_longform_attr(
        }
 
        /* FIX FOR bug 653709 -- EKN */
-       if (!xfs_verify_fsbno(mp, bno)) {
+       if (!libxfs_verify_fsbno(mp, bno)) {
                do_warn(
        _("block in attribute fork of inode %" PRIu64 " is not valid\n"), ino);
                return 1;
index 135703d9897c5f354f6eab58edcf89678f7344e9..67adddd705dfa560c8f23c4e64fac3b428e32337 100644 (file)
@@ -203,25 +203,6 @@ verify_aginum(xfs_mount_t  *mp,
        return verify_ag_bno(sbp, agno, agbno);
 }
 
-/*
- * return 1 if block number is good, 0 if out of range
- */
-int
-verify_dfsbno(xfs_mount_t      *mp,
-               xfs_fsblock_t   fsbno)
-{
-       xfs_agnumber_t  agno;
-       xfs_agblock_t   agbno;
-       xfs_sb_t        *sbp = &mp->m_sb;;
-
-       /* range check ag #, ag block.  range-checking offset is pointless */
-
-       agno = XFS_FSB_TO_AGNO(mp, fsbno);
-       agbno = XFS_FSB_TO_AGBNO(mp, fsbno);
-
-       return verify_ag_bno(sbp, agno, agbno) == 0;
-}
-
 #define XR_DFSBNORANGE_VALID   0
 #define XR_DFSBNORANGE_BADSTART        1
 #define XR_DFSBNORANGE_BADEND  2
@@ -835,7 +816,7 @@ _("bad numrecs 0 in inode %" PRIu64 " bmap btree root block\n"),
                 * btree, we'd do it right here.  For now, if there's a
                 * problem, we'll bail out and presumably clear the inode.
                 */
-               if (!verify_dfsbno(mp, get_unaligned_be64(&pp[i])))  {
+               if (!libxfs_verify_fsbno(mp, get_unaligned_be64(&pp[i])))  {
                        do_warn(
 _("bad bmap btree ptr 0x%" PRIx64 " in ino %" PRIu64 "\n"),
                                get_unaligned_be64(&pp[i]), lino);
index c8e563b5fdd66cdef5dfeaeecec4c7d4dd865859..4bf7affddde4a703d8b222bcb5a8ca0d0682e6a0 100644 (file)
@@ -9,10 +9,6 @@
 struct blkmap;
 struct prefetch_args;
 
-int
-verify_dfsbno(xfs_mount_t      *mp,
-               xfs_fsblock_t   fsbno);
-
 void
 convert_extent(
        xfs_bmbt_rec_t          *rp,
index 3ac49db1eca934eaa76858d5702a9abfb02620bd..686bf7be5374ac5718b10958429da1ef5614eafe 100644 (file)
@@ -188,8 +188,9 @@ pf_read_bmbt_reclist(
                                (irec.br_startoff >= fs_max_file_offset))
                        goto out_free;
 
-               if (!verify_dfsbno(mp, irec.br_startblock) || !verify_dfsbno(mp,
-                               irec.br_startblock + irec.br_blockcount - 1))
+               if (!libxfs_verify_fsbno(mp, irec.br_startblock) ||
+                   !libxfs_verify_fsbno(mp, irec.br_startblock +
+                                            irec.br_blockcount - 1))
                        goto out_free;
 
                if (!args->dirs_only && ((irec.br_startoff +
@@ -337,7 +338,7 @@ pf_scanfunc_bmap(
 
        for (i = 0; i < numrecs; i++) {
                dbno = get_unaligned_be64(&pp[i]);
-               if (!verify_dfsbno(mp, dbno))
+               if (!libxfs_verify_fsbno(mp, dbno))
                        return 0;
                if (!pf_scan_lbtree(dbno, level, isadir, args, pf_scanfunc_bmap))
                        return 0;
@@ -379,7 +380,7 @@ pf_read_btinode(
 
        for (i = 0; i < numrecs; i++) {
                dbno = get_unaligned_be64(&pp[i]);
-               if (!verify_dfsbno(mp, dbno))
+               if (!libxfs_verify_fsbno(mp, dbno))
                        break;
                if (!pf_scan_lbtree(dbno, level, isadir, args, pf_scanfunc_bmap))
                        break;
index 8e81c5523c43738f58d66501d9c5755b5d0224e4..dcd4864d7302f355f5af8102b9302ef4da455ea5 100644 (file)
@@ -491,7 +491,7 @@ _("inode %" PRIu64 " bad # of bmap records (%u, min - %u, max - %u)\n"),
                 * we'd do it right here.  For now, if there's a problem,
                 * we'll bail out and presumably clear the inode.
                 */
-               if (!verify_dfsbno(mp, be64_to_cpu(pp[i])))  {
+               if (!libxfs_verify_fsbno(mp, be64_to_cpu(pp[i])))  {
                        do_warn(
 _("bad bmap btree ptr 0x%llx in ino %" PRIu64 "\n"),
                               (unsigned long long) be64_to_cpu(pp[i]), ino);