]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: refactor inode creation transaction/inode/quota allocation idiom
authorDarrick J. Wong <djwong@kernel.org>
Wed, 27 Jan 2021 20:07:57 +0000 (12:07 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 3 Feb 2021 17:18:49 +0000 (09:18 -0800)
commit1b69e83ee46eccd3c6a281825cc81d63b31a5d02
treef6fbded8c9f4b87453a546dbcbecc26a942ca9b4
parentf850056e5d1b941fb483b8a7e6412900b0680bc7
xfs: refactor inode creation transaction/inode/quota allocation idiom

For file creation, create a new helper xfs_trans_alloc_icreate that
allocates a transaction and reserves the appropriate amount of quota
against that transction.  Replace all the open-coded idioms with a
single call to this helper so that we can contain the retry loops in the
next patchset.

This changes the locking behavior for non-tempfile creation slightly, in
that we now make the quota reservation without holding the directory
ILOCK.  While the dquots chosen for inode creation are based on the
directory state at a given point in time, the directory ILOCK was
released as soon as the dquot references are picked up.  Hence it was
never necessary to hold the directory ILOCK for the quota reservation.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_inode.c
fs/xfs/xfs_symlink.c
fs/xfs/xfs_trans.c
fs/xfs/xfs_trans.h