Skip to content

Commit ca37818

Browse files
author
Darrick J. Wong
committed
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: <[email protected]> # v6.12 Fixes: 903edea ("mm: warn about illegal __GFP_NOFAIL usage in a more appropriate location and manner") Signed-off-by: "Darrick J. Wong" <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent acc8f86 commit ca37818

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

fs/xfs/xfs_dquot.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,22 +1285,19 @@ xfs_qm_dqflush_check(
12851285
* Requires dquot flush lock, will clear the dirty flag, delete the quota log
12861286
* item from the AIL, and shut down the system if something goes wrong.
12871287
*/
1288-
int
1288+
static int
12891289
xfs_dquot_read_buf(
12901290
struct xfs_trans *tp,
12911291
struct xfs_dquot *dqp,
1292-
xfs_buf_flags_t xbf_flags,
12931292
struct xfs_buf **bpp)
12941293
{
12951294
struct xfs_mount *mp = dqp->q_mount;
12961295
struct xfs_buf *bp = NULL;
12971296
int error;
12981297

12991298
error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, dqp->q_blkno,
1300-
mp->m_quotainfo->qi_dqchunklen, xbf_flags,
1299+
mp->m_quotainfo->qi_dqchunklen, 0,
13011300
&bp, &xfs_dquot_buf_ops);
1302-
if (error == -EAGAIN)
1303-
return error;
13041301
if (xfs_metadata_is_sick(error))
13051302
xfs_dquot_mark_sick(dqp);
13061303
if (error)
@@ -1334,7 +1331,7 @@ xfs_dquot_attach_buf(
13341331
struct xfs_buf *bp = NULL;
13351332

13361333
spin_unlock(&qlip->qli_lock);
1337-
error = xfs_dquot_read_buf(tp, dqp, 0, &bp);
1334+
error = xfs_dquot_read_buf(tp, dqp, &bp);
13381335
if (error)
13391336
return error;
13401337

fs/xfs/xfs_dquot.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,6 @@ void xfs_dquot_to_disk(struct xfs_disk_dquot *ddqp, struct xfs_dquot *dqp);
214214
#define XFS_DQ_IS_DIRTY(dqp) ((dqp)->q_flags & XFS_DQFLAG_DIRTY)
215215

216216
void xfs_qm_dqdestroy(struct xfs_dquot *dqp);
217-
int xfs_dquot_read_buf(struct xfs_trans *tp, struct xfs_dquot *dqp,
218-
xfs_buf_flags_t flags, struct xfs_buf **bpp);
219217
int xfs_qm_dqflush(struct xfs_dquot *dqp, struct xfs_buf *bp);
220218
void xfs_qm_dqunpin_wait(struct xfs_dquot *dqp);
221219
void xfs_qm_adjust_dqtimers(struct xfs_dquot *d);

fs/xfs/xfs_qm.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,13 @@ xfs_qm_dqpurge(
148148
* We don't care about getting disk errors here. We need
149149
* to purge this dquot anyway, so we go ahead regardless.
150150
*/
151-
error = xfs_dquot_read_buf(NULL, dqp, XBF_TRYLOCK, &bp);
151+
error = xfs_dquot_use_attached_buf(dqp, &bp);
152152
if (error == -EAGAIN) {
153153
xfs_dqfunlock(dqp);
154154
dqp->q_flags &= ~XFS_DQFLAG_FREEING;
155155
goto out_unlock;
156156
}
157-
if (error)
157+
if (!bp)
158158
goto out_funlock;
159159

160160
/*
@@ -506,8 +506,8 @@ xfs_qm_dquot_isolate(
506506
/* we have to drop the LRU lock to flush the dquot */
507507
spin_unlock(&lru->lock);
508508

509-
error = xfs_dquot_read_buf(NULL, dqp, XBF_TRYLOCK, &bp);
510-
if (error) {
509+
error = xfs_dquot_use_attached_buf(dqp, &bp);
510+
if (!bp || error == -EAGAIN) {
511511
xfs_dqfunlock(dqp);
512512
goto out_unlock_dirty;
513513
}
@@ -1331,6 +1331,10 @@ xfs_qm_quotacheck_dqadjust(
13311331
return error;
13321332
}
13331333

1334+
error = xfs_dquot_attach_buf(NULL, dqp);
1335+
if (error)
1336+
return error;
1337+
13341338
trace_xfs_dqadjust(dqp);
13351339

13361340
/*
@@ -1513,9 +1517,13 @@ xfs_qm_flush_one(
15131517
goto out_unlock;
15141518
}
15151519

1516-
error = xfs_dquot_read_buf(NULL, dqp, XBF_TRYLOCK, &bp);
1520+
error = xfs_dquot_use_attached_buf(dqp, &bp);
15171521
if (error)
15181522
goto out_unlock;
1523+
if (!bp) {
1524+
error = -EFSCORRUPTED;
1525+
goto out_unlock;
1526+
}
15191527

15201528
error = xfs_qm_dqflush(dqp, bp);
15211529
if (!error)

0 commit comments

Comments
 (0)