mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
xfs: convert quotacheck to attach dquot buffers
Now that we've converted the dquot logging machinery to attach the dquot
buffer to the li_buf pointer so that the AIL dqflush doesn't have to
allocate or read buffers in a reclaim path, do the same for the
quotacheck code so that the reclaim shrinker dqflush call doesn't have
to do that either.
Cc: <stable@vger.kernel.org> # v6.12
Fixes: 903edea6c5
("mm: warn about illegal __GFP_NOFAIL usage in a more appropriate location and manner")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
acc8f8628c
commit
ca378189fd
3 changed files with 16 additions and 13 deletions
|
@ -1285,11 +1285,10 @@ xfs_qm_dqflush_check(
|
||||||
* Requires dquot flush lock, will clear the dirty flag, delete the quota log
|
* Requires dquot flush lock, will clear the dirty flag, delete the quota log
|
||||||
* item from the AIL, and shut down the system if something goes wrong.
|
* item from the AIL, and shut down the system if something goes wrong.
|
||||||
*/
|
*/
|
||||||
int
|
static int
|
||||||
xfs_dquot_read_buf(
|
xfs_dquot_read_buf(
|
||||||
struct xfs_trans *tp,
|
struct xfs_trans *tp,
|
||||||
struct xfs_dquot *dqp,
|
struct xfs_dquot *dqp,
|
||||||
xfs_buf_flags_t xbf_flags,
|
|
||||||
struct xfs_buf **bpp)
|
struct xfs_buf **bpp)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = dqp->q_mount;
|
struct xfs_mount *mp = dqp->q_mount;
|
||||||
|
@ -1297,10 +1296,8 @@ xfs_dquot_read_buf(
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, dqp->q_blkno,
|
error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, dqp->q_blkno,
|
||||||
mp->m_quotainfo->qi_dqchunklen, xbf_flags,
|
mp->m_quotainfo->qi_dqchunklen, 0,
|
||||||
&bp, &xfs_dquot_buf_ops);
|
&bp, &xfs_dquot_buf_ops);
|
||||||
if (error == -EAGAIN)
|
|
||||||
return error;
|
|
||||||
if (xfs_metadata_is_sick(error))
|
if (xfs_metadata_is_sick(error))
|
||||||
xfs_dquot_mark_sick(dqp);
|
xfs_dquot_mark_sick(dqp);
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -1334,7 +1331,7 @@ xfs_dquot_attach_buf(
|
||||||
struct xfs_buf *bp = NULL;
|
struct xfs_buf *bp = NULL;
|
||||||
|
|
||||||
spin_unlock(&qlip->qli_lock);
|
spin_unlock(&qlip->qli_lock);
|
||||||
error = xfs_dquot_read_buf(tp, dqp, 0, &bp);
|
error = xfs_dquot_read_buf(tp, dqp, &bp);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
|
|
@ -214,8 +214,6 @@ void xfs_dquot_to_disk(struct xfs_disk_dquot *ddqp, struct xfs_dquot *dqp);
|
||||||
#define XFS_DQ_IS_DIRTY(dqp) ((dqp)->q_flags & XFS_DQFLAG_DIRTY)
|
#define XFS_DQ_IS_DIRTY(dqp) ((dqp)->q_flags & XFS_DQFLAG_DIRTY)
|
||||||
|
|
||||||
void xfs_qm_dqdestroy(struct xfs_dquot *dqp);
|
void xfs_qm_dqdestroy(struct xfs_dquot *dqp);
|
||||||
int xfs_dquot_read_buf(struct xfs_trans *tp, struct xfs_dquot *dqp,
|
|
||||||
xfs_buf_flags_t flags, struct xfs_buf **bpp);
|
|
||||||
int xfs_qm_dqflush(struct xfs_dquot *dqp, struct xfs_buf *bp);
|
int xfs_qm_dqflush(struct xfs_dquot *dqp, struct xfs_buf *bp);
|
||||||
void xfs_qm_dqunpin_wait(struct xfs_dquot *dqp);
|
void xfs_qm_dqunpin_wait(struct xfs_dquot *dqp);
|
||||||
void xfs_qm_adjust_dqtimers(struct xfs_dquot *d);
|
void xfs_qm_adjust_dqtimers(struct xfs_dquot *d);
|
||||||
|
|
|
@ -148,13 +148,13 @@ xfs_qm_dqpurge(
|
||||||
* We don't care about getting disk errors here. We need
|
* We don't care about getting disk errors here. We need
|
||||||
* to purge this dquot anyway, so we go ahead regardless.
|
* to purge this dquot anyway, so we go ahead regardless.
|
||||||
*/
|
*/
|
||||||
error = xfs_dquot_read_buf(NULL, dqp, XBF_TRYLOCK, &bp);
|
error = xfs_dquot_use_attached_buf(dqp, &bp);
|
||||||
if (error == -EAGAIN) {
|
if (error == -EAGAIN) {
|
||||||
xfs_dqfunlock(dqp);
|
xfs_dqfunlock(dqp);
|
||||||
dqp->q_flags &= ~XFS_DQFLAG_FREEING;
|
dqp->q_flags &= ~XFS_DQFLAG_FREEING;
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
if (error)
|
if (!bp)
|
||||||
goto out_funlock;
|
goto out_funlock;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -506,8 +506,8 @@ xfs_qm_dquot_isolate(
|
||||||
/* we have to drop the LRU lock to flush the dquot */
|
/* we have to drop the LRU lock to flush the dquot */
|
||||||
spin_unlock(&lru->lock);
|
spin_unlock(&lru->lock);
|
||||||
|
|
||||||
error = xfs_dquot_read_buf(NULL, dqp, XBF_TRYLOCK, &bp);
|
error = xfs_dquot_use_attached_buf(dqp, &bp);
|
||||||
if (error) {
|
if (!bp || error == -EAGAIN) {
|
||||||
xfs_dqfunlock(dqp);
|
xfs_dqfunlock(dqp);
|
||||||
goto out_unlock_dirty;
|
goto out_unlock_dirty;
|
||||||
}
|
}
|
||||||
|
@ -1331,6 +1331,10 @@ xfs_qm_quotacheck_dqadjust(
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error = xfs_dquot_attach_buf(NULL, dqp);
|
||||||
|
if (error)
|
||||||
|
return error;
|
||||||
|
|
||||||
trace_xfs_dqadjust(dqp);
|
trace_xfs_dqadjust(dqp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1513,9 +1517,13 @@ xfs_qm_flush_one(
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = xfs_dquot_read_buf(NULL, dqp, XBF_TRYLOCK, &bp);
|
error = xfs_dquot_use_attached_buf(dqp, &bp);
|
||||||
if (error)
|
if (error)
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
if (!bp) {
|
||||||
|
error = -EFSCORRUPTED;
|
||||||
|
goto out_unlock;
|
||||||
|
}
|
||||||
|
|
||||||
error = xfs_qm_dqflush(dqp, bp);
|
error = xfs_qm_dqflush(dqp, bp);
|
||||||
if (!error)
|
if (!error)
|
||||||
|
|
Loading…
Add table
Reference in a new issue