aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorChuck Lever <cel@netapp.com>2006-03-20 13:44:14 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:14 -0500
commit91d5b47023b608227d605d1e916b29dd0215bff7 (patch)
tree31dbb285639ea68db3abc0c4129988f02d50f11a /fs/nfs/inode.c
parentd9ef5a8c26aab09762afce43df64736720b4860e (diff)
NFS: add I/O performance counters
Invoke the byte and event counter macros where we want to count bytes and events. Clean-up: fix a possible NULL dereference in nfs_lock, and simplify nfs_file_open. Test-plan: fsx and iozone on UP and SMP systems, with and without pre-emption. Watch for memory overwrite bugs, and performance loss (significantly more CPU required per op). Signed-off-by: Chuck Lever <cel@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 86b756f44e27..8ee74111e519 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -753,6 +753,8 @@ static void nfs_zap_caches_locked(struct inode *inode)
753 struct nfs_inode *nfsi = NFS_I(inode); 753 struct nfs_inode *nfsi = NFS_I(inode);
754 int mode = inode->i_mode; 754 int mode = inode->i_mode;
755 755
756 nfs_inc_stats(inode, NFSIOS_ATTRINVALIDATE);
757
756 NFS_ATTRTIMEO(inode) = NFS_MINATTRTIMEO(inode); 758 NFS_ATTRTIMEO(inode) = NFS_MINATTRTIMEO(inode);
757 NFS_ATTRTIMEO_UPDATE(inode) = jiffies; 759 NFS_ATTRTIMEO_UPDATE(inode) = jiffies;
758 760
@@ -940,6 +942,8 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
940 struct nfs_fattr fattr; 942 struct nfs_fattr fattr;
941 int error; 943 int error;
942 944
945 nfs_inc_stats(inode, NFSIOS_VFSSETATTR);
946
943 if (attr->ia_valid & ATTR_SIZE) { 947 if (attr->ia_valid & ATTR_SIZE) {
944 if (!S_ISREG(inode->i_mode) || attr->ia_size == i_size_read(inode)) 948 if (!S_ISREG(inode->i_mode) || attr->ia_size == i_size_read(inode))
945 attr->ia_valid &= ~ATTR_SIZE; 949 attr->ia_valid &= ~ATTR_SIZE;
@@ -993,6 +997,7 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr)
993 spin_unlock(&inode->i_lock); 997 spin_unlock(&inode->i_lock);
994 } 998 }
995 if ((attr->ia_valid & ATTR_SIZE) != 0) { 999 if ((attr->ia_valid & ATTR_SIZE) != 0) {
1000 nfs_inc_stats(inode, NFSIOS_SETATTRTRUNC);
996 inode->i_size = attr->ia_size; 1001 inode->i_size = attr->ia_size;
997 vmtruncate(inode, attr->ia_size); 1002 vmtruncate(inode, attr->ia_size);
998 } 1003 }
@@ -1278,6 +1283,7 @@ int nfs_attribute_timeout(struct inode *inode)
1278 */ 1283 */
1279int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) 1284int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
1280{ 1285{
1286 nfs_inc_stats(inode, NFSIOS_INODEREVALIDATE);
1281 if (!(NFS_I(inode)->cache_validity & (NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA)) 1287 if (!(NFS_I(inode)->cache_validity & (NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA))
1282 && !nfs_attribute_timeout(inode)) 1288 && !nfs_attribute_timeout(inode))
1283 return NFS_STALE(inode) ? -ESTALE : 0; 1289 return NFS_STALE(inode) ? -ESTALE : 0;
@@ -1294,6 +1300,7 @@ void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
1294 struct nfs_inode *nfsi = NFS_I(inode); 1300 struct nfs_inode *nfsi = NFS_I(inode);
1295 1301
1296 if (nfsi->cache_validity & NFS_INO_INVALID_DATA) { 1302 if (nfsi->cache_validity & NFS_INO_INVALID_DATA) {
1303 nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE);
1297 if (S_ISREG(inode->i_mode)) 1304 if (S_ISREG(inode->i_mode))
1298 nfs_sync_mapping(mapping); 1305 nfs_sync_mapping(mapping);
1299 invalidate_inode_pages2(mapping); 1306 invalidate_inode_pages2(mapping);
@@ -1615,6 +1622,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1615 1622
1616 /* Update attrtimeo value if we're out of the unstable period */ 1623 /* Update attrtimeo value if we're out of the unstable period */
1617 if (invalid & NFS_INO_INVALID_ATTR) { 1624 if (invalid & NFS_INO_INVALID_ATTR) {
1625 nfs_inc_stats(inode, NFSIOS_ATTRINVALIDATE);
1618 nfsi->attrtimeo = NFS_MINATTRTIMEO(inode); 1626 nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
1619 nfsi->attrtimeo_timestamp = jiffies; 1627 nfsi->attrtimeo_timestamp = jiffies;
1620 } else if (time_after(jiffies, nfsi->attrtimeo_timestamp+nfsi->attrtimeo)) { 1628 } else if (time_after(jiffies, nfsi->attrtimeo_timestamp+nfsi->attrtimeo)) {