xfs: convert to SPDX license tags
[linux-block.git] / fs / xfs / scrub / bmap.c
index 639d14b51e9083904bcc9aed3f0bb86f694c83cc..3d08589f5c60ecde42a3d1e74eea2ff83940cc7a 100644 (file)
@@ -1,21 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2017 Oracle.  All Rights Reserved.
- *
  * Author: Darrick J. Wong <darrick.wong@oracle.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 #include "xfs.h"
 #include "xfs_fs.h"
@@ -51,7 +37,6 @@ xfs_scrub_setup_inode_bmap(
        struct xfs_scrub_context        *sc,
        struct xfs_inode                *ip)
 {
-       struct xfs_mount                *mp = sc->mp;
        int                             error;
 
        error = xfs_scrub_get_inode(sc, ip);
@@ -75,7 +60,7 @@ xfs_scrub_setup_inode_bmap(
        }
 
        /* Got the inode, lock it and we're ready to go. */
-       error = xfs_scrub_trans_alloc(sc->sm, mp, &sc->tp);
+       error = xfs_scrub_trans_alloc(sc, 0);
        if (error)
                goto out;
        sc->ilock_flags |= XFS_ILOCK_EXCL;
@@ -175,7 +160,7 @@ xfs_scrub_bmap_xref_rmap(
        unsigned long long              rmap_end;
        uint64_t                        owner;
 
-       if (!info->sc->sa.rmap_cur)
+       if (!info->sc->sa.rmap_cur || xfs_scrub_skip_xref(info->sc->sm))
                return;
 
        if (info->whichfork == XFS_COW_FORK)
@@ -684,7 +669,8 @@ xfs_scrub_bmap(
        info.lastoff = 0;
        ifp = XFS_IFORK_PTR(ip, whichfork);
        for_each_xfs_iext(ifp, &icur, &irec) {
-               if (xfs_scrub_should_terminate(sc, &error))
+               if (xfs_scrub_should_terminate(sc, &error) ||
+                   (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT))
                        break;
                if (isnullstartblock(irec.br_startblock))
                        continue;