Skip to contentSkip to conversation

NFS: Clean up nfs_size_to_loff_t()

PATCH In review Chuck Lever 1 participant 1 message May 25, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/10 NFS: Clean up nfs_size_to_loff_t()

Use the same file size limit that lockd uses, and replace a signed v. unsigned comparison.

---

 include/linux/nfs_fs.h |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
include/linux/nfs_fs.h +3 -5
index 0543439..457a22b 100644
@@ -505,12 +505,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;
 }
 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs