]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: refactor is static metadata inode checks
authorChristoph Hellwig <hch@lst.de>
Fri, 12 Apr 2024 04:53:25 +0000 (06:53 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 12 Apr 2024 05:58:06 +0000 (07:58 +0200)
Source kernel commit: c1a55c7bacaa75f4b87dbf3678080448879b170e

Use a single helper to check for the up to give static metatada
inodes.  Include the !metadir check in it as metadir file systems
never have them set.

Remove the duplicate check in xrep_orphanage_can_adopt as it already
checks for all metadata inodes directly below.

Remove the xfs_internal_inum wrapper as xfs_is_static_metadata_ino is
much more descriptive for what it does.

Check that an ino is valid before checking it is metadata in all places
that do both.

Signed-off-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_imeta.c
libxfs/xfs_imeta.h
libxfs/xfs_types.c
libxfs/xfs_types.h

index 11eeb38483995aa056b286baf1706fd235ff6347..50f8f77c89f5e18694c73eff9f65c2f92b359b3f 100644 (file)
@@ -999,24 +999,6 @@ xfs_imeta_link(
        return xfs_imeta_sb_link(upd);
 }
 
-/* Does this inode number refer to a static metadata inode? */
-bool
-xfs_is_static_meta_ino(
-       struct xfs_mount                *mp,
-       xfs_ino_t                       ino)
-{
-       const struct xfs_imeta_sbmap    *p;
-
-       if (ino == NULLFSINO)
-               return false;
-
-       for (p = xfs_imeta_sbmaps; p->path; p++)
-               if (ino == *xfs_imeta_sbmap_to_inop(mp, p))
-                       return true;
-
-       return false;
-}
-
 /*
  * Ensure that the in-core superblock has all the values that it should.
  * Caller should pass in an empty transaction to avoid livelocking on btree
index 4eadb3352201719b912298781c2b9c74d86358e8..4e9ae35d247754ab0dc742c2db52d55bcf10a738 100644 (file)
@@ -95,7 +95,6 @@ int xfs_imeta_create(struct xfs_imeta_update *upd, umode_t mode,
 int xfs_imeta_unlink(struct xfs_imeta_update *upd);
 int xfs_imeta_link(struct xfs_imeta_update *upd);
 
-bool xfs_is_static_meta_ino(struct xfs_mount *mp, xfs_ino_t ino);
 int xfs_imeta_mount(struct xfs_trans *tp);
 
 unsigned int xfs_imeta_create_space_res(struct xfs_mount *mp);
index 6488cda24e8670b9efb966c3c51e780367a1eea7..5b2991262f8123d63f95e974bf231f094fbeadda 100644 (file)
@@ -12,7 +12,7 @@
 #include "xfs_bit.h"
 #include "xfs_mount.h"
 #include "xfs_ag.h"
-#include "xfs_imeta.h"
+#include "xfs_inode.h"
 #include "xfs_rtbitmap.h"
 #include "xfs_rtgroup.h"
 
@@ -112,15 +112,6 @@ xfs_verify_ino(
        return xfs_verify_agno_agino(mp, agno, agino);
 }
 
-/* Is this an internal inode number? */
-inline bool
-xfs_internal_inum(
-       struct xfs_mount        *mp,
-       xfs_ino_t               ino)
-{
-       return xfs_is_static_meta_ino(mp, ino);
-}
-
 /*
  * Verify that a directory entry's inode number doesn't point at an internal
  * inode, empty space, or static AG metadata.
@@ -130,9 +121,11 @@ xfs_verify_dir_ino(
        struct xfs_mount        *mp,
        xfs_ino_t               ino)
 {
-       if (!xfs_has_metadir(mp) && xfs_internal_inum(mp, ino))
+       if (!xfs_verify_ino(mp, ino))
                return false;
-       return xfs_verify_ino(mp, ino);
+       if (xfs_is_static_metadata_ino(mp, ino))
+               return false;
+       return true;
 }
 
 /*
index 06de4b2846dfcf68a22f9cb0bb7740c2705d6c38..6d75a38e70cce9c4c13a30d519390fe3b491c0d4 100644 (file)
@@ -233,7 +233,6 @@ bool xfs_verify_fsbext(struct xfs_mount *mp, xfs_fsblock_t fsbno,
                xfs_fsblock_t len);
 
 bool xfs_verify_ino(struct xfs_mount *mp, xfs_ino_t ino);
-bool xfs_internal_inum(struct xfs_mount *mp, xfs_ino_t ino);
 bool xfs_verify_dir_ino(struct xfs_mount *mp, xfs_ino_t ino);
 bool xfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno);
 bool xfs_verify_rtbext(struct xfs_mount *mp, xfs_rtblock_t rtbno,