From: Eric Sandeen <sandeen@redhat.com>
To: Theodore Tso <tytso@mit.edu>,
ext4 development <linux-ext4@vger.kernel.org>
Subject: [PATCH] resize2fs: handle exactly-16T filesystems in resize2fs
Date: Wed, 15 Dec 2010 22:37:34 -0600 [thread overview]
Message-ID: <4D09978E.5050302@redhat.com> (raw)
Before we go whole-hog on 64-bit e2fsprogs, I wonder if this
is worth considering as a last-minute addition to the 1.41
stream. Currently, mke2fs will shave a block off an exactly-16T
device to fit*, but resize2fs does not do the same, leading
to some asymmetry. This patch fixes that up, and allows 16T
devices to be handled more gracefully in offline resize.
(in fact resize2fs will not even open a 16T device, today).
*commit 37d17a65ecb4615546b417038190a41bafca7c51
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
Index: e2fsprogs-1.41.12/resize/main.c
===================================================================
--- e2fsprogs-1.41.12.orig/resize/main.c
+++ e2fsprogs-1.41.12/resize/main.c
@@ -159,7 +159,7 @@ int main (int argc, char ** argv)
int print_min_size = 0;
int fd, ret;
blk_t new_size = 0;
- blk_t max_size = 0;
+ blk64_t max_size = 0;
blk_t min_size = 0;
io_manager io_ptr;
char *new_size_str = 0;
@@ -375,7 +375,7 @@ int main (int argc, char ** argv)
* defaults and for making sure the new filesystem doesn't
* exceed the partition size.
*/
- retval = ext2fs_get_device_size(device_name, fs->blocksize,
+ retval = ext2fs_get_device_size2(device_name, fs->blocksize,
&max_size);
if (retval) {
com_err(program_name, retval,
@@ -393,6 +393,14 @@ 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)
@@ -432,7 +441,7 @@ int main (int argc, char ** argv)
}
if (!force && (new_size > max_size)) {
fprintf(stderr, _("The containing partition (or device)"
- " is only %u (%dk) blocks.\nYou requested a new size"
+ " is only %llu (%dk) blocks.\nYou requested a new size"
" of %u blocks.\n\n"), max_size,
fs->blocksize / 1024, new_size);
exit(1);
next reply other threads:[~2010-12-16 4:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-16 4:37 Eric Sandeen [this message]
2010-12-16 9:00 ` [PATCH] resize2fs: handle exactly-16T filesystems in resize2fs Lukas Czerner
2010-12-16 14:57 ` Eric Sandeen
2010-12-17 0:15 ` Ted Ts'o
2010-12-17 8:06 ` Stephan Boettcher
2010-12-17 0:18 ` Ted Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D09978E.5050302@redhat.com \
--to=sandeen@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.