From 18716f146b8efa12a173778b811b14e5bbb1aee2 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Fri, 12 Apr 2024 07:07:35 +0200 Subject: [PATCH] FOLD: xfs: pass a file mode instead of file type to xfs_imeta_iget --- db/fsmap.c | 2 +- libxfs/init.c | 2 +- libxfs/inode.c | 5 ++--- repair/bmap_repair.c | 2 +- repair/phase2.c | 6 ++---- repair/phase6.c | 8 ++++---- repair/rmap.c | 4 ++-- repair/xfs_repair.c | 4 ++-- 8 files changed, 15 insertions(+), 18 deletions(-) diff --git a/db/fsmap.c b/db/fsmap.c index 465f9c677..50daa19ed 100644 --- a/db/fsmap.c +++ b/db/fsmap.c @@ -161,7 +161,7 @@ fsmap_rtgroup( goto out_trans; } - error = -libxfs_imeta_iget(tp, ino, XFS_DIR3_FT_REG_FILE, &ip); + error = -libxfs_imeta_iget(tp, ino, S_IFREG, &ip); if (error) { dbprintf(_("Cannot load rtgroup %u rmap inode\n"), rtg->rtg_rgno); diff --git a/libxfs/init.c b/libxfs/init.c index ce22a2aa7..b07418c83 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -642,7 +642,7 @@ libxfs_mountfs_imeta( if (xfs_has_metadir(mp)) { error = -libxfs_imeta_iget(tp, mp->m_sb.sb_metadirino, - XFS_DIR3_FT_DIR, &mp->m_metadirip); + S_IFDIR, &mp->m_metadirip); if (error) { fprintf(stderr, _("%s: Failed to load metadir root directory, error %d\n"), diff --git a/libxfs/inode.c b/libxfs/inode.c index 87b5df84f..feba8026e 100644 --- a/libxfs/inode.c +++ b/libxfs/inode.c @@ -233,7 +233,7 @@ int libxfs_imeta_iget( struct xfs_trans *tp, xfs_ino_t ino, - unsigned char ftype, + umode_t mode, struct xfs_inode **ipp) { struct xfs_mount *mp = tp->t_mountp; @@ -245,8 +245,7 @@ libxfs_imeta_iget( return error; if ((xfs_has_metadir(mp) && !xfs_is_metadir_inode(ip)) || - ftype == XFS_DIR3_FT_UNKNOWN || - xfs_mode_to_ftype(VFS_I(ip)->i_mode) != ftype) { + ((VFS_I(ip)->i_mode) & S_IFMT) != mode) { libxfs_irele(ip); return -EFSCORRUPTED; } diff --git a/repair/bmap_repair.c b/repair/bmap_repair.c index 170b5e9f6..cff65c817 100644 --- a/repair/bmap_repair.c +++ b/repair/bmap_repair.c @@ -311,7 +311,7 @@ xrep_bmap_scan_rt( goto out_path; } - error = -libxfs_imeta_iget(sc->tp, ino, XFS_DIR3_FT_REG_FILE, &ip); + error = -libxfs_imeta_iget(sc->tp, ino, S_IFREG, &ip); if (error) goto out_path; diff --git a/repair/phase2.c b/repair/phase2.c index d1b2824ca..bf45a1ff5 100644 --- a/repair/phase2.c +++ b/repair/phase2.c @@ -530,8 +530,7 @@ reserve_rtrmap_inode( goto out_trans; } - error = -libxfs_imeta_iget(tp, ino, XFS_DIR3_FT_REG_FILE, - &rtg->rtg_rmapip); + error = -libxfs_imeta_iget(tp, ino, S_IFREG, &rtg->rtg_rmapip); if (error) goto out_trans; @@ -587,8 +586,7 @@ reserve_rtrefcount_inode( goto out_trans; } - error = -libxfs_imeta_iget(tp, ino, XFS_DIR3_FT_REG_FILE, - &rtg->rtg_refcountip); + error = -libxfs_imeta_iget(tp, ino, S_IFREG, &rtg->rtg_refcountip); if (error) goto out_trans; diff --git a/repair/phase6.c b/repair/phase6.c index 8c1182ad1..0698a96f1 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -701,7 +701,7 @@ ensure_rtino_metadir( do_error( _("failed to allocate trans to iget rt metadata inode 0x%llx, error %d\n"), (unsigned long long)ino, error); - error = -libxfs_imeta_iget(tp, ino, XFS_DIR3_FT_REG_FILE, ipp); + error = -libxfs_imeta_iget(tp, ino, S_IFREG, ipp); libxfs_trans_cancel(tp); if (error) do_error( @@ -1071,7 +1071,7 @@ ensure_rtgroup_rmapbt( _("Couldn't allocate transaction to iget rtgroup %u rmap inode 0x%llx, error %d\n"), rtg->rtg_rgno, (unsigned long long)ino, error); - error = -libxfs_imeta_iget(tp, ino, XFS_DIR3_FT_REG_FILE, &ip); + error = -libxfs_imeta_iget(tp, ino, S_IFREG, &ip); libxfs_trans_cancel(tp); if (error) { do_warn( @@ -1201,7 +1201,7 @@ ensure_rtgroup_refcountbt( _("Couldn't allocate transaction to iget rtgroup %u refcountbt inode 0x%llx, error %d\n"), rtg->rtg_rgno, (unsigned long long)ino, error); - error = -libxfs_imeta_iget(tp, ino, XFS_DIR3_FT_REG_FILE, &ip); + error = -libxfs_imeta_iget(tp, ino, S_IFREG, &ip); libxfs_trans_cancel(tp); if (error) { do_warn( @@ -3934,7 +3934,7 @@ reattach_quota_inode( do_error( _("failed to allocate trans to grab quota inode 0x%llx, error %d\n"), (unsigned long long)ino, error); - error = -libxfs_imeta_iget(tp, ino, XFS_DIR3_FT_REG_FILE, &ip); + error = -libxfs_imeta_iget(tp, ino, S_IFREG, &ip); libxfs_trans_cancel(tp); if (error) { do_warn( diff --git a/repair/rmap.c b/repair/rmap.c index 222021fc7..725c45d15 100644 --- a/repair/rmap.c +++ b/repair/rmap.c @@ -1611,10 +1611,10 @@ threadsafe_imeta_iget( return error; if (do_prefetch) { - error = -libxfs_imeta_iget(tp, ino, XFS_DIR3_FT_REG_FILE, ipp); + error = -libxfs_imeta_iget(tp, ino, S_IFREG, ipp); } else { pthread_mutex_lock(&lock); - error = -libxfs_imeta_iget(tp, ino, XFS_DIR3_FT_REG_FILE, ipp); + error = -libxfs_imeta_iget(tp, ino, S_IFREG, ipp); pthread_mutex_unlock(&lock); } libxfs_trans_cancel(tp); diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 7d5cbaaf8..7f1f38b73 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -706,8 +706,8 @@ check_metadir_inode( do_error( _("could not allocate transaction to load metadir inode")); - error = -libxfs_imeta_iget(tp, mp->m_sb.sb_metadirino, - XFS_DIR3_FT_DIR, &mp->m_metadirip); + error = -libxfs_imeta_iget(tp, mp->m_sb.sb_metadirino, S_IFDIR, + &mp->m_metadirip); if (error) { libxfs_trans_cancel(tp); need_metadir_inode = true; -- 2.50.1