xfs: refactor common transaction/inode/quota allocation idiom

Create a new helper xfs_trans_alloc_inode that allocates a transaction,
locks and joins an inode to it, and then reserves the appropriate amount
of quota against that transction.  Then replace all the open-coded
idioms with a single call to this helper.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
This commit is contained in:
Darrick J. Wong
2021-01-26 16:33:29 -08:00
parent 02b7ee4eb6
commit 3a1af6c317
6 changed files with 59 additions and 38 deletions

View File

@ -268,4 +268,7 @@ xfs_trans_item_relog(
return lip->li_ops->iop_relog(lip, tp);
}
int xfs_trans_alloc_inode(struct xfs_inode *ip, struct xfs_trans_res *resv,
unsigned int dblocks, bool force, struct xfs_trans **tpp);
#endif /* __XFS_TRANS_H__ */