linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: TR Reardon <thomas_reardon@hotmail.com>
Cc: "tytso@mit.edu" <tytso@mit.edu>,
	"linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 19/34] resize2fs: convert fs to and from 64bit mode
Date: Sun, 14 Sep 2014 10:50:52 -0700	[thread overview]
Message-ID: <20140914175052.GF10150@birch.djwong.org> (raw)
In-Reply-To: <BAY179-W70F5EE403F82604CE977F9FDCB0@phx.gbl>

On Sun, Sep 14, 2014 at 01:34:14PM -0400, TR Reardon wrote:
> > Subject: [PATCH 19/34] resize2fs: convert fs to and from 64bit mode
> > From: darrick.wong@oracle.com
> > To: tytso@mit.edu; darrick.wong@oracle.com
> > CC: linux-ext4@vger.kernel.org
> > Date: Sat, 13 Sep 2014 15:13:18 -0700
> >
> > resize2fs does its magic by loading a filesystem, duplicating the
> > in-memory image of that fs, moving relevant blocks out of the way of
> > whatever new metadata get created, and finally writing everything back
> > out to disk. Enabling 64bit mode enlarges the group descriptors,
> > which makes resize2fs a reasonable vehicle for taking care of the rest
> > of the bookkeeping requirements, so add to resize2fs the ability to
> > convert a filesystem to 64bit mode and back.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> > resize/main.c | 40 ++++++
> > resize/resize2fs.8.in | 18 +++
> > resize/resize2fs.c | 326 ++++++++++++++++++++++++++++++++++++++++++++++++-
> > resize/resize2fs.h | 3
> > 4 files changed, 379 insertions(+), 8 deletions(-)
> >
> >
> > diff --git a/resize/main.c b/resize/main.c
> > index c107028..9fea3d8 100644
> > --- a/resize/main.c
> > +++ b/resize/main.c
> > @@ -42,7 +42,7 @@ static char *device_name, *io_options;
> > static void usage (char *prog)
> > {
> > fprintf (stderr, _("Usage: %s [-d debug_flags] [-f] [-F] [-M] [-P] "
> > - "[-p] device [new_size]\n\n"), prog);
> > + "[-p] device [-b|-s|new_size]\n\n"), prog);
> >
> > exit (1);
> > }
> > @@ -200,7 +200,7 @@ int main (int argc, char ** argv)
> > if (argc && *argv)
> > program_name = *argv;
> >
> > - while ((c = getopt (argc, argv, "d:fFhMPpS:")) != EOF) {
> > + while ((c = getopt(argc, argv, "d:fFhMPpS:bs")) != EOF) {
> > switch (c) {
> > case 'h':
> > usage(program_name);
> > @@ -226,6 +226,12 @@ int main (int argc, char ** argv)
> > case 'S':
> > use_stride = atoi(optarg);
> > break;
> > + case 'b':
> > + flags |= RESIZE_ENABLE_64BIT;
> > + break;
> > + case 's':
> > + flags |= RESIZE_DISABLE_64BIT;
> > + break;
> > default:
> > usage(program_name);
> > }
> > @@ -389,6 +395,10 @@ int main (int argc, char ** argv)
> > if (sys_page_size> fs->blocksize)
> > new_size &= ~((sys_page_size / fs->blocksize)-1);
> > }
> > + /* If changing 64bit, don't change the filesystem size. */
> > + if (flags & (RESIZE_DISABLE_64BIT | RESIZE_ENABLE_64BIT)) {
> > + new_size = ext2fs_blocks_count(fs->super);
> > + }
> > if (!EXT2_HAS_INCOMPAT_FEATURE(fs->super,
> > EXT4_FEATURE_INCOMPAT_64BIT)) {
> > /* Take 16T down to 2^32-1 blocks */
> > @@ -440,7 +450,31 @@ int main (int argc, char ** argv)
> > fs->blocksize / 1024, new_size);
> > exit(1);
> > }
> > - if (new_size == ext2fs_blocks_count(fs->super)) {
> > + if ((flags & RESIZE_DISABLE_64BIT) && (flags & RESIZE_ENABLE_64BIT)) {
> > + fprintf(stderr, _("Cannot set and unset 64bit feature.\n"));
> > + exit(1);
> > + } else if (flags & (RESIZE_DISABLE_64BIT | RESIZE_ENABLE_64BIT)) {
> > + new_size = ext2fs_blocks_count(fs->super);
> 
> 
> Redundant to assignment just above? 		 	   		  --

Yeah, I think so.  I think the original purpose was to reset new_size after the
size checks, but at the moment the only way that happens is if we've a 32bit FS
with exactly 2^32 blocks, which shouldn't be possible.

--D

> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-09-14 17:50 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-13 22:11 [PATCH 00/34] e2fsprogs Summer 2014 patchbomb, part 6 Darrick J. Wong
2014-09-13 22:11 ` [PATCH 01/34] e2fsck: offer to clear overlapping extents Darrick J. Wong
2014-09-19  1:45   ` Theodore Ts'o
2014-09-13 22:11 ` [PATCH 02/34] e2fsck: fix sliding the directory block down on bigalloc Darrick J. Wong
2014-09-19  1:45   ` Theodore Ts'o
2014-09-13 22:11 ` [PATCH 03/34] misc: zero s_jnl_blocks when adding journal online or removing external journal Darrick J. Wong
2014-09-19  1:45   ` Theodore Ts'o
2014-09-13 22:11 ` [PATCH 04/34] libext2fs: ext2fs_new_block2() should call alloc_block hook Darrick J. Wong
2014-09-13 22:11 ` [PATCH 05/34] debugfs: manage needs_recover feature when messing with the journal Darrick J. Wong
2014-09-19  6:01   ` Theodore Ts'o
2014-09-13 22:11 ` [PATCH 06/34] debugfs: add LIBINTL to debugfs link command Darrick J. Wong
2014-09-19  4:46   ` Theodore Ts'o
2014-10-17 21:07     ` Darrick J. Wong
2014-10-18 16:10       ` Theodore Ts'o
2014-09-13 22:11 ` [PATCH 07/34] ext2fs: add readahead method to improve scanning Darrick J. Wong
2014-09-19 16:15   ` Theodore Ts'o
2014-09-13 22:12 ` [PATCH 08/34] libext2fs/e2fsck: provide routines to read-ahead metadata Darrick J. Wong
2014-09-13 22:12 ` [PATCH 09/34] e2fsck: read-ahead metadata during passes 1, 2, and 4 Darrick J. Wong
2014-09-13 22:12 ` [PATCH 10/34] dumpe2fs: provide a machine-readable group-only mode Darrick J. Wong
2014-09-19 16:17   ` Theodore Ts'o
2014-09-13 22:12 ` [PATCH 11/34] dumpe2fs: output cleanup Darrick J. Wong
2014-09-19 16:22   ` Theodore Ts'o
2014-09-19 20:00     ` Darrick J. Wong
2014-10-13 18:04       ` Darrick J. Wong
2014-09-13 22:12 ` [PATCH 12/34] misc: move check_plausibility into a separate file Darrick J. Wong
2014-09-19 22:16   ` Theodore Ts'o
2014-09-13 22:12 ` [PATCH 13/34] misc: add plausibility checks to debugfs/tune2fs/dumpe2fs/e2fsck Darrick J. Wong
2014-09-19 23:00   ` Theodore Ts'o
2014-09-13 22:12 ` [PATCH 14/34] misc: use libmagic when libblkid can't identify something Darrick J. Wong
2014-09-21  5:29   ` Theodore Ts'o
2014-09-13 22:12 ` [PATCH 15/34] libext2fs: support BLKZEROOUT/FALLOC_FL_ZERO_RANGE in ext2fs_zero_blocks Darrick J. Wong
2014-09-22  2:51   ` Theodore Ts'o
2014-09-29 18:58     ` Darrick J. Wong
2014-10-14  2:58   ` Darrick J. Wong
2014-10-18 16:32   ` Theodore Ts'o
2014-10-20 23:37     ` Darrick J. Wong
2014-09-13 22:12 ` [PATCH 16/34] libext2fs/e2fsck: refactor everyone who writes zero blocks to disk Darrick J. Wong
2014-10-13 10:09   ` Theodore Ts'o
2014-10-13 17:09     ` Darrick J. Wong
2014-09-13 22:13 ` [PATCH 17/34] libext2fs: support allocating uninit blocks in bmap2() Darrick J. Wong
2014-10-13 14:35   ` Theodore Ts'o
2014-10-13 16:56     ` Darrick J. Wong
2014-10-13 18:34       ` Darrick J. Wong
2014-09-13 22:13 ` [PATCH 18/34] libext2fs: file IO routines should handle uninit blocks Darrick J. Wong
2014-09-13 22:13 ` [PATCH 19/34] resize2fs: convert fs to and from 64bit mode Darrick J. Wong
2014-09-14 17:34   ` TR Reardon
2014-09-14 17:50     ` Darrick J. Wong [this message]
2014-09-13 22:13 ` [PATCH 20/34] resize2fs: adjust reserved_gdt_blocks when changing group descriptor size Darrick J. Wong
2014-09-13 22:13 ` [PATCH 21/34] tests: test resize2fs 32->64 and 64->32bit conversion code Darrick J. Wong
2014-09-13 22:13 ` [PATCH 22/34] libext2fs: find inode goal when allocating blocks Darrick J. Wong
2014-09-13 22:13 ` [PATCH 23/34] libext2fs: find/alloc a range of empty blocks Darrick J. Wong
2014-09-13 22:13 ` [PATCH 24/34] libext2fs: add new hooks to support large allocations Darrick J. Wong
2014-09-13 22:14 ` [PATCH 25/34] libext2fs: implement fallocate Darrick J. Wong
2014-09-13 22:14 ` [PATCH 26/34] libext2fs: use fallocate for creating journals and hugefiles Darrick J. Wong
2014-09-13 22:14 ` [PATCH 27/34] debugfs: implement fallocate Darrick J. Wong
2014-09-13 22:14 ` [PATCH 28/34] tests: test debugfs punch command Darrick J. Wong
2014-09-19 16:26   ` Theodore Ts'o
2014-09-19 20:01     ` Darrick J. Wong
2014-09-13 22:14 ` [PATCH 30/34] fuse2fs: translate ACL structures Darrick J. Wong
2014-09-13 22:14 ` [PATCH 31/34] fuse2fs: handle 64-bit dates correctly Darrick J. Wong
2014-09-13 22:14 ` [PATCH 32/34] fuse2fs: implement fallocate Darrick J. Wong
2014-09-13 22:15 ` [PATCH 34/34] tests: enable using fuse2fs with metadata checksum test Darrick J. Wong
2014-09-14 17:19 ` [PATCH 35/34] e2fsck: free bh when descriptor block checksum fails Darrick J. Wong
2014-09-14 19:11   ` Eric Sandeen
2014-09-19  1:46     ` Theodore Ts'o
2014-09-18 19:09 ` [PATCH 36/34] misc: fix Coverity complaints Darrick J. Wong
2014-09-19  1:47   ` Theodore 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=20140914175052.GF10150@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=thomas_reardon@hotmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).