This patch changes ext2fs_open() to set EXT2_FLAG_MASTER_SB_ONLY by
default. This avoids some problems in e2fsck (reported by Jim Garlick)
where a corrupt journal can end up writing the bad superblock to the
backups. In general, only e2fsck (after the filesystem is clean),
tune2fs, and resize2fs should change the backup superblocks by default.
Most callers of ext2fs_open() should not be touching anything where the
backups should be touched. So let's change the defaults to avoid
potential problems.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Change all of the e2fsprogs programs to use the newer add_error_table()
and remove_error_table() interfaces instead of the much older
initialize_*_error_table() function.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Add a new functiom, e2p_percent(), which correct calculates the percentage
of a number based on a given percentage, without worrying about overflow
issues. This is used where we calculate the number of reserved blocks using
a percentage of the total number of blocks in a filesystem.
Based on patches from Eric Sandeen, but generalized to use this new function.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
We were complaining with a confusing error message if the user tried to specify
a check interval larger than a 365 days. It's probably a bad idea if the user wants to
do this, but it's not worth it to complain.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Allow the reserved blocks ratio to be specified in fractional
percentages.
Addresses-Debian-Bug: #80205
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
should use the passed-in argument, not optarg, even though
the two are the same in the case of the current caller of
said function. (i.e., no user-visible problems were caused
by this, even though the code was wrong).
example, /tmp/test.img?offset=1024. Multiple options can separated using
the & character, although at the moment the only option implemented is
the offset option in the unix_io layer.
TUNE2FS_SKIP_MOUNT_CHECK is set, do not try
to check if the filesystem is mounted.
(update_feature_set): If the compatibility bitmasks were
not modified, don't set the superblock dirty bit.
tune2fs to use the test I/O manager.
The test I/O manager has been changed to not do anything extra by
default, unless the TEST_IO_FLAGS and/or TEST_IO_BLOCK environment
variables are set, which controls what I/O operations are logged and
a block number to watch, respectively. The log messages are sent to
stderr by default, unless a filename is specified via the
TEST_IO_LOGFILE environment variable.
tune2fs.c (update_feature_set): Allow directory indexing flag to
be set. If so, set the default hash to be TEA, and
initialize the hash seed to a random value.
function in get_device_by_label.c to allow the use of
UUID= or LABEL= when creating filesystems which use external
journal dev (e.g. mke2fs -J device=LABEL=<journal_label>).
tune2fs.c: Use superblock s_journal_uuid to locate an external
journal device instead of s_journal_dev when removing it.
Allow opening journal devices to set the label and UUID
in the ext2 superblock.
mke2fs.c, tune2fs.c: Free journal_device after use, as it is
malloc'd in interpret spec.
removing an in-filesystem journal, clear out the journal
inode and update the filesystem accounting structures so
we don't have to run e2fsck to clean up after ourselves
tune2fs.c, mke2fs.c, util.c, util.h (print_check_message): Move the
message which displays how often the filesystem will be checked from
mke2fs into a utility subroutine. Then cause tune2fs to call that
function to display the message after adding a journal to a
filesystem.
mke2fs.8.in: Add manual page fixups and explanation for why it's good
to check filesystems periodically from Andreas Dilger.
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
Clarify some of the Changelog entries.
ChangeLog, fsck.8.in, mke2fs.8.in, tune2fs.8.in:
fsck.8.in, mke2fs.8.in, tune2fs.8.in: Fix typo's and make other
clarifications suggested by Andreas Dilger.
ChangeLog, tune2fs.c:
tune2fs.c (update_feature_set): Clean up some printf messages.
tune2fs.c (parse_tune2fs_options): Interpret -c 0 as -c -1 (for
backwards compatibility with older kernels). -c 0 makes more sense to
users.
tune2fs.8.in:
Update tune2fs manual papge so that it is up to date.
tune2fs.c (remove_journal_device): If the force flag is given, tune2fs
will remove the journal device information from the superblock even if
tune2fs failed to open the journal device or otherwise other failed to
remove the filesystem from journal device.
(parse_tune2fs_options): Fix -j option so that it works (it was
missing the open_flag being set to EXT2_FLAG_RW).
(main): Accept "-U clear" to set a null UID.
ke2fs.8.in, tune2fs.8.in: Change man paegs to document that the
journal must be bewteen 1024 and 10,240 file system blocks.
mke2fs.c, tune2fs.c: Change to use figure_journal_size()
util.c, util.h (figure_journal_size): Change journal_default_size into
routine which also converts the requested journal size into filesystem
blocks and does bounds checking to make sure the journal is sized
reasonably. Renamed function to journal_default_size.
parse_journal_opts): Remove bounds check for the journal size, since
this is now done in figure_journal_size, and based on the number of
filesystem blocks, as opposed to using the absolute size of the
journal.
tune2fs.c, mke2fs.c, tune2fs.8.in, mke2fs.8.in: Change user interface
so that -J is used to specify journal options, and -j is used to
request creation of a journal using default values. (This is a UI
change, but we haven't done a formal release, and it makes things much
more consistent with the rest of the options out there.)
tune2fs.c: Add support for removing a filesystem from an external
journal; we correctly remove the filesystem UUID from the external
journal's filesystem list.
tune2fs.c: Changed the external journal code so that it simply adds a
filesystem to a journal; the journal must have bene created via
"mke2fs -O journal_dev /dev/XXX".
mke2fs.c: Add support for creating an external journal device by using
the command "mke2fs -O journal_dev /dev/XXX". Also changed the
external journal code so -j device=/dev/XXX it simply adds a
filesystem to that journal; the journal must have been created via
separate step.
dumpe2fs.c (print_journal_information): Add support for dumping
information about an external journal device.
tune2fs.c (add_journal): Minor fixes from Andreas Dilger. Flush stdout
after printing in-progress message.
(main): Exit with status code 1 if we failed to determine the mount
status of the device.
ChangeLog, gcc-wall-cleanup:
gcc-wall-cleanup: Remove additional annoying warning messages emited
by gcc 2.95.2.
ChangeLog, uuid.h:
uuid: Change arguments to make it clear which argument is the source
and which is the destination.