summary refs log tree commit diff
path: root/fs/ext2
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-03-25 17:38:15 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2022-03-25 17:38:15 -0700
commita452c4eb404df8a7f2a79a37ac77b90b6db1a2c9 (patch)
tree0acdbe2d3c766a23ac24cba0d8d842260af4a514 /fs/ext2
parenta8988507e577a89ccaf66b48ea645bcf6e861270 (diff)
parent31e9dc49c2c03c3f166248f16dbe1248ffb5c6a9 (diff)
downloadlinux-a452c4eb404df8a7f2a79a37ac77b90b6db1a2c9.tar.gz
Merge tag 'fs_for_v5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull reiserfs updates from Jan Kara:
 "The biggest change in this pull is the addition of a deprecation
  message about reiserfs with the outlook that we'd eventually be able
  to remove it from the kernel. Because it is practically unmaintained
  and untested and odd enough that people don't want to bother with it
  anymore...

  Otherwise there are small udf and ext2 fixes"

* tag 'fs_for_v5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  udf: remove redundant assignment of variable etype
  reiserfs: Deprecate reiserfs
  ext2: correct max file size computing
  reiserfs: get rid of AOP_FLAG_CONT_EXPAND flag
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/super.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index e48aaf52ce93..f6a19f6d9f6d 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -753,8 +753,12 @@ static loff_t ext2_max_size(int bits)
 	res += 1LL << (bits-2);
 	res += 1LL << (2*(bits-2));
 	res += 1LL << (3*(bits-2));
+	/* Compute how many metadata blocks are needed */
+	meta_blocks = 1;
+	meta_blocks += 1 + ppb;
+	meta_blocks += 1 + ppb + ppb * ppb;
 	/* Does block tree limit file size? */
-	if (res < upper_limit)
+	if (res + meta_blocks <= upper_limit)
 		goto check_lfs;
 
 	res = upper_limit;