xfs: per-filesystem stats counter implementation
This patch modifies the stats counting macros and the callers to those macros to properly increment, decrement, and add-to the xfs stats counts. The counts for global and per-fs stats are correctly advanced, and cleared by writing a "1" to the corresponding clear file. global counts: /sys/fs/xfs/stats/stats per-fs counts: /sys/fs/xfs/sda*/stats/stats global clear: /sys/fs/xfs/stats/stats_clear per-fs clear: /sys/fs/xfs/sda*/stats/stats_clear [dchinner: cleaned up macro variables, removed CONFIG_FS_PROC around stats structures and macros. ] Signed-off-by: Bill O'Donnell <billodo@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:

committed by
Dave Chinner

parent
225e463558
commit
ff6d6af235
@@ -201,7 +201,7 @@ _xfs_buf_alloc(
|
||||
atomic_set(&bp->b_pin_count, 0);
|
||||
init_waitqueue_head(&bp->b_waiters);
|
||||
|
||||
XFS_STATS_INC(xb_create);
|
||||
XFS_STATS_INC(target->bt_mount, xb_create);
|
||||
trace_xfs_buf_init(bp, _RET_IP_);
|
||||
|
||||
return bp;
|
||||
@@ -357,12 +357,12 @@ retry:
|
||||
"possible memory allocation deadlock in %s (mode:0x%x)",
|
||||
__func__, gfp_mask);
|
||||
|
||||
XFS_STATS_INC(xb_page_retries);
|
||||
XFS_STATS_INC(bp->b_target->bt_mount, xb_page_retries);
|
||||
congestion_wait(BLK_RW_ASYNC, HZ/50);
|
||||
goto retry;
|
||||
}
|
||||
|
||||
XFS_STATS_INC(xb_page_found);
|
||||
XFS_STATS_INC(bp->b_target->bt_mount, xb_page_found);
|
||||
|
||||
nbytes = min_t(size_t, size, PAGE_SIZE - offset);
|
||||
size -= nbytes;
|
||||
@@ -516,7 +516,7 @@ _xfs_buf_find(
|
||||
new_bp->b_pag = pag;
|
||||
spin_unlock(&pag->pag_buf_lock);
|
||||
} else {
|
||||
XFS_STATS_INC(xb_miss_locked);
|
||||
XFS_STATS_INC(btp->bt_mount, xb_miss_locked);
|
||||
spin_unlock(&pag->pag_buf_lock);
|
||||
xfs_perag_put(pag);
|
||||
}
|
||||
@@ -529,11 +529,11 @@ found:
|
||||
if (!xfs_buf_trylock(bp)) {
|
||||
if (flags & XBF_TRYLOCK) {
|
||||
xfs_buf_rele(bp);
|
||||
XFS_STATS_INC(xb_busy_locked);
|
||||
XFS_STATS_INC(btp->bt_mount, xb_busy_locked);
|
||||
return NULL;
|
||||
}
|
||||
xfs_buf_lock(bp);
|
||||
XFS_STATS_INC(xb_get_locked_waited);
|
||||
XFS_STATS_INC(btp->bt_mount, xb_get_locked_waited);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -549,7 +549,7 @@ found:
|
||||
}
|
||||
|
||||
trace_xfs_buf_find(bp, flags, _RET_IP_);
|
||||
XFS_STATS_INC(xb_get_locked);
|
||||
XFS_STATS_INC(btp->bt_mount, xb_get_locked);
|
||||
return bp;
|
||||
}
|
||||
|
||||
@@ -603,7 +603,7 @@ found:
|
||||
}
|
||||
}
|
||||
|
||||
XFS_STATS_INC(xb_get);
|
||||
XFS_STATS_INC(target->bt_mount, xb_get);
|
||||
trace_xfs_buf_get(bp, flags, _RET_IP_);
|
||||
return bp;
|
||||
}
|
||||
@@ -643,7 +643,7 @@ xfs_buf_read_map(
|
||||
trace_xfs_buf_read(bp, flags, _RET_IP_);
|
||||
|
||||
if (!XFS_BUF_ISDONE(bp)) {
|
||||
XFS_STATS_INC(xb_get_read);
|
||||
XFS_STATS_INC(target->bt_mount, xb_get_read);
|
||||
bp->b_ops = ops;
|
||||
_xfs_buf_read(bp, flags);
|
||||
} else if (flags & XBF_ASYNC) {
|
||||
|
Reference in New Issue
Block a user