diff options
author | Dave Chinner <dchinner@redhat.com> | 2021-06-02 10:48:24 +1000 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2021-06-02 10:48:24 +1000 |
commit | b652afd937033911944d7f681f2031b006961f1d (patch) | |
tree | 93a573ba8994680efc775c69b9d035d4ff5fe4c1 /fs/xfs/libxfs/xfs_ialloc.c | |
parent | 89b1f55a2951bb89b7ae9f8cb3fd11513ff3f219 (diff) |
xfs: get rid of xfs_dir_ialloc()
This is just a simple wrapper around the per-ag inode allocation
that doesn't need to exist. The internal mechanism to select and
allocate within an AG does not need to be exposed outside
xfs_ialloc.c, and it being exposed simply makes it harder to follow
the code and simplify it.
This is simplified by internalising xf_dialloc_select_ag() and
xfs_dialloc_ag() into a single xfs_dialloc() function and then
xfs_dir_ialloc() can go away.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/libxfs/xfs_ialloc.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_ialloc.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c index 79119af36d12..4a04ca79ba33 100644 --- a/fs/xfs/libxfs/xfs_ialloc.c +++ b/fs/xfs/libxfs/xfs_ialloc.c @@ -1428,7 +1428,7 @@ xfs_dialloc_ag_update_inobt( * The caller selected an AG for us, and made sure that free inodes are * available. */ -int +static int xfs_dialloc_ag( struct xfs_trans *tp, struct xfs_buf *agbp, @@ -1602,24 +1602,23 @@ xfs_ialloc_next_ag( * can be allocated, -ENOSPC be returned. */ int -xfs_dialloc_select_ag( +xfs_dialloc( struct xfs_trans **tpp, xfs_ino_t parent, umode_t mode, - struct xfs_buf **IO_agbp) + xfs_ino_t *new_ino) { struct xfs_mount *mp = (*tpp)->t_mountp; struct xfs_buf *agbp; xfs_agnumber_t agno; - int error; + int error = 0; xfs_agnumber_t start_agno; struct xfs_perag *pag; struct xfs_ino_geometry *igeo = M_IGEO(mp); bool okalloc = true; int needspace; int flags; - - *IO_agbp = NULL; + xfs_ino_t ino; /* * Directories, symlinks, and regular files frequently allocate at least @@ -1765,7 +1764,11 @@ nextag: return error ? error : -ENOSPC; found_ag: xfs_perag_put(pag); - *IO_agbp = agbp; + /* Allocate an inode in the found AG */ + error = xfs_dialloc_ag(*tpp, agbp, parent, &ino); + if (error) + return error; + *new_ino = ino; return 0; } |