Skip to contentSkip to conversation

NFSv4.1 add nfs_inode book keeping for mdsthreshold

PATCH New [email protected] 1 participant 2 messages May 24, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover NFSv4.1 add nfs_inode book keeping for mdsthreshold

From: Andy Adamson <[email protected]>

Only resending NFSv4.1 add nfs_inode book keeping for mdsthreshold. Responded to Trond's comments.
I have not tested the directio nor the memmap io cases. The regular file i/o works as intended.

Andy Adamson (4):
NFSv4.1 mdsthreshold attribute xdr
NFSv4.1 cache mdsthreshold values on OPEN NFSv4.1 add nfs_inode book keeping for mdsthreshold NFSv4.1 test the mdsthreshold hint parameters

 fs/nfs/direct.c         |    2 +
 fs/nfs/file.c           |    1 +
 fs/nfs/inode.c          |    4 ++
 fs/nfs/nfs4proc.c       |   38 ++++++++++++--
 fs/nfs/nfs4xdr.c        |  125 ++++++++++++++++++++++++++++++++++++++++++++++-
 fs/nfs/pnfs.c           |   94 +++++++++++++++++++++++++++++++++++
 fs/nfs/pnfs.h           |   21 ++++++++
 fs/nfs/read.c           |    2 +
 include/linux/nfs4.h    |    7 +++
 include/linux/nfs_fs.h  |    4 ++
 include/linux/nfs_xdr.h |   10 ++++
 11 files changed, 301 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.7.6
#1 lore raw

PATCH 3/4 NFSv4.1 add nfs_inode book keeping for mdsthreshold

From: Andy Adamson <[email protected]>

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.

---
 fs/nfs/direct.c        |    2 ++
 fs/nfs/file.c          |    1 +
 fs/nfs/inode.c         |    2 ++
 fs/nfs/pnfs.c          |    3 +++
 fs/nfs/read.c          |    2 ++
 include/linux/nfs_fs.h |    3 +++
 6 files changed, 13 insertions(+), 0 deletions(-)
fs/nfs/direct.c +2 -0
index c47a46e..23d170b 100644
@@ -447,6 +447,7 @@ static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov,
 	result = nfs_direct_read_schedule_iovec(dreq, iov, nr_segs, pos);
 	if (!result)
 		result = nfs_direct_wait(dreq);
+	NFS_I(inode)->read_io += result;
 out_release:
 	nfs_direct_req_release(dreq);
 out:
@@ -785,6 +786,7 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
 		pos += vec->iov_len;
 	}
 	nfs_pageio_complete(&desc);
+	NFS_I(dreq->inode)->write_io += desc.pg_bytes_written;
 
 	/*
 	 * If no bytes were started, return the error, and let the
fs/nfs/file.c +1 -0
index 8eda8a6..56311ca 100644
@@ -424,6 +424,7 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,
 
 	if (status < 0)
 		return status;
+	NFS_I(mapping->host)->write_io += copied;
 	return copied;
 }
 
fs/nfs/inode.c +2 -0
index 889f7e5..a6f5fbb 100644
@@ -323,6 +323,8 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
 		inode->i_gid = -2;
 		inode->i_blocks = 0;
 		memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf));
+		nfsi->write_io = 0;
+		nfsi->read_io = 0;
 
 		nfsi->read_cache_jiffies = fattr->time_start;
 		nfsi->attr_gencount = fattr->gencount;
fs/nfs/pnfs.c +3 -0
index cbcb6ae..6620606 100644
@@ -395,6 +395,9 @@ mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
 	dprintk("%s:Begin lo %p\n", __func__, lo);
 
 	if (list_empty(&lo->plh_segs)) {
+		/* Reset MDS Threshold I/O counters */
+		NFS_I(lo->plh_inode)->write_io = 0;
+		NFS_I(lo->plh_inode)->read_io = 0;
 		if (!test_and_set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags))
 			put_layout_hdr_locked(lo);
 		return 0;
fs/nfs/read.c +2 -0
index 2cfdd77..86ced78 100644
@@ -152,6 +152,7 @@ int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode,
 	nfs_pageio_init_read(&pgio, inode, &nfs_async_read_completion_ops);
 	nfs_pageio_add_request(&pgio, new);
 	nfs_pageio_complete(&pgio);
+	NFS_I(inode)->read_io += pgio.pg_bytes_written;
 	return 0;
 }
 
@@ -656,6 +657,7 @@ int nfs_readpages(struct file *filp, struct address_space *mapping,
 	ret = read_cache_pages(mapping, pages, readpage_async_filler, &desc);
 
 	nfs_pageio_complete(&pgio);
+	NFS_I(inode)->read_io += pgio.pg_bytes_written;
 	npages = (pgio.pg_bytes_written + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
 	nfs_add_stats(inode, NFSIOS_READPAGES, npages);
 read_complete:
include/linux/nfs_fs.h +3 -0
index ca4a707..9d44860 100644
@@ -202,6 +202,9 @@ struct nfs_inode {
 	/* pNFS layout information */
 	struct pnfs_layout_hdr *layout;
 #endif /* CONFIG_NFS_V4*/
+	/* how many bytes have been written/read and how many bytes queued up */
+	__u64 write_io;
+	__u64 read_io;
 #ifdef CONFIG_NFS_FSCACHE
 	struct fscache_cookie	*fscache;
 #endif
Signature · 1 line
1.7.7.6