]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: pass the icreate args object to xfs_dialloc
authorDarrick J. Wong <djwong@kernel.org>
Mon, 21 Oct 2024 00:10:41 +0000 (17:10 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 31 Oct 2024 22:45:02 +0000 (15:45 -0700)
Source kernel commit: 390b4775d6787706b1846f15623a68e576ec900c

Pass the xfs_icreate_args object to xfs_dialloc since we can extract the
relevant mode (really just the file type) and parent inumber from there.
This simplifies the calling convention in preparation for the next
patch.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
db/iunlink.c
libxfs/xfs_ialloc.c
libxfs/xfs_ialloc.h
mkfs/proto.c
repair/phase6.c

index 0dc68b7240c1a3721711ef9ec5228847430668fc..55ba5af5a3c563fd88f02f32b571a15ac315b112 100644 (file)
@@ -223,7 +223,7 @@ create_unlinked(
                return error;
        }
 
-       error = -libxfs_dialloc(&tp, 0, args.mode, &ino);
+       error = -libxfs_dialloc(&tp, &args, &ino);
        if (error) {
                dbprintf(_("alloc inode: %s\n"), strerror(error));
                goto out_cancel;
index c526f677e072b4b482547a15cf9a605d4a7e5bc3..83e3d7d7c5a1b3e9d1ed1511c0d76e1bfcb09dd5 100644 (file)
@@ -1850,11 +1850,12 @@ out_release:
 int
 xfs_dialloc(
        struct xfs_trans        **tpp,
-       xfs_ino_t               parent,
-       umode_t                 mode,
+       const struct xfs_icreate_args *args,
        xfs_ino_t               *new_ino)
 {
        struct xfs_mount        *mp = (*tpp)->t_mountp;
+       xfs_ino_t               parent = args->pip ? args->pip->i_ino : 0;
+       umode_t                 mode = args->mode & S_IFMT;
        xfs_agnumber_t          agno;
        int                     error = 0;
        xfs_agnumber_t          start_agno;
index b549627e3a6150a66b9381237bdd649599d4675a..3a1323155a455a3cf4d7ac1f32a21c92b452700f 100644 (file)
@@ -33,11 +33,13 @@ xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o)
        return xfs_buf_offset(b, o << (mp)->m_sb.sb_inodelog);
 }
 
+struct xfs_icreate_args;
+
 /*
  * Allocate an inode on disk.  Mode is used to tell whether the new inode will
  * need space, and whether it is a directory.
  */
-int xfs_dialloc(struct xfs_trans **tpp, xfs_ino_t parent, umode_t mode,
+int xfs_dialloc(struct xfs_trans **tpp, const struct xfs_icreate_args *args,
                xfs_ino_t *new_ino);
 
 int xfs_difree(struct xfs_trans *tp, struct xfs_perag *pag,
index 8a51bfb264cedf55e70daac8d91926ab7b1644c3..42ac3e10929b5238b1f79c196d0d25f0150718e0 100644 (file)
@@ -428,7 +428,6 @@ creatproto(
        };
        struct xfs_inode        *ip;
        struct inode            *inode;
-       xfs_ino_t               parent_ino = dp ? dp->i_ino : 0;
        xfs_ino_t               ino;
        int                     error;
 
@@ -440,7 +439,7 @@ creatproto(
         * Call the space management code to pick the on-disk inode to be
         * allocated.
         */
-       error = -libxfs_dialloc(tpp, parent_ino, mode, &ino);
+       error = -libxfs_dialloc(tpp, &args, &ino);
        if (error)
                return error;
 
@@ -769,7 +768,7 @@ create_sb_metadata_file(
        if (error)
                res_failed(error);
 
-       error = -libxfs_dialloc(&tp, 0, args.mode, &ino);
+       error = -libxfs_dialloc(&tp, &args, &ino);
        if (error)
                goto fail;
 
index ba28edaa41c24cbd128dcbc560defb6945320665..b48f18b06a5c817e6370a35cd6c0bc7f10195d19 100644 (file)
@@ -873,7 +873,7 @@ mk_orphanage(
        if (i)
                res_failed(i);
 
-       error = -libxfs_dialloc(&tp, mp->m_sb.sb_rootino, args.mode, &ino);
+       error = -libxfs_dialloc(&tp, &args, &ino);
        if (error)
                do_error(_("%s inode allocation failed %d\n"),
                        ORPHANAGE, error);