Skip to contentSkip to conversation

jfs should use MAX_LFS_FILESIZE when calculating s_maxbytes

PATCH In review Dave Kleikamp 2 participants 2 messages Aug 31, 2017

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

PATCH 1/1 jfs should use MAX_LFS_FILESIZE when calculating s_maxbytes

jfs had previously avoided the use of MAX_LFS_FILESIZE because it hadn't accounted for the whole 32-bit index range on 32-bit systems. That has been fixed, so we can simplify the code now.

Suggested by Andreas Dilger.

---
Linus,
If you don't want to pick this up now, I'll push it in the next merge window.

 fs/jfs/super.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
fs/jfs/super.c +3 -9
index 78b41e1d5c67..60726ae7cf26 100644
@@ -619,16 +619,10 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
 	if (!sb->s_root)
 		goto out_no_root;
 
-	/* logical blocks are represented by 40 bits in pxd_t, etc. */
-	sb->s_maxbytes = ((u64) sb->s_blocksize) << 40;
-#if BITS_PER_LONG == 32
-	/*
-	 * Page cache is indexed by long.
-	 * I would use MAX_LFS_FILESIZE, but it's only half as big
+	/* logical blocks are represented by 40 bits in pxd_t, etc.
+	 * and page cache is indexed by long
 	 */
-	sb->s_maxbytes = min(((u64) PAGE_SIZE << 32) - 1,
-			     (u64)sb->s_maxbytes);
-#endif
+	sb->s_maxbytes = min(((loff_t)sb->s_blocksize) << 40, MAX_LFS_FILESIZE);
 	sb->s_time_gran = 1;
 	return 0;
 
Signature · 1 line
2.14.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Dave Kleikamp

jfs had previously avoided the use of MAX_LFS_FILESIZE because it hadn't accounted for the whole 32-bit index range on 32-bit systems. That has been fixed, so we can simplify the code now.

Suggested by Andreas Dilger.

Quoted 34 lines

---
Linus,
If you don't want to pick this up now, I'll push it in the next merge window.

fs/jfs/super.c | 12 +++---------

1 file changed, 3 insertions(+), 9 deletions(-)
fs/jfs/super.c +3 -10
index 78b41e1d5c67..60726ae7cf26 100644
@@ -619,16 +619,10 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
 	if (!sb->s_root)
 		goto out_no_root;
 
-	/* logical blocks are represented by 40 bits in pxd_t, etc. */
-	sb->s_maxbytes = ((u64) sb->s_blocksize) << 40;
-#if BITS_PER_LONG == 32
-	/*
-	 * Page cache is indexed by long.
-	 * I would use MAX_LFS_FILESIZE, but it's only half as big
+	/* logical blocks are represented by 40 bits in pxd_t, etc.
+	 * and page cache is indexed by long
 	 */
-	sb->s_maxbytes = min(((u64) PAGE_SIZE << 32) - 1,
-			     (u64)sb->s_maxbytes);
-#endif
+	sb->s_maxbytes = min(((loff_t)sb->s_blocksize) << 40, MAX_LFS_FILESIZE);
 	sb->s_time_gran = 1;
 	return 0;
 
--
Quoted 2 lines

2.14.1

Cheers, Andreas