Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 48776fd2 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Ben Myers
Browse files

xfs: use common code for quota statistics



Switch the quota code over to use the generic XFS statistics infrastructure.
While the legacy /proc/fs/xfs/xqm and /proc/fs/xfs/xqmstats interfaces are
preserved for now the statistics that still have a meaning with the current
code are now also available from /proc/fs/xfs/stats.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent 8f639dde
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -96,9 +96,6 @@ xfs-$(CONFIG_XFS_QUOTA) += xfs_dquot.o \
				   xfs_qm_bhv.o \
				   xfs_qm.o \
				   xfs_quotaops.o
ifeq ($(CONFIG_XFS_QUOTA),y)
xfs-$(CONFIG_PROC_FS)		+= xfs_qm_stats.o
endif
xfs-$(CONFIG_XFS_RT)		+= xfs_rtalloc.o
xfs-$(CONFIG_XFS_POSIX_ACL)	+= xfs_acl.o
xfs-$(CONFIG_PROC_FS)		+= xfs_stats.o
+8 −6
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ xfs_qm_dqdestroy(
	mutex_destroy(&dqp->q_qlock);
	kmem_zone_free(xfs_Gqm->qm_dqzone, dqp);

	atomic_dec(&xfs_Gqm->qm_totaldquots);
	XFS_STATS_DEC(xs_qm_dquot);
}

/*
@@ -516,7 +516,7 @@ xfs_qm_dqread(
	if (!(type & XFS_DQ_USER))
		lockdep_set_class(&dqp->q_qlock, &xfs_dquot_other_class);

	atomic_inc(&xfs_Gqm->qm_totaldquots);
	XFS_STATS_INC(xs_qm_dquot);

	trace_xfs_dqread(dqp);

@@ -712,12 +712,12 @@ xfs_qm_dqget(
	 */
	switch (xfs_qm_dqlookup(mp, id, h, O_dqpp)) {
	case -1:
		XQM_STATS_INC(xqmstats.xs_qm_dquot_dups);
		XFS_STATS_INC(xs_qm_dquot_dups);
		mutex_unlock(&h->qh_lock);
		delay(1);
		goto restart;
	case 0:
		XQM_STATS_INC(xqmstats.xs_qm_dqcachehits);
		XFS_STATS_INC(xs_qm_dqcachehits);
		/*
		 * The dquot was found, moved to the front of the chain,
		 * taken off the freelist if it was on it, and locked
@@ -729,7 +729,7 @@ xfs_qm_dqget(
		trace_xfs_dqget_hit(*O_dqpp);
		return 0;	/* success */
	default:
		XQM_STATS_INC(xqmstats.xs_qm_dqcachemisses);
		XFS_STATS_INC(xs_qm_dqcachemisses);
		break;
	}

@@ -804,7 +804,7 @@ xfs_qm_dqget(
				xfs_qm_dqput(tmpdqp);
			mutex_unlock(&h->qh_lock);
			xfs_qm_dqdestroy(dqp);
			XQM_STATS_INC(xqmstats.xs_qm_dquot_dups);
			XFS_STATS_INC(xs_qm_dquot_dups);
			goto restart;
		default:
			break;
@@ -873,6 +873,7 @@ xfs_qm_dqput(
	if (list_empty(&dqp->q_freelist)) {
		list_add_tail(&dqp->q_freelist, &xfs_Gqm->qm_dqfrlist);
		xfs_Gqm->qm_dqfrlist_cnt++;
		XFS_STATS_INC(xs_qm_dquot_unused);
	}
	mutex_unlock(&xfs_Gqm->qm_dqfrlist_lock);

@@ -1178,6 +1179,7 @@ xfs_qm_dqpurge(
	ASSERT(!list_empty(&dqp->q_freelist));
	list_del_init(&dqp->q_freelist);
	xfs_Gqm->qm_dqfrlist_cnt--;
	XFS_STATS_DEC(xs_qm_dquot_unused);
	mutex_unlock(&xfs_Gqm->qm_dqfrlist_lock);

	xfs_qm_dqdestroy(dqp);
+5 −4
Original line number Diff line number Diff line
@@ -134,7 +134,6 @@ xfs_Gqm_init(void)
	} else
		xqm->qm_dqtrxzone = qm_dqtrxzone;

	atomic_set(&xqm->qm_totaldquots, 0);
	xqm->qm_nrefs = 0;
	return xqm;

@@ -1637,10 +1636,11 @@ xfs_qm_dqreclaim_one(
		xfs_dqunlock(dqp);

		trace_xfs_dqreclaim_want(dqp);
		XQM_STATS_INC(xqmstats.xs_qm_dqwants);
		XFS_STATS_INC(xs_qm_dqwants);

		list_del_init(&dqp->q_freelist);
		xfs_Gqm->qm_dqfrlist_cnt--;
		XFS_STATS_DEC(xs_qm_dquot_unused);
		return;
	}

@@ -1690,9 +1690,10 @@ xfs_qm_dqreclaim_one(
	ASSERT(dqp->q_nrefs == 0);
	list_move_tail(&dqp->q_freelist, dispose_list);
	xfs_Gqm->qm_dqfrlist_cnt--;
	XFS_STATS_DEC(xs_qm_dquot_unused);

	trace_xfs_dqreclaim_done(dqp);
	XQM_STATS_INC(xqmstats.xs_qm_dqreclaims);
	XFS_STATS_INC(xs_qm_dqreclaims);
	return;

out_busy:
@@ -1704,7 +1705,7 @@ xfs_qm_dqreclaim_one(
	list_move_tail(&dqp->q_freelist, &xfs_Gqm->qm_dqfrlist);

	trace_xfs_dqreclaim_busy(dqp);
	XQM_STATS_INC(xqmstats.xs_qm_dqreclaim_misses);
	XFS_STATS_INC(xs_qm_dqreclaim_misses);
}

STATIC int
+0 −2
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@
#include "xfs_dquot_item.h"
#include "xfs_dquot.h"
#include "xfs_quota_priv.h"
#include "xfs_qm_stats.h"

struct xfs_qm;
struct xfs_inode;
@@ -60,7 +59,6 @@ typedef struct xfs_qm {
	struct list_head qm_dqfrlist;	 /* freelist of dquots */
	struct mutex	 qm_dqfrlist_lock;
	int		 qm_dqfrlist_cnt;
	atomic_t	 qm_totaldquots; /* total incore dquots */
	uint		 qm_nrefs;	 /* file systems with quota on */
	kmem_zone_t	*qm_dqzone;	 /* dquot mem-alloc zone */
	kmem_zone_t	*qm_dqtrxzone;	 /* t_dqinfo of transactions */
+0 −2
Original line number Diff line number Diff line
@@ -162,13 +162,11 @@ xfs_qm_init(void)
{
	printk(KERN_INFO "SGI XFS Quota Management subsystem\n");
	mutex_init(&xfs_Gqm_lock);
	xfs_qm_init_procfs();
}

void __exit
xfs_qm_exit(void)
{
	xfs_qm_cleanup_procfs();
	if (qm_dqzone)
		kmem_zone_destroy(qm_dqzone);
	if (qm_dqtrxzone)
Loading