linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: andros@netapp.com
To: trond.myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, Andy Adamson <andros@netapp.com>
Subject: [PATCH 3/4] NFSv4.1 add nfs_inode book keeping for mdsthreshold
Date: Wed, 23 May 2012 05:02:36 -0400	[thread overview]
Message-ID: <1337763757-1566-3-git-send-email-andros@netapp.com> (raw)
In-Reply-To: <1337763757-1566-1-git-send-email-andros@netapp.com>

From: Andy Adamson <andros@netapp.com>

Keep track of the number of bytes read or written, including those queued
up to be flushed. For use by mdsthreshold i/o size hints.

No locking needed as this is used as hint information.

Signed-off-by: Andy Adamson <andros@netapp.com>
---
 fs/nfs/file.c          |    8 ++++++--
 fs/nfs/inode.c         |    2 ++
 fs/nfs/pnfs.c          |    3 +++
 include/linux/nfs_fs.h |    3 +++
 4 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 8eda8a6..c4cc096 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -203,8 +203,10 @@ nfs_file_read(struct kiocb *iocb, const struct iovec *iov,
 	result = nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping);
 	if (!result) {
 		result = generic_file_aio_read(iocb, iov, nr_segs, pos);
-		if (result > 0)
+		if (result > 0) {
+			NFS_I(inode)->read_io += result;
 			nfs_add_stats(inode, NFSIOS_NORMALREADBYTES, result);
+		}
 	}
 	return result;
 }
@@ -613,8 +615,10 @@ static ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov,
 		if (err < 0)
 			result = err;
 	}
-	if (result > 0)
+	if (result > 0) {
+		NFS_I(inode)->write_io += written;
 		nfs_add_stats(inode, NFSIOS_NORMALWRITTENBYTES, written);
+	}
 out:
 	return result;
 
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 889f7e5..a6f5fbb 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -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;
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index cbcb6ae..6620606 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -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;
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index ca4a707..c6954ac 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -201,6 +201,9 @@ struct nfs_inode {
 
 	/* pNFS layout information */
 	struct pnfs_layout_hdr *layout;
+	/* how many bytes have been written/read and how many bytes queued up */
+	__u64 write_io;
+	__u64 read_io;
 #endif /* CONFIG_NFS_V4*/
 #ifdef CONFIG_NFS_FSCACHE
 	struct fscache_cookie	*fscache;
-- 
1.7.7.6


  parent reply	other threads:[~2012-05-23 13:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-23  9:02 [PATCH 1/4] NFSv4.1 mdsthreshold attribute xdr andros
2012-05-23  9:02 ` [PATCH 2/4] NFSv4.1 cache mdsthreshold values on OPEN andros
2012-05-23  9:02 ` andros [this message]
2012-05-23 18:19   ` [PATCH 3/4] NFSv4.1 add nfs_inode book keeping for mdsthreshold Myklebust, Trond
2012-05-23 18:41     ` Adamson, Andy
2012-05-23  9:02 ` [PATCH 4/4] NFSv4.1 test the mdsthreshold hint parameters andros
2012-05-23 13:25   ` Boaz Harrosh
  -- strict thread matches above, loose matches on Subject: below --
2012-05-24 17:13 [PATCH 0/4] NFSv4.1 add nfs_inode book keeping for mdsthreshold andros
2012-05-24 17:13 ` [PATCH 3/4] " andros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1337763757-1566-3-git-send-email-andros@netapp.com \
    --to=andros@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@netapp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).