xfs_qm.c (5885539f0af371024d07afd14974bfdc3fff84c5) xfs_qm.c (8d3d7e2b35ea7d91d6e085c93b5efecfb0fba307)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6#include "xfs.h"
7#include "xfs_fs.h"
8#include "xfs_shared.h"

--- 107 unchanged lines hidden (view full) ---

116 */
117STATIC int
118xfs_qm_dqpurge(
119 struct xfs_dquot *dqp,
120 void *data)
121{
122 struct xfs_mount *mp = dqp->q_mount;
123 struct xfs_quotainfo *qi = mp->m_quotainfo;
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6#include "xfs.h"
7#include "xfs_fs.h"
8#include "xfs_shared.h"

--- 107 unchanged lines hidden (view full) ---

116 */
117STATIC int
118xfs_qm_dqpurge(
119 struct xfs_dquot *dqp,
120 void *data)
121{
122 struct xfs_mount *mp = dqp->q_mount;
123 struct xfs_quotainfo *qi = mp->m_quotainfo;
124 int error = -EAGAIN;
124
125 xfs_dqlock(dqp);
125
126 xfs_dqlock(dqp);
126 if ((dqp->dq_flags & XFS_DQ_FREEING) || dqp->q_nrefs != 0) {
127 xfs_dqunlock(dqp);
128 return -EAGAIN;
129 }
127 if ((dqp->dq_flags & XFS_DQ_FREEING) || dqp->q_nrefs != 0)
128 goto out_unlock;
130
131 dqp->dq_flags |= XFS_DQ_FREEING;
132
133 xfs_dqflock(dqp);
134
135 /*
136 * If we are turning this type of quotas off, we don't care
137 * about the dirty metadata sitting in this dquot. OTOH, if
138 * we're unmounting, we do care, so we flush it and wait.
139 */
140 if (XFS_DQ_IS_DIRTY(dqp)) {
141 struct xfs_buf *bp = NULL;
129
130 dqp->dq_flags |= XFS_DQ_FREEING;
131
132 xfs_dqflock(dqp);
133
134 /*
135 * If we are turning this type of quotas off, we don't care
136 * about the dirty metadata sitting in this dquot. OTOH, if
137 * we're unmounting, we do care, so we flush it and wait.
138 */
139 if (XFS_DQ_IS_DIRTY(dqp)) {
140 struct xfs_buf *bp = NULL;
142 int error;
143
144 /*
145 * We don't care about getting disk errors here. We need
146 * to purge this dquot anyway, so we go ahead regardless.
147 */
148 error = xfs_qm_dqflush(dqp, &bp);
149 if (!error) {
150 error = xfs_bwrite(bp);
151 xfs_buf_relse(bp);
141
142 /*
143 * We don't care about getting disk errors here. We need
144 * to purge this dquot anyway, so we go ahead regardless.
145 */
146 error = xfs_qm_dqflush(dqp, &bp);
147 if (!error) {
148 error = xfs_bwrite(bp);
149 xfs_buf_relse(bp);
150 } else if (error == -EAGAIN) {
151 goto out_unlock;
152 }
153 xfs_dqflock(dqp);
154 }
155
156 ASSERT(atomic_read(&dqp->q_pincount) == 0);
157 ASSERT(XFS_FORCED_SHUTDOWN(mp) ||
158 !test_bit(XFS_LI_IN_AIL, &dqp->q_logitem.qli_item.li_flags));
159

--- 9 unchanged lines hidden (view full) ---

169 * hits zero, so it really should be on the freelist here.
170 */
171 ASSERT(!list_empty(&dqp->q_lru));
172 list_lru_del(&qi->qi_lru, &dqp->q_lru);
173 XFS_STATS_DEC(mp, xs_qm_dquot_unused);
174
175 xfs_qm_dqdestroy(dqp);
176 return 0;
152 }
153 xfs_dqflock(dqp);
154 }
155
156 ASSERT(atomic_read(&dqp->q_pincount) == 0);
157 ASSERT(XFS_FORCED_SHUTDOWN(mp) ||
158 !test_bit(XFS_LI_IN_AIL, &dqp->q_logitem.qli_item.li_flags));
159

--- 9 unchanged lines hidden (view full) ---

169 * hits zero, so it really should be on the freelist here.
170 */
171 ASSERT(!list_empty(&dqp->q_lru));
172 list_lru_del(&qi->qi_lru, &dqp->q_lru);
173 XFS_STATS_DEC(mp, xs_qm_dquot_unused);
174
175 xfs_qm_dqdestroy(dqp);
176 return 0;
177
178out_unlock:
179 xfs_dqunlock(dqp);
180 return error;
177}
178
179/*
180 * Purge the dquot cache.
181 */
182void
183xfs_qm_dqpurge_all(
184 struct xfs_mount *mp,

--- 1771 unchanged lines hidden ---
181}
182
183/*
184 * Purge the dquot cache.
185 */
186void
187xfs_qm_dqpurge_all(
188 struct xfs_mount *mp,

--- 1771 unchanged lines hidden ---