diff options
author | Bill O'Donnell <billodo@redhat.com> | 2015-10-12 03:21:22 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2015-10-12 03:21:22 -0400 |
commit | ff6d6af2351caea7db681f4539d0d893e400557a (patch) | |
tree | 2e3d1d4a57a478183edf6e55a0c257a36a9fee04 | |
parent | 225e4635580ce9fb12f8a2dc88473161cd64dbf6 (diff) |
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>
-rw-r--r-- | fs/xfs/libxfs/xfs_alloc.c | 8 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_attr.c | 6 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 20 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_btree.h | 39 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_dir2.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_attr_list.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_buf.c | 18 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_readdir.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_dquot.c | 14 | ||||
-rw-r--r-- | fs/xfs/xfs_file.c | 12 | ||||
-rw-r--r-- | fs/xfs/xfs_icache.c | 18 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_ioctl.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_iomap.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_iops.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_log.c | 22 | ||||
-rw-r--r-- | fs/xfs/xfs_qm.c | 14 | ||||
-rw-r--r-- | fs/xfs/xfs_stats.h | 28 | ||||
-rw-r--r-- | fs/xfs/xfs_super.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_trans.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_trans_ail.c | 12 |
21 files changed, 131 insertions, 118 deletions
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c index ffad7f20342f..9b5da7e3b5c2 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c | |||
@@ -651,8 +651,8 @@ xfs_alloc_ag_vextent( | |||
651 | -((long)(args->len))); | 651 | -((long)(args->len))); |
652 | } | 652 | } |
653 | 653 | ||
654 | XFS_STATS_INC(xs_allocx); | 654 | XFS_STATS_INC(args->mp, xs_allocx); |
655 | XFS_STATS_ADD(xs_allocb, args->len); | 655 | XFS_STATS_ADD(args->mp, xs_allocb, args->len); |
656 | return error; | 656 | return error; |
657 | } | 657 | } |
658 | 658 | ||
@@ -1808,8 +1808,8 @@ xfs_free_ag_extent( | |||
1808 | 1808 | ||
1809 | if (!isfl) | 1809 | if (!isfl) |
1810 | xfs_trans_mod_sb(tp, XFS_TRANS_SB_FDBLOCKS, (long)len); | 1810 | xfs_trans_mod_sb(tp, XFS_TRANS_SB_FDBLOCKS, (long)len); |
1811 | XFS_STATS_INC(xs_freex); | 1811 | XFS_STATS_INC(mp, xs_freex); |
1812 | XFS_STATS_ADD(xs_freeb, len); | 1812 | XFS_STATS_ADD(mp, xs_freeb, len); |
1813 | 1813 | ||
1814 | trace_xfs_free_extent(mp, agno, bno, len, isfl, haveleft, haveright); | 1814 | trace_xfs_free_extent(mp, agno, bno, len, isfl, haveleft, haveright); |
1815 | 1815 | ||
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index ff065578969f..f949818fa1c7 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c | |||
@@ -125,7 +125,7 @@ xfs_attr_get( | |||
125 | uint lock_mode; | 125 | uint lock_mode; |
126 | int error; | 126 | int error; |
127 | 127 | ||
128 | XFS_STATS_INC(xs_attr_get); | 128 | XFS_STATS_INC(ip->i_mount, xs_attr_get); |
129 | 129 | ||
130 | if (XFS_FORCED_SHUTDOWN(ip->i_mount)) | 130 | if (XFS_FORCED_SHUTDOWN(ip->i_mount)) |
131 | return -EIO; | 131 | return -EIO; |
@@ -209,7 +209,7 @@ xfs_attr_set( | |||
209 | int rsvd = (flags & ATTR_ROOT) != 0; | 209 | int rsvd = (flags & ATTR_ROOT) != 0; |
210 | int error, err2, committed, local; | 210 | int error, err2, committed, local; |
211 | 211 | ||
212 | XFS_STATS_INC(xs_attr_set); | 212 | XFS_STATS_INC(mp, xs_attr_set); |
213 | 213 | ||
214 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) | 214 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) |
215 | return -EIO; | 215 | return -EIO; |
@@ -412,7 +412,7 @@ xfs_attr_remove( | |||
412 | xfs_fsblock_t firstblock; | 412 | xfs_fsblock_t firstblock; |
413 | int error; | 413 | int error; |
414 | 414 | ||
415 | XFS_STATS_INC(xs_attr_remove); | 415 | XFS_STATS_INC(mp, xs_attr_remove); |
416 | 416 | ||
417 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) | 417 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) |
418 | return -EIO; | 418 | return -EIO; |
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 8e2010d53b07..5256fe59623b 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c | |||
@@ -1435,7 +1435,7 @@ xfs_bmap_search_extents( | |||
1435 | xfs_ifork_t *ifp; /* inode fork pointer */ | 1435 | xfs_ifork_t *ifp; /* inode fork pointer */ |
1436 | xfs_bmbt_rec_host_t *ep; /* extent record pointer */ | 1436 | xfs_bmbt_rec_host_t *ep; /* extent record pointer */ |
1437 | 1437 | ||
1438 | XFS_STATS_INC(xs_look_exlist); | 1438 | XFS_STATS_INC(ip->i_mount, xs_look_exlist); |
1439 | ifp = XFS_IFORK_PTR(ip, fork); | 1439 | ifp = XFS_IFORK_PTR(ip, fork); |
1440 | 1440 | ||
1441 | ep = xfs_bmap_search_multi_extents(ifp, bno, eofp, lastxp, gotp, prevp); | 1441 | ep = xfs_bmap_search_multi_extents(ifp, bno, eofp, lastxp, gotp, prevp); |
@@ -1732,7 +1732,7 @@ xfs_bmap_add_extent_delay_real( | |||
1732 | ASSERT(!bma->cur || | 1732 | ASSERT(!bma->cur || |
1733 | (bma->cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL)); | 1733 | (bma->cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL)); |
1734 | 1734 | ||
1735 | XFS_STATS_INC(xs_add_exlist); | 1735 | XFS_STATS_INC(mp, xs_add_exlist); |
1736 | 1736 | ||
1737 | #define LEFT r[0] | 1737 | #define LEFT r[0] |
1738 | #define RIGHT r[1] | 1738 | #define RIGHT r[1] |
@@ -2286,7 +2286,7 @@ xfs_bmap_add_extent_unwritten_real( | |||
2286 | ASSERT(*idx <= ifp->if_bytes / sizeof(struct xfs_bmbt_rec)); | 2286 | ASSERT(*idx <= ifp->if_bytes / sizeof(struct xfs_bmbt_rec)); |
2287 | ASSERT(!isnullstartblock(new->br_startblock)); | 2287 | ASSERT(!isnullstartblock(new->br_startblock)); |
2288 | 2288 | ||
2289 | XFS_STATS_INC(xs_add_exlist); | 2289 | XFS_STATS_INC(mp, xs_add_exlist); |
2290 | 2290 | ||
2291 | #define LEFT r[0] | 2291 | #define LEFT r[0] |
2292 | #define RIGHT r[1] | 2292 | #define RIGHT r[1] |
@@ -2946,7 +2946,7 @@ xfs_bmap_add_extent_hole_real( | |||
2946 | ASSERT(!bma->cur || | 2946 | ASSERT(!bma->cur || |
2947 | !(bma->cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL)); | 2947 | !(bma->cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL)); |
2948 | 2948 | ||
2949 | XFS_STATS_INC(xs_add_exlist); | 2949 | XFS_STATS_INC(mp, xs_add_exlist); |
2950 | 2950 | ||
2951 | state = 0; | 2951 | state = 0; |
2952 | if (whichfork == XFS_ATTR_FORK) | 2952 | if (whichfork == XFS_ATTR_FORK) |
@@ -4036,7 +4036,7 @@ xfs_bmapi_read( | |||
4036 | if (XFS_FORCED_SHUTDOWN(mp)) | 4036 | if (XFS_FORCED_SHUTDOWN(mp)) |
4037 | return -EIO; | 4037 | return -EIO; |
4038 | 4038 | ||
4039 | XFS_STATS_INC(xs_blk_mapr); | 4039 | XFS_STATS_INC(mp, xs_blk_mapr); |
4040 | 4040 | ||
4041 | ifp = XFS_IFORK_PTR(ip, whichfork); | 4041 | ifp = XFS_IFORK_PTR(ip, whichfork); |
4042 | 4042 | ||
@@ -4221,7 +4221,7 @@ xfs_bmapi_delay( | |||
4221 | if (XFS_FORCED_SHUTDOWN(mp)) | 4221 | if (XFS_FORCED_SHUTDOWN(mp)) |
4222 | return -EIO; | 4222 | return -EIO; |
4223 | 4223 | ||
4224 | XFS_STATS_INC(xs_blk_mapw); | 4224 | XFS_STATS_INC(mp, xs_blk_mapw); |
4225 | 4225 | ||
4226 | if (!(ifp->if_flags & XFS_IFEXTENTS)) { | 4226 | if (!(ifp->if_flags & XFS_IFEXTENTS)) { |
4227 | error = xfs_iread_extents(NULL, ip, XFS_DATA_FORK); | 4227 | error = xfs_iread_extents(NULL, ip, XFS_DATA_FORK); |
@@ -4525,7 +4525,7 @@ xfs_bmapi_write( | |||
4525 | 4525 | ||
4526 | ifp = XFS_IFORK_PTR(ip, whichfork); | 4526 | ifp = XFS_IFORK_PTR(ip, whichfork); |
4527 | 4527 | ||
4528 | XFS_STATS_INC(xs_blk_mapw); | 4528 | XFS_STATS_INC(mp, xs_blk_mapw); |
4529 | 4529 | ||
4530 | if (*firstblock == NULLFSBLOCK) { | 4530 | if (*firstblock == NULLFSBLOCK) { |
4531 | if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE) | 4531 | if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE) |
@@ -4718,12 +4718,12 @@ xfs_bmap_del_extent( | |||
4718 | xfs_filblks_t temp2; /* for indirect length calculations */ | 4718 | xfs_filblks_t temp2; /* for indirect length calculations */ |
4719 | int state = 0; | 4719 | int state = 0; |
4720 | 4720 | ||
4721 | XFS_STATS_INC(xs_del_exlist); | 4721 | mp = ip->i_mount; |
4722 | XFS_STATS_INC(mp, xs_del_exlist); | ||
4722 | 4723 | ||
4723 | if (whichfork == XFS_ATTR_FORK) | 4724 | if (whichfork == XFS_ATTR_FORK) |
4724 | state |= BMAP_ATTRFORK; | 4725 | state |= BMAP_ATTRFORK; |
4725 | 4726 | ||
4726 | mp = ip->i_mount; | ||
4727 | ifp = XFS_IFORK_PTR(ip, whichfork); | 4727 | ifp = XFS_IFORK_PTR(ip, whichfork); |
4728 | ASSERT((*idx >= 0) && (*idx < ifp->if_bytes / | 4728 | ASSERT((*idx >= 0) && (*idx < ifp->if_bytes / |
4729 | (uint)sizeof(xfs_bmbt_rec_t))); | 4729 | (uint)sizeof(xfs_bmbt_rec_t))); |
@@ -5070,7 +5070,7 @@ xfs_bunmapi( | |||
5070 | *done = 1; | 5070 | *done = 1; |
5071 | return 0; | 5071 | return 0; |
5072 | } | 5072 | } |
5073 | XFS_STATS_INC(xs_blk_unmap); | 5073 | XFS_STATS_INC(mp, xs_blk_unmap); |
5074 | isrt = (whichfork == XFS_DATA_FORK) && XFS_IS_REALTIME_INODE(ip); | 5074 | isrt = (whichfork == XFS_DATA_FORK) && XFS_IS_REALTIME_INODE(ip); |
5075 | start = bno; | 5075 | start = bno; |
5076 | bno = start + len - 1; | 5076 | bno = start + len - 1; |
diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h index 8f18bab73ea5..992dec0638f3 100644 --- a/fs/xfs/libxfs/xfs_btree.h +++ b/fs/xfs/libxfs/xfs_btree.h | |||
@@ -84,31 +84,38 @@ union xfs_btree_rec { | |||
84 | /* | 84 | /* |
85 | * Generic stats interface | 85 | * Generic stats interface |
86 | */ | 86 | */ |
87 | #define __XFS_BTREE_STATS_INC(type, stat) \ | 87 | #define __XFS_BTREE_STATS_INC(mp, type, stat) \ |
88 | XFS_STATS_INC(xs_ ## type ## _2_ ## stat) | 88 | XFS_STATS_INC(mp, xs_ ## type ## _2_ ## stat) |
89 | #define XFS_BTREE_STATS_INC(cur, stat) \ | 89 | #define XFS_BTREE_STATS_INC(cur, stat) \ |
90 | do { \ | 90 | do { \ |
91 | struct xfs_mount *__mp = cur->bc_mp; \ | ||
91 | switch (cur->bc_btnum) { \ | 92 | switch (cur->bc_btnum) { \ |
92 | case XFS_BTNUM_BNO: __XFS_BTREE_STATS_INC(abtb, stat); break; \ | 93 | case XFS_BTNUM_BNO: __XFS_BTREE_STATS_INC(__mp, abtb, stat); break; \ |
93 | case XFS_BTNUM_CNT: __XFS_BTREE_STATS_INC(abtc, stat); break; \ | 94 | case XFS_BTNUM_CNT: __XFS_BTREE_STATS_INC(__mp, abtc, stat); break; \ |
94 | case XFS_BTNUM_BMAP: __XFS_BTREE_STATS_INC(bmbt, stat); break; \ | 95 | case XFS_BTNUM_BMAP: __XFS_BTREE_STATS_INC(__mp, bmbt, stat); break; \ |
95 | case XFS_BTNUM_INO: __XFS_BTREE_STATS_INC(ibt, stat); break; \ | 96 | case XFS_BTNUM_INO: __XFS_BTREE_STATS_INC(__mp, ibt, stat); break; \ |
96 | case XFS_BTNUM_FINO: __XFS_BTREE_STATS_INC(fibt, stat); break; \ | 97 | case XFS_BTNUM_FINO: __XFS_BTREE_STATS_INC(__mp, fibt, stat); break; \ |
97 | case XFS_BTNUM_MAX: ASSERT(0); /* fucking gcc */ ; break; \ | 98 | case XFS_BTNUM_MAX: ASSERT(0); /* fucking gcc */ ; break; \ |
98 | } \ | 99 | } \ |
99 | } while (0) | 100 | } while (0) |
100 | 101 | ||
101 | #define __XFS_BTREE_STATS_ADD(type, stat, val) \ | 102 | #define __XFS_BTREE_STATS_ADD(mp, type, stat, val) \ |
102 | XFS_STATS_ADD(xs_ ## type ## _2_ ## stat, val) | 103 | XFS_STATS_ADD(mp, xs_ ## type ## _2_ ## stat, val) |
103 | #define XFS_BTREE_STATS_ADD(cur, stat, val) \ | 104 | #define XFS_BTREE_STATS_ADD(cur, stat, val) \ |
104 | do { \ | 105 | do { \ |
106 | struct xfs_mount *__mp = cur->bc_mp; \ | ||
105 | switch (cur->bc_btnum) { \ | 107 | switch (cur->bc_btnum) { \ |
106 | case XFS_BTNUM_BNO: __XFS_BTREE_STATS_ADD(abtb, stat, val); break; \ | 108 | case XFS_BTNUM_BNO: \ |
107 | case XFS_BTNUM_CNT: __XFS_BTREE_STATS_ADD(abtc, stat, val); break; \ | 109 | __XFS_BTREE_STATS_ADD(__mp, abtb, stat, val); break; \ |
108 | case XFS_BTNUM_BMAP: __XFS_BTREE_STATS_ADD(bmbt, stat, val); break; \ | 110 | case XFS_BTNUM_CNT: \ |
109 | case XFS_BTNUM_INO: __XFS_BTREE_STATS_ADD(ibt, stat, val); break; \ | 111 | __XFS_BTREE_STATS_ADD(__mp, abtc, stat, val); break; \ |
110 | case XFS_BTNUM_FINO: __XFS_BTREE_STATS_ADD(fibt, stat, val); break; \ | 112 | case XFS_BTNUM_BMAP: \ |
111 | case XFS_BTNUM_MAX: ASSERT(0); /* fucking gcc */ ; break; \ | 113 | __XFS_BTREE_STATS_ADD(__mp, bmbt, stat, val); break; \ |
114 | case XFS_BTNUM_INO: \ | ||
115 | __XFS_BTREE_STATS_ADD(__mp, ibt, stat, val); break; \ | ||
116 | case XFS_BTNUM_FINO: \ | ||
117 | __XFS_BTREE_STATS_ADD(__mp, fibt, stat, val); break; \ | ||
118 | case XFS_BTNUM_MAX: ASSERT(0); /* fucking gcc */ ; break; \ | ||
112 | } \ | 119 | } \ |
113 | } while (0) | 120 | } while (0) |
114 | 121 | ||
diff --git a/fs/xfs/libxfs/xfs_dir2.c b/fs/xfs/libxfs/xfs_dir2.c index 9de401d297e5..2fb53a5c0a74 100644 --- a/fs/xfs/libxfs/xfs_dir2.c +++ b/fs/xfs/libxfs/xfs_dir2.c | |||
@@ -271,7 +271,7 @@ xfs_dir_createname( | |||
271 | rval = xfs_dir_ino_validate(tp->t_mountp, inum); | 271 | rval = xfs_dir_ino_validate(tp->t_mountp, inum); |
272 | if (rval) | 272 | if (rval) |
273 | return rval; | 273 | return rval; |
274 | XFS_STATS_INC(xs_dir_create); | 274 | XFS_STATS_INC(dp->i_mount, xs_dir_create); |
275 | } | 275 | } |
276 | 276 | ||
277 | args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS); | 277 | args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS); |
@@ -365,7 +365,7 @@ xfs_dir_lookup( | |||
365 | int lock_mode; | 365 | int lock_mode; |
366 | 366 | ||
367 | ASSERT(S_ISDIR(dp->i_d.di_mode)); | 367 | ASSERT(S_ISDIR(dp->i_d.di_mode)); |
368 | XFS_STATS_INC(xs_dir_lookup); | 368 | XFS_STATS_INC(dp->i_mount, xs_dir_lookup); |
369 | 369 | ||
370 | /* | 370 | /* |
371 | * We need to use KM_NOFS here so that lockdep will not throw false | 371 | * We need to use KM_NOFS here so that lockdep will not throw false |
@@ -444,7 +444,7 @@ xfs_dir_removename( | |||
444 | int v; /* type-checking value */ | 444 | int v; /* type-checking value */ |
445 | 445 | ||
446 | ASSERT(S_ISDIR(dp->i_d.di_mode)); | 446 | ASSERT(S_ISDIR(dp->i_d.di_mode)); |
447 | XFS_STATS_INC(xs_dir_remove); | 447 | XFS_STATS_INC(dp->i_mount, xs_dir_remove); |
448 | 448 | ||
449 | args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS); | 449 | args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS); |
450 | if (!args) | 450 | if (!args) |
diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c index 65fb37a18e92..0ef7c2ed3f8a 100644 --- a/fs/xfs/xfs_attr_list.c +++ b/fs/xfs/xfs_attr_list.c | |||
@@ -511,7 +511,7 @@ xfs_attr_list_int( | |||
511 | xfs_inode_t *dp = context->dp; | 511 | xfs_inode_t *dp = context->dp; |
512 | uint lock_mode; | 512 | uint lock_mode; |
513 | 513 | ||
514 | XFS_STATS_INC(xs_attr_list); | 514 | XFS_STATS_INC(dp->i_mount, xs_attr_list); |
515 | 515 | ||
516 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) | 516 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) |
517 | return -EIO; | 517 | return -EIO; |
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 8ecffb35935b..90815c22b22d 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c | |||
@@ -201,7 +201,7 @@ _xfs_buf_alloc( | |||
201 | atomic_set(&bp->b_pin_count, 0); | 201 | atomic_set(&bp->b_pin_count, 0); |
202 | init_waitqueue_head(&bp->b_waiters); | 202 | init_waitqueue_head(&bp->b_waiters); |
203 | 203 | ||
204 | XFS_STATS_INC(xb_create); | 204 | XFS_STATS_INC(target->bt_mount, xb_create); |
205 | trace_xfs_buf_init(bp, _RET_IP_); | 205 | trace_xfs_buf_init(bp, _RET_IP_); |
206 | 206 | ||
207 | return bp; | 207 | return bp; |
@@ -357,12 +357,12 @@ retry: | |||
357 | "possible memory allocation deadlock in %s (mode:0x%x)", | 357 | "possible memory allocation deadlock in %s (mode:0x%x)", |
358 | __func__, gfp_mask); | 358 | __func__, gfp_mask); |
359 | 359 | ||
360 | XFS_STATS_INC(xb_page_retries); | 360 | XFS_STATS_INC(bp->b_target->bt_mount, xb_page_retries); |
361 | congestion_wait(BLK_RW_ASYNC, HZ/50); | 361 | congestion_wait(BLK_RW_ASYNC, HZ/50); |
362 | goto retry; | 362 | goto retry; |
363 | } | 363 | } |
364 | 364 | ||
365 | XFS_STATS_INC(xb_page_found); | 365 | XFS_STATS_INC(bp->b_target->bt_mount, xb_page_found); |
366 | 366 | ||
367 | nbytes = min_t(size_t, size, PAGE_SIZE - offset); | 367 | nbytes = min_t(size_t, size, PAGE_SIZE - offset); |
368 | size -= nbytes; | 368 | size -= nbytes; |
@@ -516,7 +516,7 @@ _xfs_buf_find( | |||
516 | new_bp->b_pag = pag; | 516 | new_bp->b_pag = pag; |
517 | spin_unlock(&pag->pag_buf_lock); | 517 | spin_unlock(&pag->pag_buf_lock); |
518 | } else { | 518 | } else { |
519 | XFS_STATS_INC(xb_miss_locked); | 519 | XFS_STATS_INC(btp->bt_mount, xb_miss_locked); |
520 | spin_unlock(&pag->pag_buf_lock); | 520 | spin_unlock(&pag->pag_buf_lock); |
521 | xfs_perag_put(pag); | 521 | xfs_perag_put(pag); |
522 | } | 522 | } |
@@ -529,11 +529,11 @@ found: | |||
529 | if (!xfs_buf_trylock(bp)) { | 529 | if (!xfs_buf_trylock(bp)) { |
530 | if (flags & XBF_TRYLOCK) { | 530 | if (flags & XBF_TRYLOCK) { |
531 | xfs_buf_rele(bp); | 531 | xfs_buf_rele(bp); |
532 | XFS_STATS_INC(xb_busy_locked); | 532 | XFS_STATS_INC(btp->bt_mount, xb_busy_locked); |
533 | return NULL; | 533 | return NULL; |
534 | } | 534 | } |
535 | xfs_buf_lock(bp); | 535 | xfs_buf_lock(bp); |
536 | XFS_STATS_INC(xb_get_locked_waited); | 536 | XFS_STATS_INC(btp->bt_mount, xb_get_locked_waited); |
537 | } | 537 | } |
538 | 538 | ||
539 | /* | 539 | /* |
@@ -549,7 +549,7 @@ found: | |||
549 | } | 549 | } |
550 | 550 | ||
551 | trace_xfs_buf_find(bp, flags, _RET_IP_); | 551 | trace_xfs_buf_find(bp, flags, _RET_IP_); |
552 | XFS_STATS_INC(xb_get_locked); | 552 | XFS_STATS_INC(btp->bt_mount, xb_get_locked); |
553 | return bp; | 553 | return bp; |
554 | } | 554 | } |
555 | 555 | ||
@@ -603,7 +603,7 @@ found: | |||
603 | } | 603 | } |
604 | } | 604 | } |
605 | 605 | ||
606 | XFS_STATS_INC(xb_get); | 606 | XFS_STATS_INC(target->bt_mount, xb_get); |
607 | trace_xfs_buf_get(bp, flags, _RET_IP_); | 607 | trace_xfs_buf_get(bp, flags, _RET_IP_); |
608 | return bp; | 608 | return bp; |
609 | } | 609 | } |
@@ -643,7 +643,7 @@ xfs_buf_read_map( | |||
643 | trace_xfs_buf_read(bp, flags, _RET_IP_); | 643 | trace_xfs_buf_read(bp, flags, _RET_IP_); |
644 | 644 | ||
645 | if (!XFS_BUF_ISDONE(bp)) { | 645 | if (!XFS_BUF_ISDONE(bp)) { |
646 | XFS_STATS_INC(xb_get_read); | 646 | XFS_STATS_INC(target->bt_mount, xb_get_read); |
647 | bp->b_ops = ops; | 647 | bp->b_ops = ops; |
648 | _xfs_buf_read(bp, flags); | 648 | _xfs_buf_read(bp, flags); |
649 | } else if (flags & XBF_ASYNC) { | 649 | } else if (flags & XBF_ASYNC) { |
diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c index a989a9c7edb7..642d55d10075 100644 --- a/fs/xfs/xfs_dir2_readdir.c +++ b/fs/xfs/xfs_dir2_readdir.c | |||
@@ -666,7 +666,7 @@ xfs_readdir( | |||
666 | return -EIO; | 666 | return -EIO; |
667 | 667 | ||
668 | ASSERT(S_ISDIR(dp->i_d.di_mode)); | 668 | ASSERT(S_ISDIR(dp->i_d.di_mode)); |
669 | XFS_STATS_INC(xs_dir_getdents); | 669 | XFS_STATS_INC(dp->i_mount, xs_dir_getdents); |
670 | 670 | ||
671 | args.dp = dp; | 671 | args.dp = dp; |
672 | args.geo = dp->i_mount->m_dir_geo; | 672 | args.geo = dp->i_mount->m_dir_geo; |
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c index 30cb3afb67f0..7ac6c5c586cb 100644 --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c | |||
@@ -75,9 +75,9 @@ xfs_qm_dqdestroy( | |||
75 | ASSERT(list_empty(&dqp->q_lru)); | 75 | ASSERT(list_empty(&dqp->q_lru)); |
76 | 76 | ||
77 | mutex_destroy(&dqp->q_qlock); | 77 | mutex_destroy(&dqp->q_qlock); |
78 | kmem_zone_free(xfs_qm_dqzone, dqp); | ||
79 | 78 | ||
80 | XFS_STATS_DEC(xs_qm_dquot); | 79 | XFS_STATS_DEC(dqp->q_mount, xs_qm_dquot); |
80 | kmem_zone_free(xfs_qm_dqzone, dqp); | ||
81 | } | 81 | } |
82 | 82 | ||
83 | /* | 83 | /* |
@@ -605,7 +605,7 @@ xfs_qm_dqread( | |||
605 | break; | 605 | break; |
606 | } | 606 | } |
607 | 607 | ||
608 | XFS_STATS_INC(xs_qm_dquot); | 608 | XFS_STATS_INC(mp, xs_qm_dquot); |
609 | 609 | ||
610 | trace_xfs_dqread(dqp); | 610 | trace_xfs_dqread(dqp); |
611 | 611 | ||
@@ -747,12 +747,12 @@ restart: | |||
747 | mutex_unlock(&qi->qi_tree_lock); | 747 | mutex_unlock(&qi->qi_tree_lock); |
748 | 748 | ||
749 | trace_xfs_dqget_hit(dqp); | 749 | trace_xfs_dqget_hit(dqp); |
750 | XFS_STATS_INC(xs_qm_dqcachehits); | 750 | XFS_STATS_INC(mp, xs_qm_dqcachehits); |
751 | *O_dqpp = dqp; | 751 | *O_dqpp = dqp; |
752 | return 0; | 752 | return 0; |
753 | } | 753 | } |
754 | mutex_unlock(&qi->qi_tree_lock); | 754 | mutex_unlock(&qi->qi_tree_lock); |
755 | XFS_STATS_INC(xs_qm_dqcachemisses); | 755 | XFS_STATS_INC(mp, xs_qm_dqcachemisses); |
756 | 756 | ||
757 | /* | 757 | /* |
758 | * Dquot cache miss. We don't want to keep the inode lock across | 758 | * Dquot cache miss. We don't want to keep the inode lock across |
@@ -806,7 +806,7 @@ restart: | |||
806 | mutex_unlock(&qi->qi_tree_lock); | 806 | mutex_unlock(&qi->qi_tree_lock); |
807 | trace_xfs_dqget_dup(dqp); | 807 | trace_xfs_dqget_dup(dqp); |
808 | xfs_qm_dqdestroy(dqp); | 808 | xfs_qm_dqdestroy(dqp); |
809 | XFS_STATS_INC(xs_qm_dquot_dups); | 809 | XFS_STATS_INC(mp, xs_qm_dquot_dups); |
810 | goto restart; | 810 | goto restart; |
811 | } | 811 | } |
812 | 812 | ||
@@ -846,7 +846,7 @@ xfs_qm_dqput( | |||
846 | trace_xfs_dqput_free(dqp); | 846 | trace_xfs_dqput_free(dqp); |
847 | 847 | ||
848 | if (list_lru_add(&qi->qi_lru, &dqp->q_lru)) | 848 | if (list_lru_add(&qi->qi_lru, &dqp->q_lru)) |
849 | XFS_STATS_INC(xs_qm_dquot_unused); | 849 | XFS_STATS_INC(dqp->q_mount, xs_qm_dquot_unused); |
850 | } | 850 | } |
851 | xfs_dqunlock(dqp); | 851 | xfs_dqunlock(dqp); |
852 | } | 852 | } |
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index e78feb400e22..088e50923830 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -287,7 +287,7 @@ xfs_file_read_iter( | |||
287 | xfs_fsize_t n; | 287 | xfs_fsize_t n; |
288 | loff_t pos = iocb->ki_pos; | 288 | loff_t pos = iocb->ki_pos; |
289 | 289 | ||
290 | XFS_STATS_INC(xs_read_calls); | 290 | XFS_STATS_INC(mp, xs_read_calls); |
291 | 291 | ||
292 | if (unlikely(iocb->ki_flags & IOCB_DIRECT)) | 292 | if (unlikely(iocb->ki_flags & IOCB_DIRECT)) |
293 | ioflags |= XFS_IO_ISDIRECT; | 293 | ioflags |= XFS_IO_ISDIRECT; |
@@ -365,7 +365,7 @@ xfs_file_read_iter( | |||
365 | 365 | ||
366 | ret = generic_file_read_iter(iocb, to); | 366 | ret = generic_file_read_iter(iocb, to); |
367 | if (ret > 0) | 367 | if (ret > 0) |
368 | XFS_STATS_ADD(xs_read_bytes, ret); | 368 | XFS_STATS_ADD(mp, xs_read_bytes, ret); |
369 | 369 | ||
370 | xfs_rw_iunlock(ip, XFS_IOLOCK_SHARED); | 370 | xfs_rw_iunlock(ip, XFS_IOLOCK_SHARED); |
371 | return ret; | 371 | return ret; |
@@ -383,7 +383,7 @@ xfs_file_splice_read( | |||
383 | int ioflags = 0; | 383 | int ioflags = 0; |
384 | ssize_t ret; | 384 | ssize_t ret; |
385 | 385 | ||
386 | XFS_STATS_INC(xs_read_calls); | 386 | XFS_STATS_INC(ip->i_mount, xs_read_calls); |
387 | 387 | ||
388 | if (infilp->f_mode & FMODE_NOCMTIME) | 388 | if (infilp->f_mode & FMODE_NOCMTIME) |
389 | ioflags |= XFS_IO_INVIS; | 389 | ioflags |= XFS_IO_INVIS; |
@@ -401,7 +401,7 @@ xfs_file_splice_read( | |||
401 | else | 401 | else |
402 | ret = generic_file_splice_read(infilp, ppos, pipe, count, flags); | 402 | ret = generic_file_splice_read(infilp, ppos, pipe, count, flags); |
403 | if (ret > 0) | 403 | if (ret > 0) |
404 | XFS_STATS_ADD(xs_read_bytes, ret); | 404 | XFS_STATS_ADD(ip->i_mount, xs_read_bytes, ret); |
405 | 405 | ||
406 | xfs_rw_iunlock(ip, XFS_IOLOCK_SHARED); | 406 | xfs_rw_iunlock(ip, XFS_IOLOCK_SHARED); |
407 | return ret; | 407 | return ret; |
@@ -867,7 +867,7 @@ xfs_file_write_iter( | |||
867 | ssize_t ret; | 867 | ssize_t ret; |
868 | size_t ocount = iov_iter_count(from); | 868 | size_t ocount = iov_iter_count(from); |
869 | 869 | ||
870 | XFS_STATS_INC(xs_write_calls); | 870 | XFS_STATS_INC(ip->i_mount, xs_write_calls); |
871 | 871 | ||
872 | if (ocount == 0) | 872 | if (ocount == 0) |
873 | return 0; | 873 | return 0; |
@@ -883,7 +883,7 @@ xfs_file_write_iter( | |||
883 | if (ret > 0) { | 883 | if (ret > 0) { |
884 | ssize_t err; | 884 | ssize_t err; |
885 | 885 | ||
886 | XFS_STATS_ADD(xs_write_bytes, ret); | 886 | XFS_STATS_ADD(ip->i_mount, xs_write_bytes, ret); |
887 | 887 | ||
888 | /* Handle various SYNC-type writes */ | 888 | /* Handle various SYNC-type writes */ |
889 | err = generic_write_sync(file, iocb->ki_pos - ret, ret); | 889 | err = generic_write_sync(file, iocb->ki_pos - ret, ret); |
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index 0a326bd64d4e..d7a490f24ead 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c | |||
@@ -63,7 +63,7 @@ xfs_inode_alloc( | |||
63 | return NULL; | 63 | return NULL; |
64 | } | 64 | } |
65 | 65 | ||
66 | XFS_STATS_INC(vn_active); | 66 | XFS_STATS_INC(mp, vn_active); |
67 | ASSERT(atomic_read(&ip->i_pincount) == 0); | 67 | ASSERT(atomic_read(&ip->i_pincount) == 0); |
68 | ASSERT(!spin_is_locked(&ip->i_flags_lock)); | 68 | ASSERT(!spin_is_locked(&ip->i_flags_lock)); |
69 | ASSERT(!xfs_isiflocked(ip)); | 69 | ASSERT(!xfs_isiflocked(ip)); |
@@ -129,7 +129,7 @@ xfs_inode_free( | |||
129 | /* asserts to verify all state is correct here */ | 129 | /* asserts to verify all state is correct here */ |
130 | ASSERT(atomic_read(&ip->i_pincount) == 0); | 130 | ASSERT(atomic_read(&ip->i_pincount) == 0); |
131 | ASSERT(!xfs_isiflocked(ip)); | 131 | ASSERT(!xfs_isiflocked(ip)); |
132 | XFS_STATS_DEC(vn_active); | 132 | XFS_STATS_DEC(ip->i_mount, vn_active); |
133 | 133 | ||
134 | call_rcu(&VFS_I(ip)->i_rcu, xfs_inode_free_callback); | 134 | call_rcu(&VFS_I(ip)->i_rcu, xfs_inode_free_callback); |
135 | } | 135 | } |
@@ -159,7 +159,7 @@ xfs_iget_cache_hit( | |||
159 | spin_lock(&ip->i_flags_lock); | 159 | spin_lock(&ip->i_flags_lock); |
160 | if (ip->i_ino != ino) { | 160 | if (ip->i_ino != ino) { |
161 | trace_xfs_iget_skip(ip); | 161 | trace_xfs_iget_skip(ip); |
162 | XFS_STATS_INC(xs_ig_frecycle); | 162 | XFS_STATS_INC(mp, xs_ig_frecycle); |
163 | error = -EAGAIN; | 163 | error = -EAGAIN; |
164 | goto out_error; | 164 | goto out_error; |
165 | } | 165 | } |
@@ -177,7 +177,7 @@ xfs_iget_cache_hit( | |||
177 | */ | 177 | */ |
178 | if (ip->i_flags & (XFS_INEW|XFS_IRECLAIM)) { | 178 | if (ip->i_flags & (XFS_INEW|XFS_IRECLAIM)) { |
179 | trace_xfs_iget_skip(ip); | 179 | trace_xfs_iget_skip(ip); |
180 | XFS_STATS_INC(xs_ig_frecycle); | 180 | XFS_STATS_INC(mp, xs_ig_frecycle); |
181 | error = -EAGAIN; | 181 | error = -EAGAIN; |
182 | goto out_error; | 182 | goto out_error; |
183 | } | 183 | } |
@@ -259,7 +259,7 @@ xfs_iget_cache_hit( | |||
259 | xfs_ilock(ip, lock_flags); | 259 | xfs_ilock(ip, lock_flags); |
260 | 260 | ||
261 | xfs_iflags_clear(ip, XFS_ISTALE | XFS_IDONTCACHE); | 261 | xfs_iflags_clear(ip, XFS_ISTALE | XFS_IDONTCACHE); |
262 | XFS_STATS_INC(xs_ig_found); | 262 | XFS_STATS_INC(mp, xs_ig_found); |
263 | 263 | ||
264 | return 0; | 264 | return 0; |
265 | 265 | ||
@@ -342,7 +342,7 @@ xfs_iget_cache_miss( | |||
342 | error = radix_tree_insert(&pag->pag_ici_root, agino, ip); | 342 | error = radix_tree_insert(&pag->pag_ici_root, agino, ip); |
343 | if (unlikely(error)) { | 343 | if (unlikely(error)) { |
344 | WARN_ON(error != -EEXIST); | 344 | WARN_ON(error != -EEXIST); |
345 | XFS_STATS_INC(xs_ig_dup); | 345 | XFS_STATS_INC(mp, xs_ig_dup); |
346 | error = -EAGAIN; | 346 | error = -EAGAIN; |
347 | goto out_preload_end; | 347 | goto out_preload_end; |
348 | } | 348 | } |
@@ -412,7 +412,7 @@ xfs_iget( | |||
412 | if (!ino || XFS_INO_TO_AGNO(mp, ino) >= mp->m_sb.sb_agcount) | 412 | if (!ino || XFS_INO_TO_AGNO(mp, ino) >= mp->m_sb.sb_agcount) |
413 | return -EINVAL; | 413 | return -EINVAL; |
414 | 414 | ||
415 | XFS_STATS_INC(xs_ig_attempts); | 415 | XFS_STATS_INC(mp, xs_ig_attempts); |
416 | 416 | ||
417 | /* get the perag structure and ensure that it's inode capable */ | 417 | /* get the perag structure and ensure that it's inode capable */ |
418 | pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ino)); | 418 | pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ino)); |
@@ -429,7 +429,7 @@ again: | |||
429 | goto out_error_or_again; | 429 | goto out_error_or_again; |
430 | } else { | 430 | } else { |
431 | rcu_read_unlock(); | 431 | rcu_read_unlock(); |
432 | XFS_STATS_INC(xs_ig_missed); | 432 | XFS_STATS_INC(mp, xs_ig_missed); |
433 | 433 | ||
434 | error = xfs_iget_cache_miss(mp, pag, tp, ino, &ip, | 434 | error = xfs_iget_cache_miss(mp, pag, tp, ino, &ip, |
435 | flags, lock_flags); | 435 | flags, lock_flags); |
@@ -965,7 +965,7 @@ reclaim: | |||
965 | xfs_ifunlock(ip); | 965 | xfs_ifunlock(ip); |
966 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 966 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
967 | 967 | ||
968 | XFS_STATS_INC(xs_ig_reclaims); | 968 | XFS_STATS_INC(ip->i_mount, xs_ig_reclaims); |
969 | /* | 969 | /* |
970 | * Remove the inode from the per-AG radix tree. | 970 | * Remove the inode from the per-AG radix tree. |
971 | * | 971 | * |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index dc40a6d5ae0d..a0f2bae6dc1e 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -3271,8 +3271,8 @@ xfs_iflush_cluster( | |||
3271 | } | 3271 | } |
3272 | 3272 | ||
3273 | if (clcount) { | 3273 | if (clcount) { |
3274 | XFS_STATS_INC(xs_icluster_flushcnt); | 3274 | XFS_STATS_INC(mp, xs_icluster_flushcnt); |
3275 | XFS_STATS_ADD(xs_icluster_flushinode, clcount); | 3275 | XFS_STATS_ADD(mp, xs_icluster_flushinode, clcount); |
3276 | } | 3276 | } |
3277 | 3277 | ||
3278 | out_free: | 3278 | out_free: |
@@ -3345,7 +3345,7 @@ xfs_iflush( | |||
3345 | struct xfs_dinode *dip; | 3345 | struct xfs_dinode *dip; |
3346 | int error; | 3346 | int error; |
3347 | 3347 | ||
3348 | XFS_STATS_INC(xs_iflush_count); | 3348 | XFS_STATS_INC(mp, xs_iflush_count); |
3349 | 3349 | ||
3350 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); | 3350 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); |
3351 | ASSERT(xfs_isiflocked(ip)); | 3351 | ASSERT(xfs_isiflocked(ip)); |
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index ea7d85af5310..b67a130134fb 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c | |||
@@ -1028,7 +1028,7 @@ xfs_ioctl_setattr_xflags( | |||
1028 | xfs_diflags_to_linux(ip); | 1028 | xfs_diflags_to_linux(ip); |
1029 | xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG); | 1029 | xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG); |
1030 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 1030 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
1031 | XFS_STATS_INC(xs_ig_attrchg); | 1031 | XFS_STATS_INC(mp, xs_ig_attrchg); |
1032 | return 0; | 1032 | return 0; |
1033 | } | 1033 | } |
1034 | 1034 | ||
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 1f86033171c8..dca69c6711b2 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
@@ -670,7 +670,7 @@ xfs_iomap_write_allocate( | |||
670 | count_fsb = imap->br_blockcount; | 670 | count_fsb = imap->br_blockcount; |
671 | map_start_fsb = imap->br_startoff; | 671 | map_start_fsb = imap->br_startoff; |
672 | 672 | ||
673 | XFS_STATS_ADD(xs_xstrat_bytes, XFS_FSB_TO_B(mp, count_fsb)); | 673 | XFS_STATS_ADD(mp, xs_xstrat_bytes, XFS_FSB_TO_B(mp, count_fsb)); |
674 | 674 | ||
675 | while (count_fsb != 0) { | 675 | while (count_fsb != 0) { |
676 | /* | 676 | /* |
@@ -777,7 +777,7 @@ xfs_iomap_write_allocate( | |||
777 | if ((offset_fsb >= imap->br_startoff) && | 777 | if ((offset_fsb >= imap->br_startoff) && |
778 | (offset_fsb < (imap->br_startoff + | 778 | (offset_fsb < (imap->br_startoff + |
779 | imap->br_blockcount))) { | 779 | imap->br_blockcount))) { |
780 | XFS_STATS_INC(xs_xstrat_quick); | 780 | XFS_STATS_INC(mp, xs_xstrat_quick); |
781 | return 0; | 781 | return 0; |
782 | } | 782 | } |
783 | 783 | ||
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 8294132e6a3c..245268a0cdf0 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c | |||
@@ -695,7 +695,7 @@ xfs_setattr_nonsize( | |||
695 | 695 | ||
696 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 696 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
697 | 697 | ||
698 | XFS_STATS_INC(xs_ig_attrchg); | 698 | XFS_STATS_INC(mp, xs_ig_attrchg); |
699 | 699 | ||
700 | if (mp->m_flags & XFS_MOUNT_WSYNC) | 700 | if (mp->m_flags & XFS_MOUNT_WSYNC) |
701 | xfs_trans_set_sync(tp); | 701 | xfs_trans_set_sync(tp); |
@@ -922,7 +922,7 @@ xfs_setattr_size( | |||
922 | 922 | ||
923 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 923 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
924 | 924 | ||
925 | XFS_STATS_INC(xs_ig_attrchg); | 925 | XFS_STATS_INC(mp, xs_ig_attrchg); |
926 | 926 | ||
927 | if (mp->m_flags & XFS_MOUNT_WSYNC) | 927 | if (mp->m_flags & XFS_MOUNT_WSYNC) |
928 | xfs_trans_set_sync(tp); | 928 | xfs_trans_set_sync(tp); |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index aaadee0969c9..401252360a62 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -268,7 +268,7 @@ xlog_grant_head_wait( | |||
268 | __set_current_state(TASK_UNINTERRUPTIBLE); | 268 | __set_current_state(TASK_UNINTERRUPTIBLE); |
269 | spin_unlock(&head->lock); | 269 | spin_unlock(&head->lock); |
270 | 270 | ||
271 | XFS_STATS_INC(xs_sleep_logspace); | 271 | XFS_STATS_INC(log->l_mp, xs_sleep_logspace); |
272 | 272 | ||
273 | trace_xfs_log_grant_sleep(log, tic); | 273 | trace_xfs_log_grant_sleep(log, tic); |
274 | schedule(); | 274 | schedule(); |
@@ -379,7 +379,7 @@ xfs_log_regrant( | |||
379 | if (XLOG_FORCED_SHUTDOWN(log)) | 379 | if (XLOG_FORCED_SHUTDOWN(log)) |
380 | return -EIO; | 380 | return -EIO; |
381 | 381 | ||
382 | XFS_STATS_INC(xs_try_logspace); | 382 | XFS_STATS_INC(mp, xs_try_logspace); |
383 | 383 | ||
384 | /* | 384 | /* |
385 | * This is a new transaction on the ticket, so we need to change the | 385 | * This is a new transaction on the ticket, so we need to change the |
@@ -448,7 +448,7 @@ xfs_log_reserve( | |||
448 | if (XLOG_FORCED_SHUTDOWN(log)) | 448 | if (XLOG_FORCED_SHUTDOWN(log)) |
449 | return -EIO; | 449 | return -EIO; |
450 | 450 | ||
451 | XFS_STATS_INC(xs_try_logspace); | 451 | XFS_STATS_INC(mp, xs_try_logspace); |
452 | 452 | ||
453 | ASSERT(*ticp == NULL); | 453 | ASSERT(*ticp == NULL); |
454 | tic = xlog_ticket_alloc(log, unit_bytes, cnt, client, permanent, | 454 | tic = xlog_ticket_alloc(log, unit_bytes, cnt, client, permanent, |
@@ -1768,7 +1768,7 @@ xlog_sync( | |||
1768 | int v2 = xfs_sb_version_haslogv2(&log->l_mp->m_sb); | 1768 | int v2 = xfs_sb_version_haslogv2(&log->l_mp->m_sb); |
1769 | int size; | 1769 | int size; |
1770 | 1770 | ||
1771 | XFS_STATS_INC(xs_log_writes); | 1771 | XFS_STATS_INC(log->l_mp, xs_log_writes); |
1772 | ASSERT(atomic_read(&iclog->ic_refcnt) == 0); | 1772 | ASSERT(atomic_read(&iclog->ic_refcnt) == 0); |
1773 | 1773 | ||
1774 | /* Add for LR header */ | 1774 | /* Add for LR header */ |
@@ -1805,7 +1805,7 @@ xlog_sync( | |||
1805 | bp = iclog->ic_bp; | 1805 | bp = iclog->ic_bp; |
1806 | XFS_BUF_SET_ADDR(bp, BLOCK_LSN(be64_to_cpu(iclog->ic_header.h_lsn))); | 1806 | XFS_BUF_SET_ADDR(bp, BLOCK_LSN(be64_to_cpu(iclog->ic_header.h_lsn))); |
1807 | 1807 | ||
1808 | XFS_STATS_ADD(xs_log_blocks, BTOBB(count)); | 1808 | XFS_STATS_ADD(log->l_mp, xs_log_blocks, BTOBB(count)); |
1809 | 1809 | ||
1810 | /* Do we need to split this write into 2 parts? */ | 1810 | /* Do we need to split this write into 2 parts? */ |
1811 | if (XFS_BUF_ADDR(bp) + BTOBB(count) > log->l_logBBsize) { | 1811 | if (XFS_BUF_ADDR(bp) + BTOBB(count) > log->l_logBBsize) { |
@@ -2913,7 +2913,7 @@ restart: | |||
2913 | 2913 | ||
2914 | iclog = log->l_iclog; | 2914 | iclog = log->l_iclog; |
2915 | if (iclog->ic_state != XLOG_STATE_ACTIVE) { | 2915 | if (iclog->ic_state != XLOG_STATE_ACTIVE) { |
2916 | XFS_STATS_INC(xs_log_noiclogs); | 2916 | XFS_STATS_INC(log->l_mp, xs_log_noiclogs); |
2917 | 2917 | ||
2918 | /* Wait for log writes to have flushed */ | 2918 | /* Wait for log writes to have flushed */ |
2919 | xlog_wait(&log->l_flush_wait, &log->l_icloglock); | 2919 | xlog_wait(&log->l_flush_wait, &log->l_icloglock); |
@@ -3212,7 +3212,7 @@ _xfs_log_force( | |||
3212 | struct xlog_in_core *iclog; | 3212 | struct xlog_in_core *iclog; |
3213 | xfs_lsn_t lsn; | 3213 | xfs_lsn_t lsn; |
3214 | 3214 | ||
3215 | XFS_STATS_INC(xs_log_force); | 3215 | XFS_STATS_INC(mp, xs_log_force); |
3216 | 3216 | ||
3217 | xlog_cil_force(log); | 3217 | xlog_cil_force(log); |
3218 | 3218 | ||
@@ -3297,7 +3297,7 @@ maybe_sleep: | |||
3297 | spin_unlock(&log->l_icloglock); | 3297 | spin_unlock(&log->l_icloglock); |
3298 | return -EIO; | 3298 | return -EIO; |
3299 | } | 3299 | } |
3300 | XFS_STATS_INC(xs_log_force_sleep); | 3300 | XFS_STATS_INC(mp, xs_log_force_sleep); |
3301 | xlog_wait(&iclog->ic_force_wait, &log->l_icloglock); | 3301 | xlog_wait(&iclog->ic_force_wait, &log->l_icloglock); |
3302 | /* | 3302 | /* |
3303 | * No need to grab the log lock here since we're | 3303 | * No need to grab the log lock here since we're |
@@ -3362,7 +3362,7 @@ _xfs_log_force_lsn( | |||
3362 | 3362 | ||
3363 | ASSERT(lsn != 0); | 3363 | ASSERT(lsn != 0); |
3364 | 3364 | ||
3365 | XFS_STATS_INC(xs_log_force); | 3365 | XFS_STATS_INC(mp, xs_log_force); |
3366 | 3366 | ||
3367 | lsn = xlog_cil_force_lsn(log, lsn); | 3367 | lsn = xlog_cil_force_lsn(log, lsn); |
3368 | if (lsn == NULLCOMMITLSN) | 3368 | if (lsn == NULLCOMMITLSN) |
@@ -3411,7 +3411,7 @@ try_again: | |||
3411 | (XLOG_STATE_WANT_SYNC | XLOG_STATE_SYNCING))) { | 3411 | (XLOG_STATE_WANT_SYNC | XLOG_STATE_SYNCING))) { |
3412 | ASSERT(!(iclog->ic_state & XLOG_STATE_IOERROR)); | 3412 | ASSERT(!(iclog->ic_state & XLOG_STATE_IOERROR)); |
3413 | 3413 | ||
3414 | XFS_STATS_INC(xs_log_force_sleep); | 3414 | XFS_STATS_INC(mp, xs_log_force_sleep); |
3415 | 3415 | ||
3416 | xlog_wait(&iclog->ic_prev->ic_write_wait, | 3416 | xlog_wait(&iclog->ic_prev->ic_write_wait, |
3417 | &log->l_icloglock); | 3417 | &log->l_icloglock); |
@@ -3441,7 +3441,7 @@ try_again: | |||
3441 | spin_unlock(&log->l_icloglock); | 3441 | spin_unlock(&log->l_icloglock); |
3442 | return -EIO; | 3442 | return -EIO; |
3443 | } | 3443 | } |
3444 | XFS_STATS_INC(xs_log_force_sleep); | 3444 | XFS_STATS_INC(mp, xs_log_force_sleep); |
3445 | xlog_wait(&iclog->ic_force_wait, &log->l_icloglock); | 3445 | xlog_wait(&iclog->ic_force_wait, &log->l_icloglock); |
3446 | /* | 3446 | /* |
3447 | * No need to grab the log lock here since we're | 3447 | * No need to grab the log lock here since we're |
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index eac9549efd52..7af7648c06c6 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c | |||
@@ -184,7 +184,7 @@ xfs_qm_dqpurge( | |||
184 | */ | 184 | */ |
185 | ASSERT(!list_empty(&dqp->q_lru)); | 185 | ASSERT(!list_empty(&dqp->q_lru)); |
186 | list_lru_del(&qi->qi_lru, &dqp->q_lru); | 186 | list_lru_del(&qi->qi_lru, &dqp->q_lru); |
187 | XFS_STATS_DEC(xs_qm_dquot_unused); | 187 | XFS_STATS_DEC(mp, xs_qm_dquot_unused); |
188 | 188 | ||
189 | xfs_qm_dqdestroy(dqp); | 189 | xfs_qm_dqdestroy(dqp); |
190 | return 0; | 190 | return 0; |
@@ -448,11 +448,11 @@ xfs_qm_dquot_isolate( | |||
448 | */ | 448 | */ |
449 | if (dqp->q_nrefs) { | 449 | if (dqp->q_nrefs) { |
450 | xfs_dqunlock(dqp); | 450 | xfs_dqunlock(dqp); |
451 | XFS_STATS_INC(xs_qm_dqwants); | 451 | XFS_STATS_INC(dqp->q_mount, xs_qm_dqwants); |
452 | 452 | ||
453 | trace_xfs_dqreclaim_want(dqp); | 453 | trace_xfs_dqreclaim_want(dqp); |
454 | list_lru_isolate(lru, &dqp->q_lru); | 454 | list_lru_isolate(lru, &dqp->q_lru); |
455 | XFS_STATS_DEC(xs_qm_dquot_unused); | 455 | XFS_STATS_DEC(dqp->q_mount, xs_qm_dquot_unused); |
456 | return LRU_REMOVED; | 456 | return LRU_REMOVED; |
457 | } | 457 | } |
458 | 458 | ||
@@ -496,19 +496,19 @@ xfs_qm_dquot_isolate( | |||
496 | 496 | ||
497 | ASSERT(dqp->q_nrefs == 0); | 497 | ASSERT(dqp->q_nrefs == 0); |
498 | list_lru_isolate_move(lru, &dqp->q_lru, &isol->dispose); | 498 | list_lru_isolate_move(lru, &dqp->q_lru, &isol->dispose); |
499 | XFS_STATS_DEC(xs_qm_dquot_unused); | 499 | XFS_STATS_DEC(dqp->q_mount, xs_qm_dquot_unused); |
500 | trace_xfs_dqreclaim_done(dqp); | 500 | trace_xfs_dqreclaim_done(dqp); |
501 | XFS_STATS_INC(xs_qm_dqreclaims); | 501 | XFS_STATS_INC(dqp->q_mount, xs_qm_dqreclaims); |
502 | return LRU_REMOVED; | 502 | return LRU_REMOVED; |
503 | 503 | ||
504 | out_miss_busy: | 504 | out_miss_busy: |
505 | trace_xfs_dqreclaim_busy(dqp); | 505 | trace_xfs_dqreclaim_busy(dqp); |
506 | XFS_STATS_INC(xs_qm_dqreclaim_misses); | 506 | XFS_STATS_INC(dqp->q_mount, xs_qm_dqreclaim_misses); |
507 | return LRU_SKIP; | 507 | return LRU_SKIP; |
508 | 508 | ||
509 | out_unlock_dirty: | 509 | out_unlock_dirty: |
510 | trace_xfs_dqreclaim_busy(dqp); | 510 | trace_xfs_dqreclaim_busy(dqp); |
511 | XFS_STATS_INC(xs_qm_dqreclaim_misses); | 511 | XFS_STATS_INC(dqp->q_mount, xs_qm_dqreclaim_misses); |
512 | xfs_dqunlock(dqp); | 512 | xfs_dqunlock(dqp); |
513 | spin_lock(lru_lock); | 513 | spin_lock(lru_lock); |
514 | return LRU_RETRY; | 514 | return LRU_RETRY; |
diff --git a/fs/xfs/xfs_stats.h b/fs/xfs/xfs_stats.h index 54f2260299d1..483b0eff1988 100644 --- a/fs/xfs/xfs_stats.h +++ b/fs/xfs/xfs_stats.h | |||
@@ -18,7 +18,6 @@ | |||
18 | #ifndef __XFS_STATS_H__ | 18 | #ifndef __XFS_STATS_H__ |
19 | #define __XFS_STATS_H__ | 19 | #define __XFS_STATS_H__ |
20 | 20 | ||
21 | #if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF) | ||
22 | 21 | ||
23 | #include <linux/percpu.h> | 22 | #include <linux/percpu.h> |
24 | 23 | ||
@@ -218,14 +217,25 @@ int xfs_stats_format(struct xfsstats __percpu *stats, char *buf); | |||
218 | void xfs_stats_clearall(struct xfsstats __percpu *stats); | 217 | void xfs_stats_clearall(struct xfsstats __percpu *stats); |
219 | extern struct xstats xfsstats; | 218 | extern struct xstats xfsstats; |
220 | 219 | ||
221 | #define XFS_STATS_INC(v) \ | 220 | #define XFS_STATS_INC(mp, v) \ |
222 | (per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v++) | 221 | do { \ |
222 | per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v++; \ | ||
223 | per_cpu_ptr(mp->m_stats.xs_stats, current_cpu())->v++; \ | ||
224 | } while (0) | ||
223 | 225 | ||
224 | #define XFS_STATS_DEC(v) \ | 226 | #define XFS_STATS_DEC(mp, v) \ |
225 | (per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v--) | 227 | do { \ |
228 | per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v--; \ | ||
229 | per_cpu_ptr(mp->m_stats.xs_stats, current_cpu())->v--; \ | ||
230 | } while (0) | ||
226 | 231 | ||
227 | #define XFS_STATS_ADD(v, inc) \ | 232 | #define XFS_STATS_ADD(mp, v, inc) \ |
228 | (per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v += (inc)) | 233 | do { \ |
234 | per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v += (inc); \ | ||
235 | per_cpu_ptr(mp->m_stats.xs_stats, current_cpu())->v += (inc); \ | ||
236 | } while (0) | ||
237 | |||
238 | #if defined(CONFIG_PROC_FS) | ||
229 | 239 | ||
230 | extern int xfs_init_procfs(void); | 240 | extern int xfs_init_procfs(void); |
231 | extern void xfs_cleanup_procfs(void); | 241 | extern void xfs_cleanup_procfs(void); |
@@ -233,10 +243,6 @@ extern void xfs_cleanup_procfs(void); | |||
233 | 243 | ||
234 | #else /* !CONFIG_PROC_FS */ | 244 | #else /* !CONFIG_PROC_FS */ |
235 | 245 | ||
236 | # define XFS_STATS_INC(count) | ||
237 | # define XFS_STATS_DEC(count) | ||
238 | # define XFS_STATS_ADD(count, inc) | ||
239 | |||
240 | static inline int xfs_init_procfs(void) | 246 | static inline int xfs_init_procfs(void) |
241 | { | 247 | { |
242 | return 0; | 248 | return 0; |
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 9d11d3ea8030..368c55adee9d 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c | |||
@@ -922,7 +922,7 @@ xfs_fs_destroy_inode( | |||
922 | 922 | ||
923 | trace_xfs_destroy_inode(ip); | 923 | trace_xfs_destroy_inode(ip); |
924 | 924 | ||
925 | XFS_STATS_INC(vn_reclaim); | 925 | XFS_STATS_INC(ip->i_mount, vn_reclaim); |
926 | 926 | ||
927 | ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || ip->i_delayed_blks == 0); | 927 | ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || ip->i_delayed_blks == 0); |
928 | 928 | ||
@@ -983,8 +983,8 @@ xfs_fs_evict_inode( | |||
983 | 983 | ||
984 | truncate_inode_pages_final(&inode->i_data); | 984 | truncate_inode_pages_final(&inode->i_data); |
985 | clear_inode(inode); | 985 | clear_inode(inode); |
986 | XFS_STATS_INC(vn_rele); | 986 | XFS_STATS_INC(ip->i_mount, vn_rele); |
987 | XFS_STATS_INC(vn_remove); | 987 | XFS_STATS_INC(ip->i_mount, vn_remove); |
988 | 988 | ||
989 | xfs_inactive(ip); | 989 | xfs_inactive(ip); |
990 | } | 990 | } |
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index a0ab1dae9c31..748b16aff45a 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c | |||
@@ -930,9 +930,9 @@ __xfs_trans_commit( | |||
930 | */ | 930 | */ |
931 | if (sync) { | 931 | if (sync) { |
932 | error = _xfs_log_force_lsn(mp, commit_lsn, XFS_LOG_SYNC, NULL); | 932 | error = _xfs_log_force_lsn(mp, commit_lsn, XFS_LOG_SYNC, NULL); |
933 | XFS_STATS_INC(xs_trans_sync); | 933 | XFS_STATS_INC(mp, xs_trans_sync); |
934 | } else { | 934 | } else { |
935 | XFS_STATS_INC(xs_trans_async); | 935 | XFS_STATS_INC(mp, xs_trans_async); |
936 | } | 936 | } |
937 | 937 | ||
938 | return error; | 938 | return error; |
@@ -955,7 +955,7 @@ out_unreserve: | |||
955 | xfs_trans_free_items(tp, NULLCOMMITLSN, !!error); | 955 | xfs_trans_free_items(tp, NULLCOMMITLSN, !!error); |
956 | xfs_trans_free(tp); | 956 | xfs_trans_free(tp); |
957 | 957 | ||
958 | XFS_STATS_INC(xs_trans_empty); | 958 | XFS_STATS_INC(mp, xs_trans_empty); |
959 | return error; | 959 | return error; |
960 | } | 960 | } |
961 | 961 | ||
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c index 1098cf490189..4f18fd92ca13 100644 --- a/fs/xfs/xfs_trans_ail.c +++ b/fs/xfs/xfs_trans_ail.c | |||
@@ -349,7 +349,7 @@ xfsaild_push( | |||
349 | xfs_ail_min_lsn(ailp))) { | 349 | xfs_ail_min_lsn(ailp))) { |
350 | ailp->xa_log_flush = 0; | 350 | ailp->xa_log_flush = 0; |
351 | 351 | ||
352 | XFS_STATS_INC(xs_push_ail_flush); | 352 | XFS_STATS_INC(mp, xs_push_ail_flush); |
353 | xfs_log_force(mp, XFS_LOG_SYNC); | 353 | xfs_log_force(mp, XFS_LOG_SYNC); |
354 | } | 354 | } |
355 | 355 | ||
@@ -371,7 +371,7 @@ xfsaild_push( | |||
371 | goto out_done; | 371 | goto out_done; |
372 | } | 372 | } |
373 | 373 | ||
374 | XFS_STATS_INC(xs_push_ail); | 374 | XFS_STATS_INC(mp, xs_push_ail); |
375 | 375 | ||
376 | lsn = lip->li_lsn; | 376 | lsn = lip->li_lsn; |
377 | while ((XFS_LSN_CMP(lip->li_lsn, target) <= 0)) { | 377 | while ((XFS_LSN_CMP(lip->li_lsn, target) <= 0)) { |
@@ -385,7 +385,7 @@ xfsaild_push( | |||
385 | lock_result = lip->li_ops->iop_push(lip, &ailp->xa_buf_list); | 385 | lock_result = lip->li_ops->iop_push(lip, &ailp->xa_buf_list); |
386 | switch (lock_result) { | 386 | switch (lock_result) { |
387 | case XFS_ITEM_SUCCESS: | 387 | case XFS_ITEM_SUCCESS: |
388 | XFS_STATS_INC(xs_push_ail_success); | 388 | XFS_STATS_INC(mp, xs_push_ail_success); |
389 | trace_xfs_ail_push(lip); | 389 | trace_xfs_ail_push(lip); |
390 | 390 | ||
391 | ailp->xa_last_pushed_lsn = lsn; | 391 | ailp->xa_last_pushed_lsn = lsn; |
@@ -403,7 +403,7 @@ xfsaild_push( | |||
403 | * re-try the flushing relatively soon if most of the | 403 | * re-try the flushing relatively soon if most of the |
404 | * AIL is beeing flushed. | 404 | * AIL is beeing flushed. |
405 | */ | 405 | */ |
406 | XFS_STATS_INC(xs_push_ail_flushing); | 406 | XFS_STATS_INC(mp, xs_push_ail_flushing); |
407 | trace_xfs_ail_flushing(lip); | 407 | trace_xfs_ail_flushing(lip); |
408 | 408 | ||
409 | flushing++; | 409 | flushing++; |
@@ -411,14 +411,14 @@ xfsaild_push( | |||
411 | break; | 411 | break; |
412 | 412 | ||
413 | case XFS_ITEM_PINNED: | 413 | case XFS_ITEM_PINNED: |
414 | XFS_STATS_INC(xs_push_ail_pinned); | 414 | XFS_STATS_INC(mp, xs_push_ail_pinned); |
415 | trace_xfs_ail_pinned(lip); | 415 | trace_xfs_ail_pinned(lip); |
416 | 416 | ||
417 | stuck++; | 417 | stuck++; |
418 | ailp->xa_log_flush++; | 418 | ailp->xa_log_flush++; |
419 | break; | 419 | break; |
420 | case XFS_ITEM_LOCKED: | 420 | case XFS_ITEM_LOCKED: |
421 | XFS_STATS_INC(xs_push_ail_locked); | 421 | XFS_STATS_INC(mp, xs_push_ail_locked); |
422 | trace_xfs_ail_locked(lip); | 422 | trace_xfs_ail_locked(lip); |
423 | 423 | ||
424 | stuck++; | 424 | stuck++; |