@@ -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;
@@ -1850,11 +1850,12 @@ xfs_dialloc_try_ag(
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;
@@ -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,
@@ -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;
@@ -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);