xfs: check tp->t_dqinfo value instead of the XFS_TRANS_DQ_DIRTY flag
Nowadays the only things that the XFS_TRANS_DQ_DIRTY flag seems to do
are indicates the tp->t_dqinfo->dqs[XFS_QM_TRANS_{USR,GRP,PRJ}] values
changed and check in xfs_trans_apply_dquot_deltas() and the unreserve
variant xfs_trans_unreserve_and_mod_dquots(). Actually, we also can
use the tp->t_dqinfo value instead of the XFS_TRANS_DQ_DIRTY flag, that
is to say, we allocate the new tp->t_dqinfo only when the qtrx values
changed, so the tp->t_dqinfo value isn't NULL equals the XFS_TRANS_DQ_DIRTY
flag is set, we only need to check if tp->t_dqinfo == NULL in
xfs_trans_apply_dquot_deltas() and its unreserve variant to determine
whether lock all of the dquots and join them to the transaction.
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
committed by
Darrick J. Wong
parent
a9382fa9a9
commit
04a58620a1
@@ -959,7 +959,6 @@ xfs_dir_ialloc(
|
||||
xfs_buf_t *ialloc_context = NULL;
|
||||
int code;
|
||||
void *dqinfo;
|
||||
uint tflags;
|
||||
|
||||
tp = *tpp;
|
||||
ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES);
|
||||
@@ -1018,12 +1017,9 @@ xfs_dir_ialloc(
|
||||
* and attach it to the next transaction.
|
||||
*/
|
||||
dqinfo = NULL;
|
||||
tflags = 0;
|
||||
if (tp->t_dqinfo) {
|
||||
dqinfo = (void *)tp->t_dqinfo;
|
||||
tp->t_dqinfo = NULL;
|
||||
tflags = tp->t_flags & XFS_TRANS_DQ_DIRTY;
|
||||
tp->t_flags &= ~(XFS_TRANS_DQ_DIRTY);
|
||||
}
|
||||
|
||||
code = xfs_trans_roll(&tp);
|
||||
@@ -1031,10 +1027,8 @@ xfs_dir_ialloc(
|
||||
/*
|
||||
* Re-attach the quota info that we detached from prev trx.
|
||||
*/
|
||||
if (dqinfo) {
|
||||
if (dqinfo)
|
||||
tp->t_dqinfo = dqinfo;
|
||||
tp->t_flags |= tflags;
|
||||
}
|
||||
|
||||
if (code) {
|
||||
xfs_buf_relse(ialloc_context);
|
||||
|
||||
Reference in New Issue
Block a user