diff options
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r-- | fs/nfs/inode.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index ba03b790814..0337554f156 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
40 | #include <linux/compat.h> | 40 | #include <linux/compat.h> |
41 | #include <linux/freezer.h> | 41 | #include <linux/freezer.h> |
42 | #include <linux/crc32.h> | ||
42 | 43 | ||
43 | #include <asm/system.h> | 44 | #include <asm/system.h> |
44 | #include <asm/uaccess.h> | 45 | #include <asm/uaccess.h> |
@@ -1045,7 +1046,23 @@ struct nfs_fh *nfs_alloc_fhandle(void) | |||
1045 | return fh; | 1046 | return fh; |
1046 | } | 1047 | } |
1047 | 1048 | ||
1048 | /** | 1049 | #ifdef RPC_DEBUG |
1050 | /* | ||
1051 | * _nfs_display_fhandle_hash - calculate the crc32 hash for the filehandle | ||
1052 | * in the same way that wireshark does | ||
1053 | * | ||
1054 | * @fh: file handle | ||
1055 | * | ||
1056 | * For debugging only. | ||
1057 | */ | ||
1058 | u32 _nfs_display_fhandle_hash(const struct nfs_fh *fh) | ||
1059 | { | ||
1060 | /* wireshark uses 32-bit AUTODIN crc and does a bitwise | ||
1061 | * not on the result */ | ||
1062 | return ~crc32(0xFFFFFFFF, &fh->data[0], fh->size); | ||
1063 | } | ||
1064 | |||
1065 | /* | ||
1049 | * _nfs_display_fhandle - display an NFS file handle on the console | 1066 | * _nfs_display_fhandle - display an NFS file handle on the console |
1050 | * | 1067 | * |
1051 | * @fh: file handle to display | 1068 | * @fh: file handle to display |
@@ -1053,7 +1070,6 @@ struct nfs_fh *nfs_alloc_fhandle(void) | |||
1053 | * | 1070 | * |
1054 | * For debugging only. | 1071 | * For debugging only. |
1055 | */ | 1072 | */ |
1056 | #ifdef RPC_DEBUG | ||
1057 | void _nfs_display_fhandle(const struct nfs_fh *fh, const char *caption) | 1073 | void _nfs_display_fhandle(const struct nfs_fh *fh, const char *caption) |
1058 | { | 1074 | { |
1059 | unsigned short i; | 1075 | unsigned short i; |
@@ -1063,7 +1079,8 @@ void _nfs_display_fhandle(const struct nfs_fh *fh, const char *caption) | |||
1063 | return; | 1079 | return; |
1064 | } | 1080 | } |
1065 | 1081 | ||
1066 | printk(KERN_DEFAULT "%s at %p is %u bytes:\n", caption, fh, fh->size); | 1082 | printk(KERN_DEFAULT "%s at %p is %u bytes, crc: 0x%08x:\n", |
1083 | caption, fh, fh->size, _nfs_display_fhandle_hash(fh)); | ||
1067 | for (i = 0; i < fh->size; i += 16) { | 1084 | for (i = 0; i < fh->size; i += 16) { |
1068 | __be32 *pos = (__be32 *)&fh->data[i]; | 1085 | __be32 *pos = (__be32 *)&fh->data[i]; |
1069 | 1086 | ||