From: Chuck Lever Date: Sun, 1 Jul 2007 16:12:14 +0000 (-0400) Subject: NFS: Clean up nfs_size_to_loff_t() X-Git-Tag: v2.6.23-rc1~1073^2~29 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=433c92379d9c2c59c2ebc7628fe4fb02cfc2daf8;p=linux-2.6 NFS: Clean up nfs_size_to_loff_t() Use the same file size limit that lockd uses. Signed-off-by: Chuck Lever Signed-off-by: Trond Myklebust --- diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index e94971040d..7deb5b0347 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -503,12 +503,10 @@ extern int nfsroot_mount(struct sockaddr_in *, char *, struct nfs_fh *, * inline functions */ -static inline loff_t -nfs_size_to_loff_t(__u64 size) +static inline loff_t nfs_size_to_loff_t(__u64 size) { - loff_t maxsz = (((loff_t) ULONG_MAX) << PAGE_CACHE_SHIFT) + PAGE_CACHE_SIZE - 1; - if (size > maxsz) - return maxsz; + if (size > (__u64) OFFSET_MAX - 1) + return OFFSET_MAX - 1; return (loff_t) size; }