Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfs: move nfs_fhandle_hash to common include file

lockd needs to be able to hash filehandles for tracepoints. Move the
nfs_fhandle_hash() helper to a common nfs include file.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by

Jeff Layton and committed by
Chuck Lever
e59fb674 244cc191

+20 -15
-15
fs/nfs/internal.h
··· 846 846 } 847 847 848 848 #ifdef CONFIG_CRC32 849 - /** 850 - * nfs_fhandle_hash - calculate the crc32 hash for the filehandle 851 - * @fh - pointer to filehandle 852 - * 853 - * returns a crc32 hash for the filehandle that is compatible with 854 - * the one displayed by "wireshark". 855 - */ 856 - static inline u32 nfs_fhandle_hash(const struct nfs_fh *fh) 857 - { 858 - return ~crc32_le(0xFFFFFFFF, &fh->data[0], fh->size); 859 - } 860 849 static inline u32 nfs_stateid_hash(const nfs4_stateid *stateid) 861 850 { 862 851 return ~crc32_le(0xFFFFFFFF, &stateid->other[0], 863 852 NFS4_STATEID_OTHER_SIZE); 864 853 } 865 854 #else 866 - static inline u32 nfs_fhandle_hash(const struct nfs_fh *fh) 867 - { 868 - return 0; 869 - } 870 855 static inline u32 nfs_stateid_hash(nfs4_stateid *stateid) 871 856 { 872 857 return 0;
+20
include/linux/nfs.h
··· 10 10 11 11 #include <linux/sunrpc/msg_prot.h> 12 12 #include <linux/string.h> 13 + #include <linux/crc32.h> 13 14 #include <uapi/linux/nfs.h> 14 15 15 16 /* ··· 45 44 /* used by direct.c to mark verf as invalid */ 46 45 NFS_INVALID_STABLE_HOW = -1 47 46 }; 47 + 48 + #ifdef CONFIG_CRC32 49 + /** 50 + * nfs_fhandle_hash - calculate the crc32 hash for the filehandle 51 + * @fh - pointer to filehandle 52 + * 53 + * returns a crc32 hash for the filehandle that is compatible with 54 + * the one displayed by "wireshark". 55 + */ 56 + static inline u32 nfs_fhandle_hash(const struct nfs_fh *fh) 57 + { 58 + return ~crc32_le(0xFFFFFFFF, &fh->data[0], fh->size); 59 + } 60 + #else /* CONFIG_CRC32 */ 61 + static inline u32 nfs_fhandle_hash(const struct nfs_fh *fh) 62 + { 63 + return 0; 64 + } 65 + #endif /* CONFIG_CRC32 */ 48 66 #endif /* _LINUX_NFS_H */