summaryrefslogtreecommitdiff
path: root/resize
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2012-09-07 00:05:21 -0400
committerTheodore Ts'o <tytso@mit.edu>2012-09-13 23:04:44 -0400
commitea38e503073c2c541517ff5fb92135cc4a470a77 (patch)
tree048d4f47ce305e3b394ea2e7ba70e5c24734a47e /resize
parentab3f5c5aad6310be1d1891c05f1bc8cf7ccf0cef (diff)
downloade2fsprogs-ea38e503073c2c541517ff5fb92135cc4a470a77.tar.gz
resize2fs: enforce the 16TB limit on 32-bit file systems correctly
The 16TB limit must be enforced regardless of whether the new size is specified on the command line or implied by the size of the device, but only if the file system does not support 64-bit block sizes, or the kernel does not advertise support of meta_bg resizing. Previously we were unconditionally enforcing it when it was implied by the device size, but not if the new size was specified on the command line. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'resize')
-rw-r--r--resize/main.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/resize/main.c b/resize/main.c
index e6604f28..228e85ab 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -385,19 +385,23 @@ int main (int argc, char ** argv)
exit(1);
}
} else {
- /* Take down devices exactly 16T to 2^32-1 blocks */
- if (max_size == (1ULL << 32))
- max_size--;
- else if (max_size > (1ULL << 32)) {
- com_err(program_name, 0, _("New size too large to be "
- "expressed in 32 bits\n"));
- exit(1);
- }
new_size = max_size;
/* Round down to an even multiple of a pagesize */
if (sys_page_size > fs->blocksize)
new_size &= ~((sys_page_size / fs->blocksize)-1);
}
+ if (!EXT2_HAS_INCOMPAT_FEATURE(fs->super,
+ EXT4_FEATURE_INCOMPAT_64BIT)) {
+ /* Take 16T down to 2^32-1 blocks */
+ if (new_size == (1ULL << 32))
+ new_size--;
+ else if (new_size > (1ULL << 32)) {
+ com_err(program_name, 0,
+ _("New size too large to be "
+ "expressed in 32 bits\n"));
+ exit(1);
+ }
+ }
if (!force && new_size < min_size) {
com_err(program_name, 0,