aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2012-03-01 17:01:31 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-03-02 17:18:08 -0500
commit20d27e929fb4790a339a4ddcc9a27f14db06055b (patch)
treee62d752180c2c7342d801f903c7f2ce2dd952075 /fs/nfs/inode.c
parent31b8e2aec099f22d40277c424d8c24b2a4c95fce (diff)
NFS: Add a client-side function to display NFS file handles
For debugging, introduce a simplistic function to print NFS file handles on the system console. The main function is hooked into the dprintk debugging facility, but you can directly call the helper, _nfs_display_fhandle(), if you want to print a handle unconditionally. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 6c662598f88..99a4f52c14b 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1046,6 +1046,51 @@ struct nfs_fh *nfs_alloc_fhandle(void)
1046} 1046}
1047 1047
1048/** 1048/**
1049 * _nfs_display_fhandle - display an NFS file handle on the console
1050 *
1051 * @fh: file handle to display
1052 * @caption: display caption
1053 *
1054 * For debugging only.
1055 */
1056#ifdef RPC_DEBUG
1057void _nfs_display_fhandle(const struct nfs_fh *fh, const char *caption)
1058{
1059 unsigned short i;
1060
1061 if (fh->size == 0 || fh == NULL) {
1062 printk(KERN_DEFAULT "%s at %p is empty\n", caption, fh);
1063 return;
1064 }
1065
1066 printk(KERN_DEFAULT "%s at %p is %u bytes:\n", caption, fh, fh->size);
1067 for (i = 0; i < fh->size; i += 16) {
1068 __be32 *pos = (__be32 *)&fh->data[i];
1069
1070 switch ((fh->size - i - 1) >> 2) {
1071 case 0:
1072 printk(KERN_DEFAULT " %08x\n",
1073 be32_to_cpup(pos));
1074 break;
1075 case 1:
1076 printk(KERN_DEFAULT " %08x %08x\n",
1077 be32_to_cpup(pos), be32_to_cpup(pos + 1));
1078 break;
1079 case 2:
1080 printk(KERN_DEFAULT " %08x %08x %08x\n",
1081 be32_to_cpup(pos), be32_to_cpup(pos + 1),
1082 be32_to_cpup(pos + 2));
1083 break;
1084 default:
1085 printk(KERN_DEFAULT " %08x %08x %08x %08x\n",
1086 be32_to_cpup(pos), be32_to_cpup(pos + 1),
1087 be32_to_cpup(pos + 2), be32_to_cpup(pos + 3));
1088 }
1089 }
1090}
1091#endif
1092
1093/**
1049 * nfs_inode_attrs_need_update - check if the inode attributes need updating 1094 * nfs_inode_attrs_need_update - check if the inode attributes need updating
1050 * @inode - pointer to inode 1095 * @inode - pointer to inode
1051 * @fattr - attributes 1096 * @fattr - attributes