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

NFSv4.1 add nfs_inode book keeping for mdsthreshold

Keep track of the number of bytes read or written via buffered, direct, and
mem-mapped i/o for use by mdsthreshold size_io hints.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

authored by

Andy Adamson and committed by
Trond Myklebust
2701d086 82be417a

+13
+2
fs/nfs/direct.c
··· 447 447 result = nfs_direct_read_schedule_iovec(dreq, iov, nr_segs, pos); 448 448 if (!result) 449 449 result = nfs_direct_wait(dreq); 450 + NFS_I(inode)->read_io += result; 450 451 out_release: 451 452 nfs_direct_req_release(dreq); 452 453 out: ··· 786 785 pos += vec->iov_len; 787 786 } 788 787 nfs_pageio_complete(&desc); 788 + NFS_I(dreq->inode)->write_io += desc.pg_bytes_written; 789 789 790 790 /* 791 791 * If no bytes were started, return the error, and let the
+1
fs/nfs/file.c
··· 424 424 425 425 if (status < 0) 426 426 return status; 427 + NFS_I(mapping->host)->write_io += copied; 427 428 return copied; 428 429 } 429 430
+2
fs/nfs/inode.c
··· 323 323 inode->i_gid = -2; 324 324 inode->i_blocks = 0; 325 325 memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf)); 326 + nfsi->write_io = 0; 327 + nfsi->read_io = 0; 326 328 327 329 nfsi->read_cache_jiffies = fattr->time_start; 328 330 nfsi->attr_gencount = fattr->gencount;
+3
fs/nfs/pnfs.c
··· 395 395 dprintk("%s:Begin lo %p\n", __func__, lo); 396 396 397 397 if (list_empty(&lo->plh_segs)) { 398 + /* Reset MDS Threshold I/O counters */ 399 + NFS_I(lo->plh_inode)->write_io = 0; 400 + NFS_I(lo->plh_inode)->read_io = 0; 398 401 if (!test_and_set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags)) 399 402 put_layout_hdr_locked(lo); 400 403 return 0;
+2
fs/nfs/read.c
··· 152 152 nfs_pageio_init_read(&pgio, inode, &nfs_async_read_completion_ops); 153 153 nfs_pageio_add_request(&pgio, new); 154 154 nfs_pageio_complete(&pgio); 155 + NFS_I(inode)->read_io += pgio.pg_bytes_written; 155 156 return 0; 156 157 } 157 158 ··· 657 656 ret = read_cache_pages(mapping, pages, readpage_async_filler, &desc); 658 657 659 658 nfs_pageio_complete(&pgio); 659 + NFS_I(inode)->read_io += pgio.pg_bytes_written; 660 660 npages = (pgio.pg_bytes_written + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 661 661 nfs_add_stats(inode, NFSIOS_READPAGES, npages); 662 662 read_complete:
+3
include/linux/nfs_fs.h
··· 202 202 /* pNFS layout information */ 203 203 struct pnfs_layout_hdr *layout; 204 204 #endif /* CONFIG_NFS_V4*/ 205 + /* how many bytes have been written/read and how many bytes queued up */ 206 + __u64 write_io; 207 + __u64 read_io; 205 208 #ifdef CONFIG_NFS_FSCACHE 206 209 struct fscache_cookie *fscache; 207 210 #endif