]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: xfs_imeta_create is now only used on metadir file systems
authorChristoph Hellwig <hch@lst.de>
Sat, 13 Apr 2024 06:27:43 +0000 (08:27 +0200)
committerChristoph Hellwig <hch@lst.de>
Sat, 13 Apr 2024 06:28:13 +0000 (08:28 +0200)
Source kernel commit: 1dd8e4bb248b2a39dcb97d1971579d19325e83b5

Remove the sb case and add a WARN_ON instead.

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

index dc79b1bad150c77e2c28779440db4f1e560480a0..8fdc9fcfc1fcfbd60955dd2273e8a0e92a69d703 100644 (file)
@@ -167,77 +167,6 @@ xfs_imeta_path_to_sb_inop(
        return NULL;
 }
 
-/* Update inode pointers in the superblock. */
-static inline void
-xfs_imeta_log_sb(
-       struct xfs_trans        *tp)
-{
-       struct xfs_mount        *mp = tp->t_mountp;
-       struct xfs_buf          *bp = xfs_trans_getsb(tp);
-
-       /*
-        * Update the inode flags in the ondisk superblock without touching
-        * the summary counters.  We have not quiesced inode chunk allocation,
-        * so we cannot coordinate with updates to the icount and ifree percpu
-        * counters.
-        */
-       xfs_sb_to_disk(bp->b_addr, &mp->m_sb);
-       xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SB_BUF);
-       xfs_trans_log_buf(tp, bp, 0, sizeof(struct xfs_dsb) - 1);
-}
-
-/*
- * Create a new metadata inode and set a superblock pointer to this new inode.
- * The superblock field must not already be pointing to an inode.
- */
-STATIC int
-xfs_imeta_sb_create(
-       struct xfs_imeta_update         *upd,
-       umode_t                         mode)
-{
-       struct xfs_icreate_args         args = {
-               .nlink                  = S_ISDIR(mode) ? 2 : 1,
-       };
-       struct xfs_mount                *mp = upd->mp;
-       xfs_ino_t                       *sb_inop;
-       xfs_ino_t                       ino;
-       int                             error;
-
-       /* Files rooted in the superblock do not have parents. */
-       xfs_icreate_args_rootfile(&args, mp, mode, false);
-
-       /* Reject if the sb already points to some inode. */
-       sb_inop = xfs_imeta_path_to_sb_inop(mp, upd->path);
-       if (!sb_inop)
-               return -EINVAL;
-
-       if (*sb_inop != NULLFSINO)
-               return -EEXIST;
-
-       /* Create a new inode and set the sb pointer. */
-       error = xfs_dialloc(&upd->tp, NULL, mode, &ino);
-       if (error)
-               return error;
-       error = xfs_icreate(upd->tp, ino, &args, &upd->ip);
-       if (error)
-               return error;
-       upd->ip_locked = true;
-
-       /*
-        * If we ever need the ability to create rt metadata files on a
-        * pre-metadir filesystem, we'll need to dqattach the child here.
-        * Currently we assume that mkfs will create the files and quotacheck
-        * will account for them.
-        */
-
-       /* Update superblock pointer. */
-       *sb_inop = ino;
-       xfs_imeta_log_sb(upd->tp);
-
-       trace_xfs_imeta_sb_create(upd);
-       return 0;
-}
-
 /* Functions for storing and retrieving metadata directory inode values. */
 
 static inline void
@@ -743,12 +672,11 @@ xfs_imeta_create(
 
        ASSERT(xfs_imeta_path_check(upd->path));
 
-       *ipp = NULL;
+       if (WARN_ON_ONCE(!xfs_has_metadir(mp)))
+               return -EIO;
 
-       if (xfs_has_metadir(mp))
-               error = xfs_imeta_dir_create(upd, mode);
-       else
-               error = xfs_imeta_sb_create(upd, mode);
+       *ipp = NULL;
+       error = xfs_imeta_dir_create(upd, mode);
        *ipp = upd->ip;
        return error;
 }