mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 12:03:54 +02:00
xfs: cleanups before adding metadata directories [v4.2 2/8]
Before we start adding code for metadata directory trees, let's clean up some warts in the realtime bitmap code and the inode allocator code. With a bit of luck, this should all go splendidly. Signed-off-by: Darrick J. Wong <djwong@kernel.org> -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQ2qTKExjcn+O1o2YRKO3ySh0YRpgUCZtX/YwAKCRBKO3ySh0YR pmJvAQCN9+wcAzTguqRdLUaQSFqfHWPCRHFXEab3D+q4FJ0/mgEA+383aG1WaA7A g8EFHRGyz+sDoSWYA2rC/Qe+c9JUtQU= =sGcd -----END PGP SIGNATURE----- Merge tag 'metadir-cleanups-6.12_2024-09-02' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into xfs-6.12-mergeA xfs: cleanups before adding metadata directories [v4.2 2/8] Before we start adding code for metadata directory trees, let's clean up some warts in the realtime bitmap code and the inode allocator code. With a bit of luck, this should all go splendidly. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org> * tag 'metadir-cleanups-6.12_2024-09-02' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux: xfs: pass the icreate args object to xfs_dialloc xfs: match on the global RT inode numbers in xfs_is_metadata_inode xfs: validate inumber in xfs_iget
This commit is contained in:
commit
37126ddd48
|
|
@ -1855,11 +1855,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,
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ xrep_tempfile_create(
|
|||
goto out_release_dquots;
|
||||
|
||||
/* Allocate inode, set up directory. */
|
||||
error = xfs_dialloc(&tp, dp->i_ino, mode, &ino);
|
||||
error = xfs_dialloc(&tp, &args, &ino);
|
||||
if (error)
|
||||
goto out_trans_cancel;
|
||||
error = xfs_icreate(tp, ino, &args, &sc->tempip);
|
||||
|
|
|
|||
|
|
@ -755,7 +755,7 @@ xfs_iget(
|
|||
ASSERT((lock_flags & (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED)) == 0);
|
||||
|
||||
/* reject inode numbers outside existing AGs */
|
||||
if (!ino || XFS_INO_TO_AGNO(mp, ino) >= mp->m_sb.sb_agcount)
|
||||
if (!xfs_verify_ino(mp, ino))
|
||||
return -EINVAL;
|
||||
|
||||
XFS_STATS_INC(mp, xs_ig_attempts);
|
||||
|
|
|
|||
|
|
@ -704,7 +704,7 @@ xfs_create(
|
|||
* entry pointing to them, but a directory also the "." entry
|
||||
* pointing to itself.
|
||||
*/
|
||||
error = xfs_dialloc(&tp, dp->i_ino, args->mode, &ino);
|
||||
error = xfs_dialloc(&tp, args, &ino);
|
||||
if (!error)
|
||||
error = xfs_icreate(tp, ino, args, &du.ip);
|
||||
if (error)
|
||||
|
|
@ -812,7 +812,7 @@ xfs_create_tmpfile(
|
|||
if (error)
|
||||
goto out_release_dquots;
|
||||
|
||||
error = xfs_dialloc(&tp, dp->i_ino, args->mode, &ino);
|
||||
error = xfs_dialloc(&tp, args, &ino);
|
||||
if (!error)
|
||||
error = xfs_icreate(tp, ino, args, &ip);
|
||||
if (error)
|
||||
|
|
|
|||
|
|
@ -276,12 +276,13 @@ static inline bool xfs_is_reflink_inode(struct xfs_inode *ip)
|
|||
return ip->i_diflags2 & XFS_DIFLAG2_REFLINK;
|
||||
}
|
||||
|
||||
static inline bool xfs_is_metadata_inode(struct xfs_inode *ip)
|
||||
static inline bool xfs_is_metadata_inode(const struct xfs_inode *ip)
|
||||
{
|
||||
struct xfs_mount *mp = ip->i_mount;
|
||||
|
||||
return ip == mp->m_rbmip || ip == mp->m_rsumip ||
|
||||
xfs_is_quota_inode(&mp->m_sb, ip->i_ino);
|
||||
return ip->i_ino == mp->m_sb.sb_rbmino ||
|
||||
ip->i_ino == mp->m_sb.sb_rsumino ||
|
||||
xfs_is_quota_inode(&mp->m_sb, ip->i_ino);
|
||||
}
|
||||
|
||||
bool xfs_is_always_cow_inode(struct xfs_inode *ip);
|
||||
|
|
|
|||
|
|
@ -799,7 +799,7 @@ xfs_qm_qino_alloc(
|
|||
};
|
||||
xfs_ino_t ino;
|
||||
|
||||
error = xfs_dialloc(&tp, 0, S_IFREG, &ino);
|
||||
error = xfs_dialloc(&tp, &args, &ino);
|
||||
if (!error)
|
||||
error = xfs_icreate(tp, ino, &args, ipp);
|
||||
if (error) {
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ xfs_symlink(
|
|||
/*
|
||||
* Allocate an inode for the symlink.
|
||||
*/
|
||||
error = xfs_dialloc(&tp, dp->i_ino, S_IFLNK, &ino);
|
||||
error = xfs_dialloc(&tp, &args, &ino);
|
||||
if (!error)
|
||||
error = xfs_icreate(tp, ino, &args, &du.ip);
|
||||
if (error)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user