Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfs: define nfs_inc_fscache_stats and using it as possible

Define and use nfs_inc_fscache_stats when plus one, which can save to
pass one parameter.

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>

authored by

Li RongQing and committed by
Trond Myklebust
e9f456ca 5a254d08

+17 -12
+12 -12
fs/nfs/fscache.c
··· 269 269 if (!fscache_maybe_release_page(cookie, page, gfp)) 270 270 return 0; 271 271 272 - nfs_add_fscache_stats(page->mapping->host, 273 - NFSIOS_FSCACHE_PAGES_UNCACHED, 1); 272 + nfs_inc_fscache_stats(page->mapping->host, 273 + NFSIOS_FSCACHE_PAGES_UNCACHED); 274 274 } 275 275 276 276 return 1; ··· 293 293 294 294 BUG_ON(!PageLocked(page)); 295 295 fscache_uncache_page(cookie, page); 296 - nfs_add_fscache_stats(page->mapping->host, 297 - NFSIOS_FSCACHE_PAGES_UNCACHED, 1); 296 + nfs_inc_fscache_stats(page->mapping->host, 297 + NFSIOS_FSCACHE_PAGES_UNCACHED); 298 298 } 299 299 300 300 /* ··· 343 343 case 0: /* read BIO submitted (page in fscache) */ 344 344 dfprintk(FSCACHE, 345 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 347 return ret; 348 348 349 349 case -ENOBUFS: /* inode not in cache */ 350 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 352 dfprintk(FSCACHE, 353 353 "NFS: readpage_from_fscache %d\n", ret); 354 354 return 1; 355 355 356 356 default: 357 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 360 return ret; 361 361 } ··· 429 429 430 430 if (ret != 0) { 431 431 fscache_uncache_page(nfs_i_fscache(inode), page); 432 - nfs_add_fscache_stats(inode, 433 - NFSIOS_FSCACHE_PAGES_WRITTEN_FAIL, 1); 434 - nfs_add_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_UNCACHED, 1); 432 + nfs_inc_fscache_stats(inode, 433 + NFSIOS_FSCACHE_PAGES_WRITTEN_FAIL); 434 + nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_UNCACHED); 435 435 } else { 436 - nfs_add_fscache_stats(inode, 437 - NFSIOS_FSCACHE_PAGES_WRITTEN_OK, 1); 436 + nfs_inc_fscache_stats(inode, 437 + NFSIOS_FSCACHE_PAGES_WRITTEN_OK); 438 438 } 439 439 }
+5
fs/nfs/iostat.h
··· 55 55 { 56 56 this_cpu_add(NFS_SERVER(inode)->io_stats->fscache[stat], addend); 57 57 } 58 + static 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 63 #endif 59 64 60 65 static inline struct nfs_iostats __percpu *nfs_alloc_iostats(void)