Commit b84a3a96 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Ben Myers

xfs: remove the per-filesystem list of dquots

Instead of keeping a separate per-filesystem list of dquots we can walk
the radix tree for the two places where we need to iterate all quota
Reviewed-by: default avatarDave Chinner <>
Signed-off-by: default avatarChristoph Hellwig <>
Signed-off-by: default avatarBen Myers <>
parent 9f920f11
......@@ -44,10 +44,9 @@
* ip->i_lock
* qi->qi_tree_lock
* qi->qi_dqlist_lock
* dquot->q_qlock (xfs_dqlock() and friends)
* dquot->q_flush (xfs_dqflock() and friends)
* qi->qi_lru_lock
* dquot->q_qlock (xfs_dqlock() and friends)
* dquot->q_flush (xfs_dqflock() and friends)
* qi->qi_lru_lock
* If two dquots need to be locked the order is user before group/project,
* otherwise by the lowest id first, see xfs_dqlock2.
......@@ -728,21 +727,13 @@ xfs_qm_dqget(
goto restart;
* Attach this dquot to this filesystem's list of all dquots,
* kept inside the mount structure in m_quotainfo field
* We return a locked dquot to the caller, with a reference taken
dqp->q_nrefs = 1;
list_add(&dqp->q_mplist, &qi->qi_dqlist);
......@@ -1017,86 +1008,6 @@ xfs_dqlock2(
* Take a dquot out of the mount's dqlist as well as the hashlist. This is
* called via unmount as well as quotaoff, and the purge will always succeed.
struct xfs_dquot *dqp)
struct xfs_mount *mp = dqp->q_mount;
struct xfs_quotainfo *qi = mp->m_quotainfo;
* If we're turning off quotas, we have to make sure that, for
* example, we don't delete quota disk blocks while dquots are
* in the process of getting written to those disk blocks.
* This dquot might well be on AIL, and we can't leave it there
* if we're turning off quotas. Basically, we need this flush
* lock, and are willing to block on it.
if (!xfs_dqflock_nowait(dqp)) {
* Block on the flush lock after nudging dquot buffer,
* if it is incore.
* If we are turning this type of quotas off, we don't care
* about the dirty metadata sitting in this dquot. OTOH, if
* we're unmounting, we do care, so we flush it and wait.
if (XFS_DQ_IS_DIRTY(dqp)) {
int error;
* We don't care about getting disk errors here. We need
* to purge this dquot anyway, so we go ahead regardless.
error = xfs_qm_dqflush(dqp, SYNC_WAIT);
if (error)
xfs_warn(mp, "%s: dquot %p flush failed",
__func__, dqp);
ASSERT(atomic_read(&dqp->q_pincount) == 0);
!(dqp->q_logitem.qli_item.li_flags & XFS_LI_IN_AIL));
radix_tree_delete(XFS_DQUOT_TREE(qi, dqp->q_core.d_flags),
* We move dquots to the freelist as soon as their reference count
* hits zero, so it really should be on the freelist here.
* Give the buffer a little push if it is incore and
* wait on the flush lock.
......@@ -38,7 +38,6 @@ struct xfs_trans;
typedef struct xfs_dquot {
uint dq_flags; /* various flags (XFS_DQ_*) */
struct list_head q_lru; /* global free list of dquots */
struct list_head q_mplist; /* mount's list of dquots */
struct xfs_mount*q_mount; /* filesystem this relates to */
struct xfs_trans*q_transp; /* trans this belongs to currently */
uint q_nrefs; /* # active refs from inodes */
......@@ -143,7 +142,6 @@ extern int xfs_qm_dqread(struct xfs_mount *, xfs_dqid_t, uint,
uint, struct xfs_dquot **);
extern void xfs_qm_dqdestroy(xfs_dquot_t *);
extern int xfs_qm_dqflush(xfs_dquot_t *, uint);
extern void xfs_qm_dqpurge(xfs_dquot_t *);
extern void xfs_qm_dqunpin_wait(xfs_dquot_t *);
extern void xfs_qm_adjust_dqtimers(xfs_mount_t *,
xfs_disk_dquot_t *);
This diff is collapsed.
......@@ -63,11 +63,7 @@ typedef struct xfs_quotainfo {
struct list_head qi_lru_list;
struct mutex qi_lru_lock;
int qi_lru_count;
struct list_head qi_dqlist; /* all dquots in filesys */
struct mutex qi_dqlist_lock;
int qi_dquots;
int qi_dqreclaims; /* a change here indicates
a removal in the dqlist */
time_t qi_btimelimit; /* limit for blks timer */
time_t qi_itimelimit; /* limit for inodes timer */
time_t qi_rtbtimelimit;/* limit for rt blks timer */
......@@ -126,7 +122,7 @@ extern int xfs_qm_quotacheck(xfs_mount_t *);
extern int xfs_qm_write_sb_changes(xfs_mount_t *, __int64_t);
/* dquot stuff */
extern int xfs_qm_dqpurge_all(xfs_mount_t *, uint);
extern void xfs_qm_dqpurge_all(xfs_mount_t *, uint);
extern void xfs_qm_dqrele_all_inodes(xfs_mount_t *, uint);
/* quota ops */
......@@ -66,7 +66,6 @@ xfs_qm_scall_quotaoff(
int error;
uint inactivate_flags;
xfs_qoff_logitem_t *qoffstart;
int nculprits;
* No file system can have quotas enabled on disk but not in core.
......@@ -172,18 +171,13 @@ xfs_qm_scall_quotaoff(
* This isn't protected by a particular lock directly, because we
* don't want to take a mrlock every time we depend on quotas being on.
mp->m_qflags &= ~(flags);
mp->m_qflags &= ~flags;
* Go through all the dquots of this file system and purge them,
* according to what was turned off. We may not be able to get rid
* of all dquots, because dquots can have temporary references that
* are not attached to inodes. eg. xfs_setattr, xfs_create.
* So, if we couldn't purge all the dquots from the filesystem,
* we can't get rid of the incore data structures.
* according to what was turned off.
while ((nculprits = xfs_qm_dqpurge_all(mp, dqtype)))
delay(10 * nculprits);
xfs_qm_dqpurge_all(mp, dqtype);
* Transactions that had started before ACTIVE state bit was cleared
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment