Commit Graph

32 Commits (master)

Author SHA1 Message Date
Vitaliy Filippov 63039f4bac Implement inode table resizing (not done yet, should split inode_scan_and_fix()) 2016-09-25 23:47:54 +03:00
Darrick J. Wong fe12931f8f resize2fs: convert fs to and from 64bit mode
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>
Cc: TR Reardon <thomas_reardon@hotmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-12-15 12:45:05 -05:00
Theodore Ts'o f404167dda Clean up sparse warnings
Mostly by adding static and removing excess extern qualifiers.  Also
convert a few remaining non-ANSI function declarations to ANSI.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-12-16 18:56:36 -05:00
Theodore Ts'o e231f17500 resize2fs: add debugging support for resize2fs -M calcuations
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-09-30 22:12:22 -04:00
Theodore Ts'o 1eb31c4885 resize2fs: add resource tracking as a debug option
Add a new debug flag which prints how much time is consumed by the
various parts of resize2fs's processing.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-03 09:03:53 -05:00
Valerie Aurora Henson 8728d50657 resize2fs: Fix up to be 64-bit block number safe
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-13 18:00:00 -04:00
Theodore Ts'o c09043f1ab resize2fs: Fix data corruption bug when shrinking the inode table for ext4
If we need to shrink the inode table, we need to make sure the inodes
contained in the part of the inode table we are vacating don't get
reused as part of the filesystem shrink operation.  This wasn't a
problem with ext3 filesystems, since the inode table was located in
the block group that was going away, so that location was not eligible
for reallocation.

However with ext4 filesystems with flex_bg enabled, it's possible for
a portion of the inode table in the last flex_bg group to be
deallocated, but in a part of the filesystem which could be used as
data blocks.  So we must mark those blocks as reserved to prevent
their reuse, and adjust the minimum filesystem size calculation to
assure that we don't shrink a filesystem too small for the resize
operation to succeed.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-04-18 22:32:03 -04:00
Theodore Ts'o efc6f628e1 Remove trailing whitespace for the entire source tree
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 23:07:54 -04:00
Josef Bacik 199ddaaa44 resize2fs: Add options to print (and resizing to) the minimum filesystem size
Add the -P option to print the minimum filesystem size and exit.

Add the -M option to force resizing the filesystem to the minimum
filesystem size.

Signed-off-by: Josef Back <jbacik@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-15 01:30:43 -04:00
Andreas Dilger de8f3a7621 Fix gcc -Wall warnings, especially on 64-bit systems
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-05-25 11:18:11 -04:00
Theodore Ts'o bf69235ad0 Add support for on-line resizing to resize2fs
If the filesystem is mounted, attempt to use the on-line resizing
ioctls to resize the filesystem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-17 19:45:45 -05:00
Theodore Ts'o a04eba3f88 Update to gettext 0.11.5. We now enable NLS support by default.
Fixed up support for using the internal intl library.
2003-05-03 16:35:17 -04:00
Theodore Ts'o 116db1b513 main.c (main): If we are resizing a plain file which is smaller
than the requested size, then we will attempt to
	transparently extend the filesize in a sparse fashion by
	writing a block at the end of the requested part of the
	filesystem.

main.c (main), resize2fs.c (resize_fs), resize2fs.h: Change the
	function prototype of resize_fs() so that it can modify
	the new_size parameter with the actual new size of the
	filesystem after the resize operation.  (This can
	sometimes be less than the requested new size if there
	isn't enough space to create the necessary block group
	metadata for that last bit of disk space.)  Resize2fs now
	prints the actual new size of the filesystem when it finishes.
2002-04-01 01:28:30 -05:00
Theodore Ts'o 54c637d4d2 Many files:
badblocks.c, chattr.c, dumpe2fs.c, e2image.c, findsuper.c, lsattr.c,
  	mke2fs.c, mklost+found.c, tune2fs.c, util.c: Change location of
  	ext2_fs.h to be ext2fs/ext2_fs.h
ChangeLog, Makefile.in, resize2fs.h:
  resize2fs.h: Change location of ext2_fs.h to be ext2fs/ext2_fs.h
ChangeLog, Makefile.in, debugfs.h:
  debugfs.h: Change location of ext2_fs.h to be ext2fs/ext2_fs.h
ChangeLog, Makefile.in, e2fsck.h, scantest.c:
  e2fsck.h, scantest.c: Change location of ext2_fs.h to be
  	ext2fs/ext2_fs.h
ChangeLog, Makefile.in, tst_uuid.c, uuid_time.c:
  tst_uuid.c, uuid_time.c: Remove unneeded #include of ext2_fs.h
ChangeLog, Makefile.in, e2p.h:
  e2p.h: Change location of ext2_fs.h to be ext2fs/ext2_fs.h
ChangeLog, Makefile.in, test_icount.c, test_rel.c:
  test_icount.c, test_rel.c: Change location of ext2_fs.h to be
  	ext2fs/ext2_fs.h
2001-05-14 11:45:38 +00:00
Theodore Ts'o a13575f4d2 ChangeLog, extent.c, main.c, resize2fs.c, resize2fs.h:
main.c, resize2fs.c, resize2fs.h, extent.c: Add NLS support.
2000-06-12 22:06:16 +00:00
Theodore Ts'o 0cee8a5c42 Many files:
Update copyright of files in preparation for release of resize2fs.
  	Also removed the (obsolete) beta-test check that had been in the code,
  	as well as the old spec files used to package the separate
  	distribution of resize2fs.
  Makefile.in: No longer build resize2fs.static, since there's no real
  point in it any more.
  Modified Files:
  	ChangeLog Makefile.in extent.c main.c resize2fs.8.in
  	resize2fs.c resize2fs.h sim_progress.c test_extent.c
  Removed Files:
  	e2fsprogs-1.12.spec pq.gif resize2fs.spec version.h
2000-04-06 21:38:34 +00:00
Theodore Ts'o 0a617317ee ChangeLog, main.c, resize2fs.h:
resize2fs.h: Remove unneeded #include of linux/fs.h
  main.c: Fix gcc -Wall bug.  main() should return an int.
2000-02-02 19:14:36 +00:00
Theodore Ts'o 169cb54646 ChangeLog, mk_cmds.sh.in:
mk_cmds.sh.in: Fix error message so that it says mk_cmds's template
  	files instead of compile_et's template files.
ChangeLog, resize2fs.h:
  resize2fs.h: Protect include of unistd.h with HAVE_UNISTD_H.
e2fsprogs.lsm:
  Updated for 1.12 release.
1998-08-01 04:33:31 +00:00
Theodore Ts'o 3b627e8d67 ChangeLog, main.c, resize2fs.c, resize2fs.h:
Change the progress function to return an errcode_t; this allows the
  progress function to return a error indicating a user-requested
  cancel.
1998-02-24 20:24:49 +00:00
Theodore Ts'o a8519a2dbe Many files:
Major reoganization of how resizing works.  Functions in
  ext2_block_move.c, and ext2_inode_move.c moved into resize2fs.c.
  Multiple passes in those two files also combined into a single inode
  scanning pass.  Made the inode table moving function better handling
  the case where it needs to abort mid-operation.  When moving blocks
  around, made the block allocation function preferentially avoid the
  old group descriptor blocks, to make resize2fs more robust.
1998-02-16 22:16:20 +00:00
Theodore Ts'o 63b44fbe30 Many files:
resize2fs.c, resize2fs.h, ext2_block_move.c, ext2_inode_move.c,
  	main.c: Reorganize how the progress functions are called.
1998-02-13 22:58:18 +00:00
Theodore Ts'o ca8abba7e0 Many files:
resize2fs.h: If EXT2_FLAT_INCLUDES is defined, then assume all
  	of the ext2-specific header files are in a flat directory.
  ext2_block_move.c, ext2_inode_move.c, extent.c, resize2fs.c,
  	resize2fs.h: Rename variables named "new" to "new_block",
  	"new_inode", or "new_loc" to avoid C++ reserved word
  	clash.
  ext2_block_move.c, ext2_inode_move.c, extent.c, resize2fs.c,
  	sim_progress.c: Use ext2fs_get_memory(),
  	ext2fs_free_memory(), et. al., instead of malloc() and
  	free().
  ext2_block_move.c, ext2_inode_move.c, extent.c: Explicitly cast
  	all assignments from void * to be compatible with C++.
  banalysis.c, banalysis.h, ext2_inode_move.c, ext2_block_move.c:
  	Change private to priv_data to avoid C++ namespace clash.
ChangeLog, badblocks.8.in:
  badblocks.8.in: Add documentation for the -s option.
1998-01-19 14:55:24 +00:00
Theodore Ts'o 9abf59d282 ChangeLog, resize2fs.h:
Remove STDC magic, since everyone is STDC these days.
1997-11-04 00:31:22 +00:00
Theodore Ts'o d40259fd55 Many files:
Rename io.h to be ext2_io.h (avoid namespace collisions)
ChangeLog, resize2fs.h:
  Add #ifdef's for HAVE_SYS_TYPES_H and HAVE_SYS_TIME_H.
1997-10-20 00:44:26 +00:00
Theodore Ts'o bc75f2a1eb ChangeLog, bmove.c, llseek.c:
llseek.c: Added missing semicolon to glibc fixup declaration of
  	llseek().
  bmove.c: Add #include of errno.h
ChangeLog, resize2fs.h:
  Add #include for errno.h
1997-09-04 00:43:10 +00:00
Theodore Ts'o 98b9fc698d resize2fs.h:
Remove unused ext2_brel field in the ext2_resize_struct structure.
1997-06-17 05:50:14 +00:00
Theodore Ts'o 8e74e66983 Makefile.in, .del-e2fsprogs-1.11.spec~42cd069e, resize2fs.h:
Fix up for release
1997-06-17 05:36:04 +00:00
Theodore Ts'o c762c8e632 Many files:
Checkin of work to date.  (Pretty much completely working now.)
1997-06-17 03:52:12 +00:00
Theodore Ts'o 05e112a11b ChangeLog, Makefile.in, version.h:
Allow people to set the version.h to something like 1.10-PLUS.
.del-inodemap.c~24510e64, main.c, resize2fs.c, resize2fs.h:
  More interim work.  All is functioning except progress meter.
1997-06-14 07:28:44 +00:00
Theodore Ts'o 052db4b76e Makefile.in, .del-inodemap.c~24510e64, main.c, resize2fs.c, resize2fs.h:
New snapshot (almost fully functional)
1997-06-12 07:14:32 +00:00
Theodore Ts'o 1e1da29fbd Many files:
bmove.c (ext2fs_move_blocks): New function which takes a bitmap of
  	blocks which need to be moved, and moves those blocks to another
  	location in the filesystem.
  rs_bitmap.c (ext2fs_resize_generic_bitmap): When expanding a bitmap,
  	make sure all of the new parts of the bitmap are zero.
  bitmaps.c (ext2fs_copy_bitmap): Fix bug; the destination bitmap wasn't
  	being returned to the caller.
  alloc_tables.c (ext2fs_allocate_group_table): Add new function
  	ext2fs_allocate_group_table() which sets the group tables for a
  	particular block group.  The relevant code was factored out of
  	ext2fs_allocate_tables().
  dblist.c (make_dblist): Adjust the initial size of the directory block
  	list to be a bit more realize (ten plus twice the number of
  	directories in the filesystem).
  Check in interim work.
1997-06-09 14:51:29 +00:00
Theodore Ts'o 24b2c7a7a1 ChangeLog, Makefile.in, configure.in:
configure.in (rmakefile): Added (optional) private directory for resize2fs.
  Makefile.in: Change recursive descent rules to check to see if a
  	directory exists before trying to make it.
Many files:
  Initial checkin of work done to date.
1997-06-07 20:42:58 +00:00