aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/fscache.c24
-rw-r--r--fs/nfs/iostat.h5
2 files changed, 17 insertions, 12 deletions
diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c
index 3ef01f0ba0bc..d63bea8bbfbb 100644
--- a/fs/nfs/fscache.c
+++ b/fs/nfs/fscache.c
@@ -269,8 +269,8 @@ int nfs_fscache_release_page(struct page *page, gfp_t gfp)
269 if (!fscache_maybe_release_page(cookie, page, gfp)) 269 if (!fscache_maybe_release_page(cookie, page, gfp))
270 return 0; 270 return 0;
271 271
272 nfs_add_fscache_stats(page->mapping->host, 272 nfs_inc_fscache_stats(page->mapping->host,
273 NFSIOS_FSCACHE_PAGES_UNCACHED, 1); 273 NFSIOS_FSCACHE_PAGES_UNCACHED);
274 } 274 }
275 275
276 return 1; 276 return 1;
@@ -293,8 +293,8 @@ void __nfs_fscache_invalidate_page(struct page *page, struct inode *inode)
293 293
294 BUG_ON(!PageLocked(page)); 294 BUG_ON(!PageLocked(page));
295 fscache_uncache_page(cookie, page); 295 fscache_uncache_page(cookie, page);
296 nfs_add_fscache_stats(page->mapping->host, 296 nfs_inc_fscache_stats(page->mapping->host,
297 NFSIOS_FSCACHE_PAGES_UNCACHED, 1); 297 NFSIOS_FSCACHE_PAGES_UNCACHED);
298} 298}
299 299
300/* 300/*
@@ -343,19 +343,19 @@ int __nfs_readpage_from_fscache(struct nfs_open_context *ctx,
343 case 0: /* read BIO submitted (page in fscache) */ 343 case 0: /* read BIO submitted (page in fscache) */
344 dfprintk(FSCACHE, 344 dfprintk(FSCACHE,
345 "NFS: readpage_from_fscache: BIO submitted\n"); 345 "NFS: readpage_from_fscache: BIO submitted\n");
346 nfs_add_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_OK, 1); 346 nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_OK);
347 return ret; 347 return ret;
348 348
349 case -ENOBUFS: /* inode not in cache */ 349 case -ENOBUFS: /* inode not in cache */
350 case -ENODATA: /* page not in cache */ 350 case -ENODATA: /* page not in cache */
351 nfs_add_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_FAIL, 1); 351 nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_FAIL);
352 dfprintk(FSCACHE, 352 dfprintk(FSCACHE,
353 "NFS: readpage_from_fscache %d\n", ret); 353 "NFS: readpage_from_fscache %d\n", ret);
354 return 1; 354 return 1;
355 355
356 default: 356 default:
357 dfprintk(FSCACHE, "NFS: readpage_from_fscache %d\n", ret); 357 dfprintk(FSCACHE, "NFS: readpage_from_fscache %d\n", ret);
358 nfs_add_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_FAIL, 1); 358 nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_FAIL);
359 } 359 }
360 return ret; 360 return ret;
361} 361}
@@ -429,11 +429,11 @@ void __nfs_readpage_to_fscache(struct inode *inode, struct page *page, int sync)
429 429
430 if (ret != 0) { 430 if (ret != 0) {
431 fscache_uncache_page(nfs_i_fscache(inode), page); 431 fscache_uncache_page(nfs_i_fscache(inode), page);
432 nfs_add_fscache_stats(inode, 432 nfs_inc_fscache_stats(inode,
433 NFSIOS_FSCACHE_PAGES_WRITTEN_FAIL, 1); 433 NFSIOS_FSCACHE_PAGES_WRITTEN_FAIL);
434 nfs_add_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_UNCACHED, 1); 434 nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_UNCACHED);
435 } else { 435 } else {
436 nfs_add_fscache_stats(inode, 436 nfs_inc_fscache_stats(inode,
437 NFSIOS_FSCACHE_PAGES_WRITTEN_OK, 1); 437 NFSIOS_FSCACHE_PAGES_WRITTEN_OK);
438 } 438 }
439} 439}
diff --git a/fs/nfs/iostat.h b/fs/nfs/iostat.h
index c5832487c456..0cb806fbd4c4 100644
--- a/fs/nfs/iostat.h
+++ b/fs/nfs/iostat.h
@@ -55,6 +55,11 @@ static inline void nfs_add_fscache_stats(struct inode *inode,
55{ 55{
56 this_cpu_add(NFS_SERVER(inode)->io_stats->fscache[stat], addend); 56 this_cpu_add(NFS_SERVER(inode)->io_stats->fscache[stat], addend);
57} 57}
58static inline void nfs_inc_fscache_stats(struct inode *inode,
59 enum nfs_stat_fscachecounters stat)
60{
61 this_cpu_inc(NFS_SERVER(inode)->io_stats->fscache[stat]);
62}
58#endif 63#endif
59 64
60static inline struct nfs_iostats __percpu *nfs_alloc_iostats(void) 65static inline struct nfs_iostats __percpu *nfs_alloc_iostats(void)