Skip to content

Commit

Permalink
xfs: use common code for quota statistics
Browse files Browse the repository at this point in the history
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: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
  • Loading branch information
Christoph Hellwig authored and Ben Myers committed Mar 14, 2012
1 parent 8f639dd commit 48776fd
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 187 deletions.
3 changes: 0 additions & 3 deletions fs/xfs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions fs/xfs/xfs_dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/*
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
9 changes: 5 additions & 4 deletions fs/xfs/xfs_qm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions fs/xfs/xfs_qm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down
2 changes: 0 additions & 2 deletions fs/xfs/xfs_qm_bhv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
105 changes: 0 additions & 105 deletions fs/xfs/xfs_qm_stats.c

This file was deleted.

53 changes: 0 additions & 53 deletions fs/xfs/xfs_qm_stats.h

This file was deleted.

Loading

0 comments on commit 48776fd

Please sign in to comment.