aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2006-02-23 05:11:47 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-02-23 05:11:47 -0500
commit6a6b3d018f4781f108d170f2181281a3c5589dc8 (patch)
tree471b6b8392fbcad36e62161c8f97893f97f0699e
parent8d3b35a4af87965d1873872b21e504558f62116a (diff)
[GFS2] Patch to remove stats gathering from GFS2
Signed-off-by: David Teigland <teigland@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r--fs/gfs2/glock.c23
-rw-r--r--fs/gfs2/incore.h20
-rw-r--r--fs/gfs2/log.c4
-rw-r--r--fs/gfs2/meta_io.c3
-rw-r--r--fs/gfs2/ops_address.c12
-rw-r--r--fs/gfs2/ops_dentry.c2
-rw-r--r--fs/gfs2/ops_export.c12
-rw-r--r--fs/gfs2/ops_file.c29
-rw-r--r--fs/gfs2/ops_inode.c36
-rw-r--r--fs/gfs2/ops_super.c17
-rw-r--r--fs/gfs2/ops_vm.c4
-rw-r--r--fs/gfs2/sys.c74
12 files changed, 10 insertions, 226 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 4df78ecfeeb3..cf1dc17faf4f 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -106,8 +106,6 @@ static void glock_free(struct gfs2_glock *gl)
106 gfs2_aspace_put(aspace); 106 gfs2_aspace_put(aspace);
107 107
108 kmem_cache_free(gfs2_glock_cachep, gl); 108 kmem_cache_free(gfs2_glock_cachep, gl);
109
110 atomic_dec(&sdp->sd_glock_count);
111} 109}
112 110
113/** 111/**
@@ -316,8 +314,6 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, uint64_t number,
316 if (error) 314 if (error)
317 goto fail_aspace; 315 goto fail_aspace;
318 316
319 atomic_inc(&sdp->sd_glock_count);
320
321 write_lock(&bucket->hb_lock); 317 write_lock(&bucket->hb_lock);
322 tmp = search_bucket(bucket, &name); 318 tmp = search_bucket(bucket, &name);
323 if (tmp) { 319 if (tmp) {
@@ -836,13 +832,10 @@ static void state_change(struct gfs2_glock *gl, unsigned int new_state)
836 held2 = (new_state != LM_ST_UNLOCKED); 832 held2 = (new_state != LM_ST_UNLOCKED);
837 833
838 if (held1 != held2) { 834 if (held1 != held2) {
839 if (held2) { 835 if (held2)
840 atomic_inc(&sdp->sd_glock_held_count);
841 gfs2_glock_hold(gl); 836 gfs2_glock_hold(gl);
842 } else { 837 else
843 atomic_dec(&sdp->sd_glock_held_count);
844 gfs2_glock_put(gl); 838 gfs2_glock_put(gl);
845 }
846 } 839 }
847 840
848 gl->gl_state = new_state; 841 gl->gl_state = new_state;
@@ -994,8 +987,6 @@ void gfs2_glock_xmote_th(struct gfs2_glock *gl, unsigned int state, int flags)
994 gfs2_glock_hold(gl); 987 gfs2_glock_hold(gl);
995 gl->gl_req_bh = xmote_bh; 988 gl->gl_req_bh = xmote_bh;
996 989
997 atomic_inc(&sdp->sd_lm_lock_calls);
998
999 lck_ret = gfs2_lm_lock(sdp, gl->gl_lock, gl->gl_state, state, 990 lck_ret = gfs2_lm_lock(sdp, gl->gl_lock, gl->gl_state, state,
1000 lck_flags); 991 lck_flags);
1001 992
@@ -1087,8 +1078,6 @@ void gfs2_glock_drop_th(struct gfs2_glock *gl)
1087 gfs2_glock_hold(gl); 1078 gfs2_glock_hold(gl);
1088 gl->gl_req_bh = drop_bh; 1079 gl->gl_req_bh = drop_bh;
1089 1080
1090 atomic_inc(&sdp->sd_lm_unlock_calls);
1091
1092 ret = gfs2_lm_unlock(sdp, gl->gl_lock, gl->gl_state); 1081 ret = gfs2_lm_unlock(sdp, gl->gl_lock, gl->gl_state);
1093 1082
1094 if (gfs2_assert_withdraw(sdp, !(ret & LM_OUT_ERROR))) 1083 if (gfs2_assert_withdraw(sdp, !(ret & LM_OUT_ERROR)))
@@ -1313,8 +1302,6 @@ int gfs2_glock_nq(struct gfs2_holder *gh)
1313 struct gfs2_sbd *sdp = gl->gl_sbd; 1302 struct gfs2_sbd *sdp = gl->gl_sbd;
1314 int error = 0; 1303 int error = 0;
1315 1304
1316 atomic_inc(&sdp->sd_glock_nq_calls);
1317
1318 restart: 1305 restart:
1319 if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) { 1306 if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) {
1320 set_bit(HIF_ABORTED, &gh->gh_iflags); 1307 set_bit(HIF_ABORTED, &gh->gh_iflags);
@@ -1406,8 +1393,6 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
1406 struct gfs2_sbd *sdp = gl->gl_sbd; 1393 struct gfs2_sbd *sdp = gl->gl_sbd;
1407 struct gfs2_glock_operations *glops = gl->gl_ops; 1394 struct gfs2_glock_operations *glops = gl->gl_ops;
1408 1395
1409 atomic_inc(&sdp->sd_glock_dq_calls);
1410
1411 if (gh->gh_flags & GL_SYNC) 1396 if (gh->gh_flags & GL_SYNC)
1412 set_bit(GLF_SYNC, &gl->gl_flags); 1397 set_bit(GLF_SYNC, &gl->gl_flags);
1413 1398
@@ -1469,8 +1454,6 @@ void gfs2_glock_prefetch(struct gfs2_glock *gl, unsigned int state, int flags)
1469 spin_unlock(&gl->gl_spin); 1454 spin_unlock(&gl->gl_spin);
1470 1455
1471 glops->go_xmote_th(gl, state, flags); 1456 glops->go_xmote_th(gl, state, flags);
1472
1473 atomic_inc(&gl->gl_sbd->sd_glock_prefetch_calls);
1474} 1457}
1475 1458
1476/** 1459/**
@@ -1916,8 +1899,6 @@ void gfs2_glock_cb(lm_fsdata_t *fsdata, unsigned int type, void *data)
1916{ 1899{
1917 struct gfs2_sbd *sdp = (struct gfs2_sbd *)fsdata; 1900 struct gfs2_sbd *sdp = (struct gfs2_sbd *)fsdata;
1918 1901
1919 atomic_inc(&sdp->sd_lm_callbacks);
1920
1921 switch (type) { 1902 switch (type) {
1922 case LM_CB_NEED_E: 1903 case LM_CB_NEED_E:
1923 blocking_cb(sdp, (struct lm_lockname *)data, LM_ST_UNLOCKED); 1904 blocking_cb(sdp, (struct lm_lockname *)data, LM_ST_UNLOCKED);
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 7fe422537ff0..0e550e8e5be3 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -667,27 +667,7 @@ struct gfs2_sbd {
667 atomic_t sd_glock_count; 667 atomic_t sd_glock_count;
668 atomic_t sd_glock_held_count; 668 atomic_t sd_glock_held_count;
669 atomic_t sd_inode_count; 669 atomic_t sd_inode_count;
670 atomic_t sd_bufdata_count;
671
672 atomic_t sd_fh2dentry_misses;
673 atomic_t sd_reclaimed; 670 atomic_t sd_reclaimed;
674 atomic_t sd_log_flush_incore;
675 atomic_t sd_log_flush_ondisk;
676
677 atomic_t sd_glock_nq_calls;
678 atomic_t sd_glock_dq_calls;
679 atomic_t sd_glock_prefetch_calls;
680 atomic_t sd_lm_lock_calls;
681 atomic_t sd_lm_unlock_calls;
682 atomic_t sd_lm_callbacks;
683
684 atomic_t sd_ops_address;
685 atomic_t sd_ops_dentry;
686 atomic_t sd_ops_export;
687 atomic_t sd_ops_file;
688 atomic_t sd_ops_inode;
689 atomic_t sd_ops_super;
690 atomic_t sd_ops_vm;
691 671
692 char sd_fsname[GFS2_FSNAME_LEN]; 672 char sd_fsname[GFS2_FSNAME_LEN];
693 char sd_table_name[GFS2_FSNAME_LEN]; 673 char sd_table_name[GFS2_FSNAME_LEN];
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index e6acb41332e7..2483f0c2c50e 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -408,8 +408,6 @@ static void log_write_header(struct gfs2_sbd *sdp, uint32_t flags, int pull)
408 unsigned int tail; 408 unsigned int tail;
409 uint32_t hash; 409 uint32_t hash;
410 410
411 atomic_inc(&sdp->sd_log_flush_ondisk);
412
413 bh = sb_getblk(sdp->sd_vfs, blkno); 411 bh = sb_getblk(sdp->sd_vfs, blkno);
414 lock_buffer(bh); 412 lock_buffer(bh);
415 memset(bh->b_data, 0, bh->b_size); 413 memset(bh->b_data, 0, bh->b_size);
@@ -488,8 +486,6 @@ void gfs2_log_flush_i(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
488{ 486{
489 struct gfs2_ail *ai; 487 struct gfs2_ail *ai;
490 488
491 atomic_inc(&sdp->sd_log_flush_incore);
492
493 ai = kzalloc(sizeof(struct gfs2_ail), GFP_NOFS | __GFP_NOFAIL); 489 ai = kzalloc(sizeof(struct gfs2_ail), GFP_NOFS | __GFP_NOFAIL);
494 INIT_LIST_HEAD(&ai->ai_ail1_list); 490 INIT_LIST_HEAD(&ai->ai_ail1_list);
495 INIT_LIST_HEAD(&ai->ai_ail2_list); 491 INIT_LIST_HEAD(&ai->ai_ail2_list);
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 8fba84306755..f4c4dfbf6986 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -146,7 +146,6 @@ static int gfs2_aspace_releasepage(struct page *page, gfp_t gfp_mask)
146 gfs2_assert_warn(sdp, list_empty(&bd->bd_le.le_list)); 146 gfs2_assert_warn(sdp, list_empty(&bd->bd_le.le_list));
147 gfs2_assert_warn(sdp, !bd->bd_ail); 147 gfs2_assert_warn(sdp, !bd->bd_ail);
148 kmem_cache_free(gfs2_bufdata_cachep, bd); 148 kmem_cache_free(gfs2_bufdata_cachep, bd);
149 atomic_dec(&sdp->sd_bufdata_count);
150 set_v2bd(bh, NULL); 149 set_v2bd(bh, NULL);
151 } 150 }
152 151
@@ -557,8 +556,6 @@ void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh, int meta
557 } 556 }
558 557
559 bd = kmem_cache_alloc(gfs2_bufdata_cachep, GFP_NOFS | __GFP_NOFAIL), 558 bd = kmem_cache_alloc(gfs2_bufdata_cachep, GFP_NOFS | __GFP_NOFAIL),
560 atomic_inc(&gl->gl_sbd->sd_bufdata_count);
561
562 memset(bd, 0, sizeof(struct gfs2_bufdata)); 559 memset(bd, 0, sizeof(struct gfs2_bufdata));
563 560
564 bd->bd_bh = bh; 561 bd->bd_bh = bh;
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index c719a2a40698..8f839120a473 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -166,7 +166,6 @@ static int gfs2_writepage(struct page *page, struct writeback_control *wbc)
166 int error; 166 int error;
167 int done_trans = 0; 167 int done_trans = 0;
168 168
169 atomic_inc(&sdp->sd_ops_address);
170 if (gfs2_assert_withdraw(sdp, gfs2_glock_is_held_excl(ip->i_gl))) { 169 if (gfs2_assert_withdraw(sdp, gfs2_glock_is_held_excl(ip->i_gl))) {
171 unlock_page(page); 170 unlock_page(page);
172 return -EIO; 171 return -EIO;
@@ -265,8 +264,6 @@ static int gfs2_readpage(struct file *file, struct page *page)
265 struct gfs2_holder gh; 264 struct gfs2_holder gh;
266 int error; 265 int error;
267 266
268 atomic_inc(&sdp->sd_ops_address);
269
270 if (file != &gfs2_internal_file_sentinal) { 267 if (file != &gfs2_internal_file_sentinal) {
271 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh); 268 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh);
272 error = gfs2_glock_nq_m_atime(1, &gh); 269 error = gfs2_glock_nq_m_atime(1, &gh);
@@ -319,8 +316,6 @@ static int gfs2_prepare_write(struct file *file, struct page *page,
319 loff_t end = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to; 316 loff_t end = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
320 struct gfs2_alloc *al; 317 struct gfs2_alloc *al;
321 318
322 atomic_inc(&sdp->sd_ops_address);
323
324 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_ATIME, &ip->i_gh); 319 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_ATIME, &ip->i_gh);
325 error = gfs2_glock_nq_m_atime(1, &ip->i_gh); 320 error = gfs2_glock_nq_m_atime(1, &ip->i_gh);
326 if (error) 321 if (error)
@@ -412,9 +407,6 @@ static int gfs2_commit_write(struct file *file, struct page *page,
412 struct buffer_head *dibh; 407 struct buffer_head *dibh;
413 struct gfs2_alloc *al = &ip->i_alloc;; 408 struct gfs2_alloc *al = &ip->i_alloc;;
414 409
415 atomic_inc(&sdp->sd_ops_address);
416
417
418 if (gfs2_assert_withdraw(sdp, gfs2_glock_is_locked_by_me(ip->i_gl))) 410 if (gfs2_assert_withdraw(sdp, gfs2_glock_is_locked_by_me(ip->i_gl)))
419 goto fail_nounlock; 411 goto fail_nounlock;
420 412
@@ -493,8 +485,6 @@ static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock)
493 sector_t dblock = 0; 485 sector_t dblock = 0;
494 int error; 486 int error;
495 487
496 atomic_inc(&ip->i_sbd->sd_ops_address);
497
498 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); 488 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
499 if (error) 489 if (error)
500 return 0; 490 return 0;
@@ -615,8 +605,6 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
615 struct gfs2_inode *ip = get_v2ip(inode); 605 struct gfs2_inode *ip = get_v2ip(inode);
616 struct gfs2_sbd *sdp = ip->i_sbd; 606 struct gfs2_sbd *sdp = ip->i_sbd;
617 607
618 atomic_inc(&sdp->sd_ops_address);
619
620 if (rw == WRITE) 608 if (rw == WRITE)
621 return gfs2_direct_IO_write(iocb, iov, offset, nr_segs); 609 return gfs2_direct_IO_write(iocb, iov, offset, nr_segs);
622 610
diff --git a/fs/gfs2/ops_dentry.c b/fs/gfs2/ops_dentry.c
index 5c618611c11b..fb8f70d225b9 100644
--- a/fs/gfs2/ops_dentry.c
+++ b/fs/gfs2/ops_dentry.c
@@ -45,8 +45,6 @@ static int gfs2_drevalidate(struct dentry *dentry, struct nameidata *nd)
45 45
46 lock_kernel(); 46 lock_kernel();
47 47
48 atomic_inc(&sdp->sd_ops_dentry);
49
50 inode = dentry->d_inode; 48 inode = dentry->d_inode;
51 if (inode && is_bad_inode(inode)) 49 if (inode && is_bad_inode(inode))
52 goto invalid; 50 goto invalid;
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c
index 8389f771d28b..611252b7a0d6 100644
--- a/fs/gfs2/ops_export.c
+++ b/fs/gfs2/ops_export.c
@@ -32,8 +32,6 @@ static struct dentry *gfs2_decode_fh(struct super_block *sb,
32{ 32{
33 struct gfs2_inum this, parent; 33 struct gfs2_inum this, parent;
34 34
35 atomic_inc(&get_v2sdp(sb)->sd_ops_export);
36
37 if (fh_type != fh_len) 35 if (fh_type != fh_len)
38 return NULL; 36 return NULL;
39 37
@@ -66,8 +64,6 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
66 struct gfs2_inode *ip = get_v2ip(inode); 64 struct gfs2_inode *ip = get_v2ip(inode);
67 struct gfs2_sbd *sdp = ip->i_sbd; 65 struct gfs2_sbd *sdp = ip->i_sbd;
68 66
69 atomic_inc(&sdp->sd_ops_export);
70
71 if (*len < 4 || (connectable && *len < 8)) 67 if (*len < 4 || (connectable && *len < 8))
72 return 255; 68 return 255;
73 69
@@ -139,8 +135,6 @@ static int gfs2_get_name(struct dentry *parent, char *name,
139 if (!dir) 135 if (!dir)
140 return -EINVAL; 136 return -EINVAL;
141 137
142 atomic_inc(&get_v2sdp(dir->i_sb)->sd_ops_export);
143
144 if (!S_ISDIR(dir->i_mode) || !inode) 138 if (!S_ISDIR(dir->i_mode) || !inode)
145 return -EINVAL; 139 return -EINVAL;
146 140
@@ -173,8 +167,6 @@ static struct dentry *gfs2_get_parent(struct dentry *child)
173 struct dentry *dentry; 167 struct dentry *dentry;
174 int error; 168 int error;
175 169
176 atomic_inc(&dip->i_sbd->sd_ops_export);
177
178 error = gfs2_lookupi(child->d_inode, &dotdot, 1, &inode); 170 error = gfs2_lookupi(child->d_inode, &dotdot, 1, &inode);
179 if (error) 171 if (error)
180 return ERR_PTR(error); 172 return ERR_PTR(error);
@@ -199,8 +191,6 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_p)
199 struct dentry *dentry; 191 struct dentry *dentry;
200 int error; 192 int error;
201 193
202 atomic_inc(&sdp->sd_ops_export);
203
204 /* System files? */ 194 /* System files? */
205 195
206 inode = gfs2_iget(sb, inum); 196 inode = gfs2_iget(sb, inum);
@@ -256,8 +246,6 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_p)
256 goto fail; 246 goto fail;
257 } 247 }
258 248
259 atomic_inc(&sdp->sd_fh2dentry_misses);
260
261 out_ip: 249 out_ip:
262 error = -EIO; 250 error = -EIO;
263 if (ip->i_di.di_flags & GFS2_DIF_SYSTEM) { 251 if (ip->i_di.di_flags & GFS2_DIF_SYSTEM) {
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index cf2e26e07245..0f80e9306016 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -129,8 +129,6 @@ static loff_t gfs2_llseek(struct file *file, loff_t offset, int origin)
129 struct gfs2_holder i_gh; 129 struct gfs2_holder i_gh;
130 loff_t error; 130 loff_t error;
131 131
132 atomic_inc(&ip->i_sbd->sd_ops_file);
133
134 if (origin == 2) { 132 if (origin == 2) {
135 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, 133 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY,
136 &i_gh); 134 &i_gh);
@@ -278,8 +276,6 @@ static ssize_t gfs2_read(struct file *filp, char __user *buf, size_t size,
278 struct kiocb kiocb; 276 struct kiocb kiocb;
279 ssize_t ret; 277 ssize_t ret;
280 278
281 atomic_inc(&get_v2sdp(filp->f_mapping->host->i_sb)->sd_ops_file);
282
283 init_sync_kiocb(&kiocb, filp); 279 init_sync_kiocb(&kiocb, filp);
284 ret = __gfs2_file_aio_read(&kiocb, &local_iov, 1, offset); 280 ret = __gfs2_file_aio_read(&kiocb, &local_iov, 1, offset);
285 if (-EIOCBQUEUED == ret) 281 if (-EIOCBQUEUED == ret)
@@ -293,8 +289,6 @@ static ssize_t gfs2_file_readv(struct file *filp, const struct iovec *iov,
293 struct kiocb kiocb; 289 struct kiocb kiocb;
294 ssize_t ret; 290 ssize_t ret;
295 291
296 atomic_inc(&get_v2sdp(filp->f_mapping->host->i_sb)->sd_ops_file);
297
298 init_sync_kiocb(&kiocb, filp); 292 init_sync_kiocb(&kiocb, filp);
299 ret = __gfs2_file_aio_read(&kiocb, iov, nr_segs, ppos); 293 ret = __gfs2_file_aio_read(&kiocb, iov, nr_segs, ppos);
300 if (-EIOCBQUEUED == ret) 294 if (-EIOCBQUEUED == ret)
@@ -308,8 +302,6 @@ static ssize_t gfs2_file_aio_read(struct kiocb *iocb, char __user *buf,
308 struct file *filp = iocb->ki_filp; 302 struct file *filp = iocb->ki_filp;
309 struct iovec local_iov = { .iov_base = buf, .iov_len = count }; 303 struct iovec local_iov = { .iov_base = buf, .iov_len = count };
310 304
311 atomic_inc(&get_v2sdp(filp->f_mapping->host->i_sb)->sd_ops_file);
312
313 BUG_ON(iocb->ki_pos != pos); 305 BUG_ON(iocb->ki_pos != pos);
314 return __gfs2_file_aio_read(iocb, &local_iov, 1, &iocb->ki_pos); 306 return __gfs2_file_aio_read(iocb, &local_iov, 1, &iocb->ki_pos);
315} 307}
@@ -529,8 +521,6 @@ static int gfs2_readdir(struct file *file, void *dirent, filldir_t filldir)
529{ 521{
530 int error; 522 int error;
531 523
532 atomic_inc(&get_v2sdp(file->f_mapping->host->i_sb)->sd_ops_file);
533
534 if (strcmp(current->comm, "nfsd") != 0) 524 if (strcmp(current->comm, "nfsd") != 0)
535 error = readdir_reg(file, dirent, filldir); 525 error = readdir_reg(file, dirent, filldir);
536 else 526 else
@@ -539,7 +529,8 @@ static int gfs2_readdir(struct file *file, void *dirent, filldir_t filldir)
539 return error; 529 return error;
540} 530}
541 531
542static int gfs2_ioctl_flags(struct gfs2_inode *ip, unsigned int cmd, unsigned long arg) 532static int gfs2_ioctl_flags(struct gfs2_inode *ip, unsigned int cmd,
533 unsigned long arg)
543{ 534{
544 unsigned int lmode = (cmd == GFS2_IOCTL_SETFLAGS) ? LM_ST_EXCLUSIVE : LM_ST_SHARED; 535 unsigned int lmode = (cmd == GFS2_IOCTL_SETFLAGS) ? LM_ST_EXCLUSIVE : LM_ST_SHARED;
545 struct buffer_head *dibh; 536 struct buffer_head *dibh;
@@ -618,8 +609,6 @@ static int gfs2_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
618{ 609{
619 struct gfs2_inode *ip = get_v2ip(inode); 610 struct gfs2_inode *ip = get_v2ip(inode);
620 611
621 atomic_inc(&ip->i_sbd->sd_ops_file);
622
623 switch (cmd) { 612 switch (cmd) {
624 case GFS2_IOCTL_SETFLAGS: 613 case GFS2_IOCTL_SETFLAGS:
625 case GFS2_IOCTL_GETFLAGS: 614 case GFS2_IOCTL_GETFLAGS:
@@ -644,8 +633,6 @@ static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)
644 struct gfs2_holder i_gh; 633 struct gfs2_holder i_gh;
645 int error; 634 int error;
646 635
647 atomic_inc(&ip->i_sbd->sd_ops_file);
648
649 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &i_gh); 636 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &i_gh);
650 error = gfs2_glock_nq_atime(&i_gh); 637 error = gfs2_glock_nq_atime(&i_gh);
651 if (error) { 638 if (error) {
@@ -682,8 +669,6 @@ static int gfs2_open(struct inode *inode, struct file *file)
682 struct gfs2_file *fp; 669 struct gfs2_file *fp;
683 int error; 670 int error;
684 671
685 atomic_inc(&ip->i_sbd->sd_ops_file);
686
687 fp = kzalloc(sizeof(struct gfs2_file), GFP_KERNEL); 672 fp = kzalloc(sizeof(struct gfs2_file), GFP_KERNEL);
688 if (!fp) 673 if (!fp)
689 return -ENOMEM; 674 return -ENOMEM;
@@ -741,8 +726,6 @@ static int gfs2_close(struct inode *inode, struct file *file)
741 struct gfs2_sbd *sdp = get_v2sdp(inode->i_sb); 726 struct gfs2_sbd *sdp = get_v2sdp(inode->i_sb);
742 struct gfs2_file *fp; 727 struct gfs2_file *fp;
743 728
744 atomic_inc(&sdp->sd_ops_file);
745
746 fp = get_v2fp(file); 729 fp = get_v2fp(file);
747 set_v2fp(file, NULL); 730 set_v2fp(file, NULL);
748 731
@@ -766,7 +749,6 @@ static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync)
766{ 749{
767 struct gfs2_inode *ip = get_v2ip(dentry->d_inode); 750 struct gfs2_inode *ip = get_v2ip(dentry->d_inode);
768 751
769 atomic_inc(&ip->i_sbd->sd_ops_file);
770 gfs2_log_flush_glock(ip->i_gl); 752 gfs2_log_flush_glock(ip->i_gl);
771 753
772 return 0; 754 return 0;
@@ -789,8 +771,6 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
789 { .ln_number = ip->i_num.no_addr, 771 { .ln_number = ip->i_num.no_addr,
790 .ln_type = LM_TYPE_PLOCK }; 772 .ln_type = LM_TYPE_PLOCK };
791 773
792 atomic_inc(&sdp->sd_ops_file);
793
794 if (!(fl->fl_flags & FL_POSIX)) 774 if (!(fl->fl_flags & FL_POSIX))
795 return -ENOLCK; 775 return -ENOLCK;
796 if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID) 776 if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
@@ -839,9 +819,6 @@ static ssize_t gfs2_sendfile(struct file *in_file, loff_t *offset, size_t count,
839 read_actor_t actor, void *target) 819 read_actor_t actor, void *target)
840{ 820{
841 struct gfs2_inode *ip = get_v2ip(in_file->f_mapping->host); 821 struct gfs2_inode *ip = get_v2ip(in_file->f_mapping->host);
842
843 atomic_inc(&ip->i_sbd->sd_ops_file);
844
845 return generic_file_sendfile(in_file, offset, count, actor, target); 822 return generic_file_sendfile(in_file, offset, count, actor, target);
846} 823}
847 824
@@ -921,8 +898,6 @@ static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl)
921 struct gfs2_inode *ip = get_v2ip(file->f_mapping->host); 898 struct gfs2_inode *ip = get_v2ip(file->f_mapping->host);
922 struct gfs2_sbd *sdp = ip->i_sbd; 899 struct gfs2_sbd *sdp = ip->i_sbd;
923 900
924 atomic_inc(&ip->i_sbd->sd_ops_file);
925
926 if (!(fl->fl_flags & FL_FLOCK)) 901 if (!(fl->fl_flags & FL_FLOCK))
927 return -ENOLCK; 902 return -ENOLCK;
928 if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID) 903 if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index 9fb9490eb67a..9971a30eb78e 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -56,8 +56,6 @@ static int gfs2_create(struct inode *dir, struct dentry *dentry,
56 int new = 1; 56 int new = 1;
57 int error; 57 int error;
58 58
59 atomic_inc(&sdp->sd_ops_inode);
60
61 gfs2_holder_init(dip->i_gl, 0, 0, ghs); 59 gfs2_holder_init(dip->i_gl, 0, 0, ghs);
62 60
63 for (;;) { 61 for (;;) {
@@ -113,8 +111,6 @@ static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry,
113 struct inode *inode = NULL; 111 struct inode *inode = NULL;
114 int error; 112 int error;
115 113
116 atomic_inc(&sdp->sd_ops_inode);
117
118 if (!sdp->sd_args.ar_localcaching) 114 if (!sdp->sd_args.ar_localcaching)
119 dentry->d_op = &gfs2_dops; 115 dentry->d_op = &gfs2_dops;
120 116
@@ -152,8 +148,6 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
152 int alloc_required; 148 int alloc_required;
153 int error; 149 int error;
154 150
155 atomic_inc(&sdp->sd_ops_inode);
156
157 if (S_ISDIR(ip->i_di.di_mode)) 151 if (S_ISDIR(ip->i_di.di_mode))
158 return -EPERM; 152 return -EPERM;
159 153
@@ -287,8 +281,6 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
287 struct gfs2_holder ghs[2]; 281 struct gfs2_holder ghs[2];
288 int error; 282 int error;
289 283
290 atomic_inc(&sdp->sd_ops_inode);
291
292 error = gfs2_unlinked_get(sdp, &ul); 284 error = gfs2_unlinked_get(sdp, &ul);
293 if (error) 285 if (error)
294 return error; 286 return error;
@@ -345,8 +337,6 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry,
345 int size; 337 int size;
346 int error; 338 int error;
347 339
348 atomic_inc(&sdp->sd_ops_inode);
349
350 /* Must be stuffed with a null terminator for gfs2_follow_link() */ 340 /* Must be stuffed with a null terminator for gfs2_follow_link() */
351 size = strlen(symname); 341 size = strlen(symname);
352 if (size > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode) - 1) 342 if (size > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode) - 1)
@@ -405,8 +395,6 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
405 struct buffer_head *dibh; 395 struct buffer_head *dibh;
406 int error; 396 int error;
407 397
408 atomic_inc(&sdp->sd_ops_inode);
409
410 gfs2_holder_init(dip->i_gl, 0, 0, ghs); 398 gfs2_holder_init(dip->i_gl, 0, 0, ghs);
411 399
412 inode = gfs2_createi(ghs, &dentry->d_name, S_IFDIR | mode); 400 inode = gfs2_createi(ghs, &dentry->d_name, S_IFDIR | mode);
@@ -487,8 +475,6 @@ static int gfs2_rmdir(struct inode *dir, struct dentry *dentry)
487 struct gfs2_holder ghs[2]; 475 struct gfs2_holder ghs[2];
488 int error; 476 int error;
489 477
490 atomic_inc(&sdp->sd_ops_inode);
491
492 error = gfs2_unlinked_get(sdp, &ul); 478 error = gfs2_unlinked_get(sdp, &ul);
493 if (error) 479 if (error)
494 return error; 480 return error;
@@ -556,8 +542,6 @@ static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode,
556 uint32_t major = 0, minor = 0; 542 uint32_t major = 0, minor = 0;
557 int error; 543 int error;
558 544
559 atomic_inc(&sdp->sd_ops_inode);
560
561 switch (mode & S_IFMT) { 545 switch (mode & S_IFMT) {
562 case S_IFBLK: 546 case S_IFBLK:
563 case S_IFCHR: 547 case S_IFCHR:
@@ -631,8 +615,6 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
631 unsigned int x; 615 unsigned int x;
632 int error; 616 int error;
633 617
634 atomic_inc(&sdp->sd_ops_inode);
635
636 if (ndentry->d_inode) { 618 if (ndentry->d_inode) {
637 nip = get_v2ip(ndentry->d_inode); 619 nip = get_v2ip(ndentry->d_inode);
638 if (ip == nip) 620 if (ip == nip)
@@ -871,8 +853,6 @@ static int gfs2_readlink(struct dentry *dentry, char __user *user_buf,
871 unsigned int len = GFS2_FAST_NAME_SIZE; 853 unsigned int len = GFS2_FAST_NAME_SIZE;
872 int error; 854 int error;
873 855
874 atomic_inc(&ip->i_sbd->sd_ops_inode);
875
876 error = gfs2_readlinki(ip, &buf, &len); 856 error = gfs2_readlinki(ip, &buf, &len);
877 if (error) 857 if (error)
878 return error; 858 return error;
@@ -909,8 +889,6 @@ static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd)
909 unsigned int len = GFS2_FAST_NAME_SIZE; 889 unsigned int len = GFS2_FAST_NAME_SIZE;
910 int error; 890 int error;
911 891
912 atomic_inc(&ip->i_sbd->sd_ops_inode);
913
914 error = gfs2_readlinki(ip, &buf, &len); 892 error = gfs2_readlinki(ip, &buf, &len);
915 if (!error) { 893 if (!error) {
916 error = vfs_follow_link(nd, buf); 894 error = vfs_follow_link(nd, buf);
@@ -936,8 +914,6 @@ static int gfs2_permission(struct inode *inode, int mask, struct nameidata *nd)
936 struct gfs2_holder i_gh; 914 struct gfs2_holder i_gh;
937 int error; 915 int error;
938 916
939 atomic_inc(&ip->i_sbd->sd_ops_inode);
940
941 if (ip->i_vn == ip->i_gl->gl_vn) 917 if (ip->i_vn == ip->i_gl->gl_vn)
942 return generic_permission(inode, mask, gfs2_check_acl); 918 return generic_permission(inode, mask, gfs2_check_acl);
943 919
@@ -1053,8 +1029,6 @@ static int gfs2_setattr(struct dentry *dentry, struct iattr *attr)
1053 struct gfs2_holder i_gh; 1029 struct gfs2_holder i_gh;
1054 int error; 1030 int error;
1055 1031
1056 atomic_inc(&ip->i_sbd->sd_ops_inode);
1057
1058 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh); 1032 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
1059 if (error) 1033 if (error)
1060 return error; 1034 return error;
@@ -1102,8 +1076,6 @@ static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
1102 struct gfs2_holder gh; 1076 struct gfs2_holder gh;
1103 int error; 1077 int error;
1104 1078
1105 atomic_inc(&ip->i_sbd->sd_ops_inode);
1106
1107 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &gh); 1079 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &gh);
1108 if (!error) { 1080 if (!error) {
1109 generic_fillattr(inode, stat); 1081 generic_fillattr(inode, stat);
@@ -1119,8 +1091,6 @@ static int gfs2_setxattr(struct dentry *dentry, const char *name,
1119 struct gfs2_inode *ip = get_v2ip(dentry->d_inode); 1091 struct gfs2_inode *ip = get_v2ip(dentry->d_inode);
1120 struct gfs2_ea_request er; 1092 struct gfs2_ea_request er;
1121 1093
1122 atomic_inc(&ip->i_sbd->sd_ops_inode);
1123
1124 memset(&er, 0, sizeof(struct gfs2_ea_request)); 1094 memset(&er, 0, sizeof(struct gfs2_ea_request));
1125 er.er_type = gfs2_ea_name2type(name, &er.er_name); 1095 er.er_type = gfs2_ea_name2type(name, &er.er_name);
1126 if (er.er_type == GFS2_EATYPE_UNUSED) 1096 if (er.er_type == GFS2_EATYPE_UNUSED)
@@ -1140,8 +1110,6 @@ static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name,
1140{ 1110{
1141 struct gfs2_ea_request er; 1111 struct gfs2_ea_request er;
1142 1112
1143 atomic_inc(&get_v2sdp(dentry->d_inode->i_sb)->sd_ops_inode);
1144
1145 memset(&er, 0, sizeof(struct gfs2_ea_request)); 1113 memset(&er, 0, sizeof(struct gfs2_ea_request));
1146 er.er_type = gfs2_ea_name2type(name, &er.er_name); 1114 er.er_type = gfs2_ea_name2type(name, &er.er_name);
1147 if (er.er_type == GFS2_EATYPE_UNUSED) 1115 if (er.er_type == GFS2_EATYPE_UNUSED)
@@ -1157,8 +1125,6 @@ static ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size)
1157{ 1125{
1158 struct gfs2_ea_request er; 1126 struct gfs2_ea_request er;
1159 1127
1160 atomic_inc(&get_v2sdp(dentry->d_inode->i_sb)->sd_ops_inode);
1161
1162 memset(&er, 0, sizeof(struct gfs2_ea_request)); 1128 memset(&er, 0, sizeof(struct gfs2_ea_request));
1163 er.er_data = (size) ? buffer : NULL; 1129 er.er_data = (size) ? buffer : NULL;
1164 er.er_data_len = size; 1130 er.er_data_len = size;
@@ -1170,8 +1136,6 @@ static int gfs2_removexattr(struct dentry *dentry, const char *name)
1170{ 1136{
1171 struct gfs2_ea_request er; 1137 struct gfs2_ea_request er;
1172 1138
1173 atomic_inc(&get_v2sdp(dentry->d_inode->i_sb)->sd_ops_inode);
1174
1175 memset(&er, 0, sizeof(struct gfs2_ea_request)); 1139 memset(&er, 0, sizeof(struct gfs2_ea_request));
1176 er.er_type = gfs2_ea_name2type(name, &er.er_name); 1140 er.er_type = gfs2_ea_name2type(name, &er.er_name);
1177 if (er.er_type == GFS2_EATYPE_UNUSED) 1141 if (er.er_type == GFS2_EATYPE_UNUSED)
diff --git a/fs/gfs2/ops_super.c b/fs/gfs2/ops_super.c
index 9130d0d0df3c..cd45ec93a043 100644
--- a/fs/gfs2/ops_super.c
+++ b/fs/gfs2/ops_super.c
@@ -46,8 +46,6 @@ static int gfs2_write_inode(struct inode *inode, int sync)
46{ 46{
47 struct gfs2_inode *ip = get_v2ip(inode); 47 struct gfs2_inode *ip = get_v2ip(inode);
48 48
49 atomic_inc(&ip->i_sbd->sd_ops_super);
50
51 if (current->flags & PF_MEMALLOC) 49 if (current->flags & PF_MEMALLOC)
52 return 0; 50 return 0;
53 if (ip && sync) 51 if (ip && sync)
@@ -70,8 +68,6 @@ static void gfs2_put_super(struct super_block *sb)
70 if (!sdp) 68 if (!sdp)
71 return; 69 return;
72 70
73 atomic_inc(&sdp->sd_ops_super);
74
75 /* Unfreeze the filesystem, if we need to */ 71 /* Unfreeze the filesystem, if we need to */
76 72
77 mutex_lock(&sdp->sd_freeze_lock); 73 mutex_lock(&sdp->sd_freeze_lock);
@@ -156,7 +152,6 @@ static void gfs2_put_super(struct super_block *sb)
156static void gfs2_write_super(struct super_block *sb) 152static void gfs2_write_super(struct super_block *sb)
157{ 153{
158 struct gfs2_sbd *sdp = get_v2sdp(sb); 154 struct gfs2_sbd *sdp = get_v2sdp(sb);
159 atomic_inc(&sdp->sd_ops_super);
160 gfs2_log_flush(sdp); 155 gfs2_log_flush(sdp);
161} 156}
162 157
@@ -171,8 +166,6 @@ static void gfs2_write_super_lockfs(struct super_block *sb)
171 struct gfs2_sbd *sdp = get_v2sdp(sb); 166 struct gfs2_sbd *sdp = get_v2sdp(sb);
172 int error; 167 int error;
173 168
174 atomic_inc(&sdp->sd_ops_super);
175
176 for (;;) { 169 for (;;) {
177 error = gfs2_freeze_fs(sdp); 170 error = gfs2_freeze_fs(sdp);
178 if (!error) 171 if (!error)
@@ -202,8 +195,6 @@ static void gfs2_write_super_lockfs(struct super_block *sb)
202static void gfs2_unlockfs(struct super_block *sb) 195static void gfs2_unlockfs(struct super_block *sb)
203{ 196{
204 struct gfs2_sbd *sdp = get_v2sdp(sb); 197 struct gfs2_sbd *sdp = get_v2sdp(sb);
205
206 atomic_inc(&sdp->sd_ops_super);
207 gfs2_unfreeze_fs(sdp); 198 gfs2_unfreeze_fs(sdp);
208} 199}
209 200
@@ -221,8 +212,6 @@ static int gfs2_statfs(struct super_block *sb, struct kstatfs *buf)
221 struct gfs2_statfs_change sc; 212 struct gfs2_statfs_change sc;
222 int error; 213 int error;
223 214
224 atomic_inc(&sdp->sd_ops_super);
225
226 if (gfs2_tune_get(sdp, gt_statfs_slow)) 215 if (gfs2_tune_get(sdp, gt_statfs_slow))
227 error = gfs2_statfs_slow(sdp, &sc); 216 error = gfs2_statfs_slow(sdp, &sc);
228 else 217 else
@@ -259,8 +248,6 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data)
259 struct gfs2_sbd *sdp = get_v2sdp(sb); 248 struct gfs2_sbd *sdp = get_v2sdp(sb);
260 int error; 249 int error;
261 250
262 atomic_inc(&sdp->sd_ops_super);
263
264 error = gfs2_mount_args(sdp, data, 1); 251 error = gfs2_mount_args(sdp, data, 1);
265 if (error) 252 if (error)
266 return error; 253 return error;
@@ -298,8 +285,6 @@ static void gfs2_clear_inode(struct inode *inode)
298{ 285{
299 struct gfs2_inode *ip = get_v2ip(inode); 286 struct gfs2_inode *ip = get_v2ip(inode);
300 287
301 atomic_inc(&get_v2sdp(inode->i_sb)->sd_ops_super);
302
303 if (ip) { 288 if (ip) {
304 spin_lock(&ip->i_spin); 289 spin_lock(&ip->i_spin);
305 ip->i_vnode = NULL; 290 ip->i_vnode = NULL;
@@ -324,8 +309,6 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
324 struct gfs2_sbd *sdp = get_v2sdp(mnt->mnt_sb); 309 struct gfs2_sbd *sdp = get_v2sdp(mnt->mnt_sb);
325 struct gfs2_args *args = &sdp->sd_args; 310 struct gfs2_args *args = &sdp->sd_args;
326 311
327 atomic_inc(&sdp->sd_ops_super);
328
329 if (args->ar_lockproto[0]) 312 if (args->ar_lockproto[0])
330 seq_printf(s, ",lockproto=%s", args->ar_lockproto); 313 seq_printf(s, ",lockproto=%s", args->ar_lockproto);
331 if (args->ar_locktable[0]) 314 if (args->ar_locktable[0])
diff --git a/fs/gfs2/ops_vm.c b/fs/gfs2/ops_vm.c
index 8f77bb7896bd..808110e3ec5e 100644
--- a/fs/gfs2/ops_vm.c
+++ b/fs/gfs2/ops_vm.c
@@ -48,8 +48,6 @@ static struct page *gfs2_private_nopage(struct vm_area_struct *area,
48 struct page *result; 48 struct page *result;
49 int error; 49 int error;
50 50
51 atomic_inc(&ip->i_sbd->sd_ops_vm);
52
53 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh); 51 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &i_gh);
54 if (error) 52 if (error)
55 return NULL; 53 return NULL;
@@ -149,8 +147,6 @@ static struct page *gfs2_sharewrite_nopage(struct vm_area_struct *area,
149 int alloc_required; 147 int alloc_required;
150 int error; 148 int error;
151 149
152 atomic_inc(&ip->i_sbd->sd_ops_vm);
153
154 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh); 150 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
155 if (error) 151 if (error)
156 return NULL; 152 return NULL;
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index c5984351e4d8..f87df8ec041e 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -319,85 +319,23 @@ struct counters_attr {
319 ssize_t (*show)(struct gfs2_sbd *, char *); 319 ssize_t (*show)(struct gfs2_sbd *, char *);
320}; 320};
321 321
322#define COUNTERS_ATTR_GENERAL(name, fmt, val) \ 322#define COUNTERS_ATTR(name, fmt) \
323static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \ 323static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
324{ \ 324{ \
325 return sprintf(buf, fmt, val); \ 325 return sprintf(buf, fmt, (unsigned int)atomic_read(&sdp->sd_##name)); \
326} \ 326} \
327static struct counters_attr counters_attr_##name = __ATTR_RO(name) 327static struct counters_attr counters_attr_##name = __ATTR_RO(name)
328 328
329#define COUNTERS_ATTR_SIMPLE(name, fmt) \ 329COUNTERS_ATTR(glock_count, "%u\n");
330 COUNTERS_ATTR_GENERAL(name, fmt, sdp->sd_##name) 330COUNTERS_ATTR(glock_held_count, "%u\n");
331 331COUNTERS_ATTR(inode_count, "%u\n");
332#define COUNTERS_ATTR_ATOMIC(name, fmt) \ 332COUNTERS_ATTR(reclaimed, "%u\n");
333 COUNTERS_ATTR_GENERAL(name, fmt, (unsigned int)atomic_read(&sdp->sd_##name))
334
335COUNTERS_ATTR_ATOMIC(glock_count, "%u\n");
336COUNTERS_ATTR_ATOMIC(glock_held_count, "%u\n");
337COUNTERS_ATTR_ATOMIC(inode_count, "%u\n");
338COUNTERS_ATTR_ATOMIC(bufdata_count, "%u\n");
339COUNTERS_ATTR_ATOMIC(unlinked_count, "%u\n");
340COUNTERS_ATTR_ATOMIC(quota_count, "%u\n");
341COUNTERS_ATTR_SIMPLE(log_num_gl, "%u\n");
342COUNTERS_ATTR_SIMPLE(log_num_buf, "%u\n");
343COUNTERS_ATTR_SIMPLE(log_num_revoke, "%u\n");
344COUNTERS_ATTR_SIMPLE(log_num_rg, "%u\n");
345COUNTERS_ATTR_SIMPLE(log_num_databuf, "%u\n");
346COUNTERS_ATTR_SIMPLE(log_blks_free, "%u\n");
347COUNTERS_ATTR_GENERAL(jd_blocks, "%u\n", sdp->sd_jdesc->jd_blocks);
348COUNTERS_ATTR_ATOMIC(reclaim_count, "%u\n");
349COUNTERS_ATTR_SIMPLE(log_wraps, "%llu\n");
350COUNTERS_ATTR_ATOMIC(fh2dentry_misses, "%u\n");
351COUNTERS_ATTR_ATOMIC(reclaimed, "%u\n");
352COUNTERS_ATTR_ATOMIC(log_flush_incore, "%u\n");
353COUNTERS_ATTR_ATOMIC(log_flush_ondisk, "%u\n");
354COUNTERS_ATTR_ATOMIC(glock_nq_calls, "%u\n");
355COUNTERS_ATTR_ATOMIC(glock_dq_calls, "%u\n");
356COUNTERS_ATTR_ATOMIC(glock_prefetch_calls, "%u\n");
357COUNTERS_ATTR_ATOMIC(lm_lock_calls, "%u\n");
358COUNTERS_ATTR_ATOMIC(lm_unlock_calls, "%u\n");
359COUNTERS_ATTR_ATOMIC(lm_callbacks, "%u\n");
360COUNTERS_ATTR_ATOMIC(ops_address, "%u\n");
361COUNTERS_ATTR_ATOMIC(ops_dentry, "%u\n");
362COUNTERS_ATTR_ATOMIC(ops_export, "%u\n");
363COUNTERS_ATTR_ATOMIC(ops_file, "%u\n");
364COUNTERS_ATTR_ATOMIC(ops_inode, "%u\n");
365COUNTERS_ATTR_ATOMIC(ops_super, "%u\n");
366COUNTERS_ATTR_ATOMIC(ops_vm, "%u\n");
367 333
368static struct attribute *counters_attrs[] = { 334static struct attribute *counters_attrs[] = {
369 &counters_attr_glock_count.attr, 335 &counters_attr_glock_count.attr,
370 &counters_attr_glock_held_count.attr, 336 &counters_attr_glock_held_count.attr,
371 &counters_attr_inode_count.attr, 337 &counters_attr_inode_count.attr,
372 &counters_attr_bufdata_count.attr,
373 &counters_attr_unlinked_count.attr,
374 &counters_attr_quota_count.attr,
375 &counters_attr_log_num_gl.attr,
376 &counters_attr_log_num_buf.attr,
377 &counters_attr_log_num_revoke.attr,
378 &counters_attr_log_num_rg.attr,
379 &counters_attr_log_num_databuf.attr,
380 &counters_attr_log_blks_free.attr,
381 &counters_attr_jd_blocks.attr,
382 &counters_attr_reclaim_count.attr,
383 &counters_attr_log_wraps.attr,
384 &counters_attr_fh2dentry_misses.attr,
385 &counters_attr_reclaimed.attr, 338 &counters_attr_reclaimed.attr,
386 &counters_attr_log_flush_incore.attr,
387 &counters_attr_log_flush_ondisk.attr,
388 &counters_attr_glock_nq_calls.attr,
389 &counters_attr_glock_dq_calls.attr,
390 &counters_attr_glock_prefetch_calls.attr,
391 &counters_attr_lm_lock_calls.attr,
392 &counters_attr_lm_unlock_calls.attr,
393 &counters_attr_lm_callbacks.attr,
394 &counters_attr_ops_address.attr,
395 &counters_attr_ops_dentry.attr,
396 &counters_attr_ops_export.attr,
397 &counters_attr_ops_file.attr,
398 &counters_attr_ops_inode.attr,
399 &counters_attr_ops_super.attr,
400 &counters_attr_ops_vm.attr,
401 NULL 339 NULL
402}; 340};
403 341