Merge branch 'maint' into next

Conflicts:
	e2fsck/pass4.c
	misc/dumpe2fs.c
	resize/online.c
bitmap-optimize
Theodore Ts'o 2010-12-13 09:16:09 -05:00
commit 0358c9f9a4
24 changed files with 806 additions and 435 deletions

View File

@ -107,7 +107,7 @@ STATIC_LIBBLKID = @STATIC_LIBBLKID@ $(STATIC_LIBUUID)
DEPSTATIC_LIBSS = $(LIB)/libss@STATIC_LIB_EXT@
DEPSTATIC_LIBCOM_ERR = $(LIB)/libcom_err@STATIC_LIB_EXT@
DEPSTATIC_LIBUUID = @DEPSTATIC_LIBUUID@
DEPSTATIC_LIBBLKID = @DEPSTATIC_LIBBLKID@ $(STATIC_LIBUUID)
DEPSTATIC_LIBBLKID = @DEPSTATIC_LIBBLKID@ $(DEPSTATIC_LIBUUID)
PROFILED_LIBSS = $(LIB)/libss@PROFILED_LIB_EXT@ @DLOPEN_LIB@
PROFILED_LIBCOM_ERR = $(LIB)/libcom_err@PROFILED_LIB_EXT@ @SEM_INIT_LIB@
@ -118,7 +118,7 @@ PROFILED_LIBBLKID = @PROFILED_LIBBLKID@ $(PROFILED_LIBUUID)
DEPPROFILED_LIBSS = $(LIB)/libss@PROFILED_LIB_EXT@
DEPPROFILED_LIBCOM_ERR = $(LIB)/libcom_err@PROFILED_LIB_EXT@
DEPPROFILED_LIBUUID = @PROFILED_LIBUUID@
DEPPROFILED_LIBBLKID = @PROFILED_LIBBLKID@ $(PROFILED_LIBUUID)
DEPPROFILED_LIBBLKID = @PROFILED_LIBBLKID@ $(DEPPROFILED_LIBUUID)
# An include directive pointing to a directory holding enough linux-like
# include files to satisfy some programs here

2
README
View File

@ -1,4 +1,4 @@
This is the new version (1.41.12) of the second extended file
This is the new version (1.41.13) of the second extended file
system management programs.
From time to time, I release new versions of e2fsprogs, to fix

View File

@ -1,3 +1,149 @@
E2fsprogs 1.41.13 (December 13, 2010)
=====================================
E2fsck now supports the extended option "-E journal_only", which
causes it to only do a journal replay. This is useful for scripts
that want to first replay the journal and then check to see if it
contains errors.
E2fsck will now support UUID= and LABEL= specifiers for the -j option
(which specifies where to find the external journal). (Addresses
Debian Bug #559315)
E2fsck now has support for the problems/<problem code>/force_no
configuration option in e2fsck.conf, which forces a problem to not be
fixed.
Dumpe2fs will now avoid printing large negative offsets for the bitmap
blocks and instead print a message which is a bit more helpful for
flex_bg file systems.
Mke2fs will now check the file system type (specified with the -t
option) to make sure it is defined in the mke2fs.conf file; if it is
not, it will print an error and abort. If the usage type (specified
with the -T option) is not defined in mke2fs.conf, mke2fs will print a
warning but will continue. (Addresses Debian Bug #594609)
Clarified error message from resize2fs clarifying that on-line
shrinking is not supported at all. (Addresses Debian Bug #599786)
Fix an e2fsck bug that could cause a PROGRAMMING BUG error to be
displayed. (Addresses Debian Bug #555456)
E2fsck will open the external journal in exclusive mode, to prevent
the journal from getting truncated while it is in use due to a user
accidentally trying to run e2fsck on a snapshotted file system volume.
(Addresses Debian Bug #587531)
Fix a bug in e2fsck so it has the correct test for the EOFBLOCKS_FL
flag.
The tune2fs program can now set the uninit_bg feature without
requiring an fsck.
The tune2fs, dumpe2fs, and debugfs programs now support the new ext4
default mount options settings which were added in 2.6.35.
The e2fsck and dumpe2fs programs now support the new ext4 superblock
fields which track where and when the first and most recent file
system errors occurred. These fields are displayed by dumpe2fs and
cleared by e2fsck. These new superblock fields were added in 2.6.36.
Debugfs now uses a more concicse format for listing extents in its
stat command. This format also includes the interior extent tree
blocks, which previously was missing from stat's output for
extent-based files.
Debugfs has a new option, -D, which will request Direct I/O access of
the file system.
Mke2fs will skip initializing the inode table if a device supports
discard and the discard operation will result in zero'ed blocks.
Badblocks will now correctly backspace over UTF-8 characters when
displaying its progress bar. (Addresses Gentoo Bug #309909; Addresses
Debian Bugs #583782 and #587834)
E2freefrag will now display the total number of free extents.
Resize2fs -P no longer requires a freshly checked filesystem before
printing the minimum resize size.
Fixed a floating point precision error in a binary tree search routine
that can lead to seg fault in e2fsck and resize2fs.
Fixed a bug in e2fsck where if both the original and backup superblock
are invalid in some way, e2fsck will fail going back to the original
superblock because it didn't close the backup superblock first, and
the exclusive open prevented the file system from being reopened.
Fixed a big in e2freefrag which caused getopt parsing to fail on
architectures with unsigned chars. (Addresses Gentoo Bug: #299386)
Clarified an mke2fs error message so a missed common in an -E option
(i.e., mke2fs -t ext4 -E stride=128 stripe-width=512 /dev/sda1")
results in a more understandable explanation to the user.
Mke2fs now displays the correct valid inode ratio range when
complaining about an invalid inode ratio specified by the user.
Mke2fs now understands the extended option "discard" and "nodiscard",
and the older option -K is deprecated. The default of whether
discards are enabled by default can be controled by the mke2fs.conf
file.
Mke2fs's handling of logical and physical sector sizes has been
improved to reflect the fact that there will be some SSD's with 8k and
16k physical sectors arriving soon. Mke2fs will no longer force block
size to be the physical sector size, since there will be devices where
the physical sector size is larger than the system's page size, and
hence larger than the maximal supported block size. In addition, if
the minimal and optimal io size are not exported by the device, and
the physical sector size is larger than the block size, the physical
sector size will be used to set the Raid I/O optimization hints in the
superblock.
E2fsck will now display a better, more specific error message when the
user enters a typo'ed device name, instead of blathering on about
alternate superblocks.
Fixed various Debian Packaging Issues
Updated/clarified man pages (Addresses Debian Bugs: #580236, #594004,
#589345, #591083; Addresses Launchpad Bug: #505719)
Update the Chinese, Chzech, Dutch, French, Germany, Indonesian,
Polish, Swedish, and Vietnamese translations.
Programmer's Notes
------------------
Fix a dependency definition for the static and profiled blkid
libraries which could cause compile failures in some configurations.
(Addresses Debian Bug: #604629)
Add support for Direct I/O in the Unix I/O access layer.
Fixed a memory leak in the Unix I/O layer when changing block sizes.
Fixed minor memory leaks in mke2fs.
Added a new function to the ext2fs library, ext2fs_get_memalign().
The tst_super_size test program will check to make sure the superblock
fields are correctly aligned and will print them out so they can be
manually checked for correctness.
Fixed some makefile dependencies for test programs in lib/ext2fs.
Reserved the feature flags and superblock fields needed for the Next3
snapshot feature.
Reserved the feature flags for EXT4_FEATURE_INCOMPAT_DIRDATA and
EXT4_INCOMPAT_EA_INODE.
E2fsprogs 1.41.12 (May 17, 2010)
================================

50
debian/changelog vendored
View File

@ -1,3 +1,53 @@
e2fsprogs (1.41.13-1) unstable; urgency=low
* New upstream release
* E2fsck can now do journal-only replays via "e2fsck -E journal_only"
* E2fsck now understands UUID= and LABEL= specifiers for the -j option
(Closes: #559315)
* E2fsck.conf now supports a new config option, which forces the
problem not to be fixed: problems/<problem code/force_no
* Dumpe2fs now prints friendlier offsets for flex_bg file systems
* Mke2fs will now fail if the user uses an file system type not
defined in mke2fs.conf (Closes: #594609)
* Resize now prints a clarified error message explaining that on-line
shrinking is not supported at all. (Closes: #599786)
* Fixed a build error caused by bad static and profiled dependencies
for the blkid library (Closes: #604629)
* Fixed an e2fsck PROGRAMMING BUG error (Closes: #555456)
* Fixed outdated mention of fsck in the e2fsprogs package (Closes: #588726)
* Removed obsolete initrd script (Closes: #585041)
* Fixed bad dependency on libblkid1 due to shlibs.local (Closes: #583551)
* E2fsck now opens the external journal in exclusive mode to prevent
clearing the journal of a mounted, snapshotted volume if the user
accidentally tries to run e2fsck on the snapshot volume (Closes: #587531)
* Fix a big in e2fsck so it correct test for whether the EOFBLOCKS_FL
flag should be set or not.
* Tune2fs can now set uninit_bg without requiring an fsck afterwards
* Add support for the new ext4 default mount options added in 2.6.35
* Add support for the ext4 error tracking superblock fields added in 2.6.36
* Debugfs now uses a more concise format for listing extents in its
stat command
* Debugfs can now use direct I/O to access the file system with the -D option
* Mke2fs will skip initializing the inode table if a device supports
discard and the discard operation results in zero'ed blocks
* Mke2fs's handling of logical and physical sector sizes has been
significantly improved.
* Debugfs will correctly show the progress bar even when UTF-8
characters are used in its translation files (Closes: #583782, #587834)
* E2freefrag will now display the total number of free extents.
* Resize2fs -P now longer requires a freshly checked file system
* Fixed a floating point precision error that can cause segfaults in
e2fsck and resize2fs in extremely rare cases
* Fixed a bug in e2fsck which caused it to fail if both the original
and backup superblocks were invalid in some way
* Fixed a bug in e2freefrag which caused getopt parsing to fail on
architectures with unsigned chars
* Clarified mke2fs and e2fsck error messages when given incorrect
options/values by the user
* Updated/clarified man pages (Closes: #580236, #594004, #589345, #591083)
-- Theodore Y. Ts'o <tytso@mit.edu> Mon, 22 Nov 2010 16:00:50 -0400
e2fsprogs (1.41.12-2) unstable; urgency=high
* Allow tune2fs to set uninit_bg without requiring an fsck

View File

@ -1,7 +1,7 @@
\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename libext2fs.info
@settitle The EXT2FS Library (version 1.41.12)
@settitle The EXT2FS Library (version 1.41.13)
@synindex tp fn
@comment %**end of header
@ -60,8 +60,8 @@ by the author.
@title The EXT2FS Library
@subtitle The EXT2FS Library
@subtitle Version 1.41.12
@subtitle May 2010
@subtitle Version 1.41.13
@subtitle December 2010
@author by Theodore Ts'o
@ -102,7 +102,7 @@ by the Foundation.
@top The EXT2FS Library
This manual documents the EXT2FS Library, version 1.41.12.
This manual documents the EXT2FS Library, version 1.41.13.
@end ifinfo

View File

@ -186,6 +186,10 @@ Set the version of the extended attribute blocks which
will require while checking the filesystem. The version number may
be 1 or 2. The default extended attribute version format is 2.
.TP
.BI journal_only
Only replay the journal if required, but do not perform any further checks
or repairs.
.TP
.BI fragcheck
During pass 1, print a detailed report of any discontiguous blocks for
files in the filesystem.

View File

@ -11,7 +11,7 @@ is the configuration file for
.BR e2fsck (8).
It controls the default behavior of
.BR e2fsck (8)
while it is checking ext2 or ext3 filesystems.
while it is checking ext2, ext3, or ext4 filesystems.
.PP
The
.I e2fsck.conf
@ -190,11 +190,22 @@ is running in preen mode.
.I no_nomsg
This boolean relation overrides the default behavior controlling
whether or not the description for this filesystem problem should
be suppressed when
be suppressed when a problem forced not to be fixed, either because
.B e2fsck
is run with the
.B -n
option.
option or because the
.I force_no
flag has been set for the problem.
.TP
.I force_no
This boolean option, if set to true, forces a problem to never be fixed.
That is, it will be as if the user problem responds 'no' to the question
of 'should this problem be fixed?'. The
.I force_no
option even overrides the
.B -y
option given on the command-line (just for the specific problem, of course).
.SH THE [scratch_files] STANZA
The following relations are defined in the
.I [scratch_files]

View File

@ -155,6 +155,7 @@ struct resource_track {
#define E2F_OPT_WRITECHECK 0x0200
#define E2F_OPT_COMPRESS_DIRS 0x0400
#define E2F_OPT_FRAGCHECK 0x0800
#define E2F_OPT_JOURNAL_ONLY 0x1000 /* only replay the journal */
/*
* E2fsck flags

View File

@ -368,7 +368,8 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
#ifndef USE_INODE_IO
if (ext_journal)
#endif
retval = io_ptr->open(journal_name, IO_FLAG_RW,
retval = io_ptr->open(journal_name,
IO_FLAG_RW | IO_FLAG_EXCLUSIVE,
&ctx->journal_io);
if (retval)
goto errout;

View File

@ -121,6 +121,8 @@ void e2fsck_pass4(e2fsck_t ctx)
/* Protect loop from wrap-around if s_inodes_count maxed */
for (i=1; i <= fs->super->s_inodes_count && i > 0; i++) {
int isdir = ext2fs_test_inode_bitmap2(ctx->inode_dir_map, i);
if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
goto errout;
if ((i % fs->super->s_inodes_per_group) == 0) {
@ -153,14 +155,14 @@ void e2fsck_pass4(e2fsck_t ctx)
ext2fs_icount_fetch(ctx->inode_count, i,
&link_counted);
}
if (ext2fs_test_inode_bitmap2(ctx->inode_dir_map, i) &&
(link_counted > EXT2_LINK_MAX))
if (isdir && (link_counted > EXT2_LINK_MAX))
link_counted = 1;
if (link_counted != link_count) {
e2fsck_read_inode(ctx, i, inode, "pass4");
pctx.ino = i;
pctx.inode = inode;
if (link_count != inode->i_links_count) {
if ((link_count != inode->i_links_count) && !isdir &&
(inode->i_links_count <= EXT2_LINK_MAX)) {
pctx.num = link_count;
fix_problem(ctx,
PR_4_INCONSISTENT_COUNT, &pctx);
@ -168,10 +170,10 @@ void e2fsck_pass4(e2fsck_t ctx)
pctx.num = link_counted;
/* i_link_count was previously exceeded, but no longer
* is, fix this but don't consider it an error */
if ((LINUX_S_ISDIR(inode->i_mode) && link_counted > 1 &&
if ((isdir && link_counted > 1 &&
(inode->i_flags & EXT2_INDEX_FL) &&
link_count == 1 && !(ctx->options & E2F_OPT_NO)) ||
(fix_problem(ctx, PR_4_BAD_REF_COUNT, &pctx))) {
fix_problem(ctx, PR_4_BAD_REF_COUNT, &pctx)) {
inode->i_links_count = link_counted;
e2fsck_write_inode(ctx, i, inode, "pass4");
}

View File

@ -1773,6 +1773,7 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
reconfigure_bool(ctx, ptr, key, PR_NOCOLLATE, "no_collate");
reconfigure_bool(ctx, ptr, key, PR_NO_NOMSG, "no_nomsg");
reconfigure_bool(ctx, ptr, key, PR_PREEN_NOHDR, "preen_noheader");
reconfigure_bool(ctx, ptr, key, PR_FORCE_NO, "force_no");
ptr->flags |= PR_CONFIG;
}
@ -1803,7 +1804,7 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
(ctx->options & E2F_OPT_PREEN))
suppress++;
if ((ptr->flags & PR_NO_NOMSG) &&
(ctx->options & E2F_OPT_NO))
((ctx->options & E2F_OPT_NO) || (ptr->flags & PR_FORCE_NO)))
suppress++;
if (!suppress) {
message = ptr->e2p_description;
@ -1827,7 +1828,11 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
else
answer = def_yn;
} else {
if (ctx->options & E2F_OPT_PREEN) {
if (ptr->flags & PR_FORCE_NO) {
answer = 0;
if (!suppress)
print_answer = 1;
} else if (ctx->options & E2F_OPT_PREEN) {
answer = def_yn;
if (!(ptr->flags & PR_PREEN_NOMSG))
print_answer = 1;

View File

@ -41,3 +41,4 @@ struct latch_descr {
#define PR_PREEN_NOHDR 0x040000 /* Don't print the preen header */
#define PR_CONFIG 0x080000 /* This problem has been customized
from the config file */
#define PR_FORCE_NO 0x100000 /* Force the answer to be no */

View File

@ -308,6 +308,9 @@ static void check_if_skip(e2fsck_t ctx)
if ((ctx->options & E2F_OPT_FORCE) || bad_blocks_file || cflag)
return;
if (ctx->options & E2F_OPT_JOURNAL_ONLY)
goto skip;
lastcheck = fs->super->s_lastcheck;
if (lastcheck > ctx->now)
lastcheck -= ctx->time_fudge;
@ -372,6 +375,7 @@ static void check_if_skip(e2fsck_t ctx)
printf(_(" (check in %ld mounts)"), next_check);
}
fputc('\n', stdout);
skip:
ext2fs_close(fs);
ctx->fs = NULL;
e2fsck_free_context(ctx);
@ -594,6 +598,12 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts)
} else if (strcmp(token, "fragcheck") == 0) {
ctx->options |= E2F_OPT_FRAGCHECK;
continue;
} else if (strcmp(token, "journal_only") == 0) {
if (arg) {
extended_usage++;
continue;
}
ctx->options |= E2F_OPT_JOURNAL_ONLY;
} else {
fprintf(stderr, _("Unknown extended option: %s\n"),
token);
@ -609,6 +619,7 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts)
"Valid extended options are:\n"), stderr);
fputs(("\tea_ver=<ea_version (1 or 2)>\n"), stderr);
fputs(("\tfragcheck\n"), stderr);
fputs(("\tjournal_only\n"), stderr);
fputc('\n', stderr);
exit(1);
}
@ -752,7 +763,14 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
goto sscanf_err;
break;
case 'j':
ctx->journal_name = string_copy(ctx, optarg, 0);
ctx->journal_name = blkid_get_devname(ctx->blkid,
optarg, NULL);
if (!ctx->journal_name) {
com_err(ctx->program_name, 0,
_("Unable to resolve '%s'"),
optarg);
fatal_error(ctx, 0);
}
break;
case 'P':
res = sscanf(optarg, "%d", &ctx->process_inode_size);

View File

@ -1,16 +1,16 @@
Begin3
Title: EXT2 Filesystem utilities
Version: 1.41.12
Entered-date: 17May2010
Version: 1.41.13
Entered-date: 13Dec2010
Description: The filesystem utilities for the EXT2 filesystem, including
e2fsck, mke2fs, dumpe2fs, fsck, and others.
Keywords: utilities, fsck, filesystem, Ext2fs
Author: tytso@mit.edu (Theodore Tso)
Maintained-by: tytso@mit.edu (Theodore Tso)
Primary-site: download.sourceforge.net /pub/sourceforge/e2fsprogs
4392kB e2fsprogs-1.41.12.tar.gz
480kB e2fsprogs-libs-1.41.12.tar.gz
1kB e2fsprogs-1.41.12.lsm
4408kB e2fsprogs-1.41.13.tar.gz
480kB e2fsprogs-libs-1.41.13.tar.gz
1kB e2fsprogs-1.41.13.lsm
Alternate-site:
Platforms: linux 1.2.x/1.3.x/2.0.x/2.1.x/2.2.x/2.3.x/2.4.x/2.5.x/2.6.x
Copying-policy: GPL-2/LGPL-2

View File

@ -126,10 +126,24 @@ static void print_bg_opts(ext2_filsys fs, dgrp_t i)
fputc('\n', stdout);
}
static void print_bg_rel_offset(ext2_filsys fs, blk64_t block, int itable,
blk64_t first_block, blk64_t last_block)
{
if ((block >= first_block) && (block <= last_block)) {
if (itable && block == first_block)
return;
printf(" (+%u)", (unsigned)(block - first_block));
} else if (fs->super->s_feature_incompat &
EXT4_FEATURE_INCOMPAT_FLEX_BG) {
dgrp_t flex_grp = ext2fs_group_of_blk(fs, block);
printf(" (bg #%u + %u)", flex_grp,
(unsigned)(block-ext2fs_group_first_block(fs,flex_grp)));
}
}
static void list_desc (ext2_filsys fs)
{
unsigned long i;
long diff;
blk64_t first_block, last_block;
blk64_t super_blk, old_desc_blk, new_desc_blk;
char *block_bitmap=NULL, *inode_bitmap=NULL;
@ -199,21 +213,18 @@ static void list_desc (ext2_filsys fs)
fputc('\n', stdout);
fputs(_(" Block bitmap at "), stdout);
print_number(ext2fs_block_bitmap_loc(fs, i));
diff = ext2fs_block_bitmap_loc(fs, i) - first_block;
if (diff >= 0)
printf(" (+%ld)", diff);
print_bg_rel_offset(fs, ext2fs_block_bitmap_loc(fs, i), 0,
first_block, last_block);
fputs(_(", Inode bitmap at "), stdout);
print_number(ext2fs_inode_bitmap_loc(fs, i));
diff = ext2fs_inode_bitmap_loc(fs, i) - first_block;
if (diff >= 0)
printf(" (+%ld)", diff);
print_bg_rel_offset(fs, ext2fs_inode_bitmap_loc(fs, i), 0,
first_block, last_block);
fputs(_("\n Inode table at "), stdout);
print_range(ext2fs_inode_table_loc(fs, i),
ext2fs_inode_table_loc(fs, i) +
inode_blocks_per_group - 1);
diff = ext2fs_inode_table_loc(fs, i) - first_block;
if (diff > 0)
printf(" (+%ld)", diff);
print_bg_rel_offset(fs, ext2fs_inode_table_loc(fs, i), 1,
first_block, last_block);
printf (_("\n %u free blocks, %u free inodes, "
"%u directories%s"),
ext2fs_bg_free_blocks_count(fs, i),

View File

@ -45,9 +45,6 @@ mke2fs \- create an ext2/ext3/ext4 filesystem
.I journal-options
]
[
.B \-K
]
[
.B \-N
.I number-of-inodes
]
@ -240,6 +237,17 @@ enable lazy inode table initialization.
.B test_fs
Set a flag in the filesystem superblock indicating that it may be
mounted using experimental kernel code, such as the ext4dev filesystem.
.TP
.BI discard
Attempt to discard blocks at mkfs time (discarding blocks initially is useful
on solid state devices and sparse / thin-provisioned storage). When the device
advertises that discard also zeroes data (any subsequent read after the discard
and before write returns zero), then mark all not-yet-zeroed inode tables as
zeroed. This significantly speeds up filesystem initialization. This is set
as default.
.TP
.BI nodiscard
Do not attempt to discard blocks at mkfs time. This is the default.
.RE
.TP
.BI \-f " fragment-size"
@ -369,10 +377,6 @@ and may be no more than 102,400 filesystem blocks.
@JDEV@.BR size " or " device
@JDEV@options can be given for a filesystem.
.TP
.BI \-K
Keep, do not attempt to discard blocks at mkfs time (discarding blocks initially
is useful on solid state devices and sparse / thin-provisioned storage).
.TP
.BI \-l " filename"
Read the bad blocks list from
.IR filename .

View File

@ -83,12 +83,12 @@ int cflag;
int verbose;
int quiet;
int super_only;
int discard = 1;
int discard = 1; /* attempt to discard device before fs creation */
int force;
int noaction;
int journal_size;
int journal_flags;
int lazy_itable_init; /* use lazy inode table init */
int lazy_itable_init;
char *bad_blocks_filename;
__u32 fs_stride;
@ -753,6 +753,10 @@ static void parse_extended_opts(struct ext2_super_block *param,
lazy_itable_init = strtoul(arg, &p, 0);
else
lazy_itable_init = 1;
} else if (!strcmp(token, "discard")) {
discard = 1;
} else if (!strcmp(token, "nodiscard")) {
discard = 0;
} else {
r_usage++;
badopt = token;
@ -768,7 +772,9 @@ static void parse_extended_opts(struct ext2_super_block *param,
"\tstripe-width=<RAID stride * data disks in blocks>\n"
"\tresize=<resize maximum size in blocks>\n"
"\tlazy_itable_init=<0 to disable, 1 to enable>\n"
"\ttest_fs\n\n"),
"\ttest_fs\n"
"\tdiscard\n"
"\tnodiscard\n\n"),
badopt ? badopt : "");
free(buf);
exit(1);
@ -876,6 +882,35 @@ static void print_str_list(char **list)
fputc('\n', stdout);
}
/*
* Return TRUE if the profile has the given subsection
*/
static int profile_has_subsection(profile_t profile, const char *section,
const char *subsection)
{
void *state;
const char *names[4];
char *name;
int ret = 0;
names[0] = section;
names[1] = subsection;
names[2] = 0;
if (profile_iterator_create(profile, names,
PROFILE_ITER_LIST_SECTION |
PROFILE_ITER_RELATIONS_ONLY, &state))
return 0;
if ((profile_iterator(&state, &name, 0) == 0) && name) {
free(name);
ret = 1;
}
profile_iterator_free(&state);
return ret;
}
static char **parse_fs_type(const char *fs_type,
const char *usage_types,
struct ext2_super_block *fs_param,
@ -927,17 +962,19 @@ static char **parse_fs_type(const char *fs_type,
ext_type = "ext3";
}
if (!strcmp(ext_type, "ext3") || !strcmp(ext_type, "ext4") ||
!strcmp(ext_type, "ext4dev")) {
profile_get_string(profile, "fs_types", ext_type, "features",
0, &t);
if (!t) {
printf(_("\nWarning! Your mke2fs.conf file does "
"not define the %s filesystem type.\n"),
ext_type);
if (!profile_has_subsection(profile, "fs_types", ext_type) &&
strcmp(ext_type, "ext2")) {
printf(_("\nYour mke2fs.conf file does not define the "
"%s filesystem type.\n"), ext_type);
if (!strcmp(ext_type, "ext3") || !strcmp(ext_type, "ext4") ||
!strcmp(ext_type, "ext4dev")) {
printf(_("You probably need to install an updated "
"mke2fs.conf file.\n\n"));
sleep(5);
}
if (!force) {
printf(_("Aborting...\n"));
exit(1);
}
}
@ -974,8 +1011,15 @@ static char **parse_fs_type(const char *fs_type,
if (t)
*t = '\0';
if (*cp)
push_string(&list, cp);
if (*cp) {
if (!profile_has_subsection(profile, "fs_types", cp))
fprintf(stderr,
_("\nWarning: the fs_type %s is not "
"defined in /etc/mke2fs.conf\n\n"),
cp);
else
push_string(&list, cp);
}
if (t)
cp = t+1;
else {
@ -1037,8 +1081,9 @@ static const char *default_files[] = { "<default>", 0 };
* Sets the geometry of a device (stripe/stride), and returns the
* device's alignment offset, if any, or a negative error.
*/
static int ext2fs_get_device_geometry(const char *file,
struct ext2_super_block *fs_param)
static int get_device_geometry(const char *file,
struct ext2_super_block *fs_param,
int psector_size)
{
int rc = -1;
int blocksize;
@ -1063,6 +1108,12 @@ static int ext2fs_get_device_geometry(const char *file,
min_io = blkid_topology_get_minimum_io_size(tp);
opt_io = blkid_topology_get_optimal_io_size(tp);
blocksize = EXT2_BLOCK_SIZE(fs_param);
if ((min_io == 0) && (psector_size > blocksize))
min_io = psector_size;
if ((opt_io == 0) && min_io)
opt_io = min_io;
if ((opt_io == 0) && (psector_size > blocksize))
opt_io = psector_size;
fs_param->s_raid_stride = min_io / blocksize;
fs_param->s_raid_stripe_width = opt_io / blocksize;
@ -1248,6 +1299,10 @@ static void PRS(int argc, char *argv[])
parse_journal_opts(optarg);
break;
case 'K':
fprintf(stderr, _("Warning: -K option is deprecated and "
"should not be used anymore. Use "
"\'-E nodiscard\' extended option "
"instead!\n"));
discard = 0;
break;
case 'j':
@ -1611,13 +1666,16 @@ static void PRS(int argc, char *argv[])
_("while trying to determine physical sector size"));
exit(1);
}
if ((tmp = getenv("MKE2FS_DEVICE_SECTSIZE")) != NULL)
lsector_size = atoi(tmp);
if ((tmp = getenv("MKE2FS_DEVICE_PHYS_SECTSIZE")) != NULL)
psector_size = atoi(tmp);
/* Older kernels may not have physical/logical distinction */
if (!psector_size)
psector_size = lsector_size;
if ((tmp = getenv("MKE2FS_DEVICE_SECTSIZE")) != NULL)
psector_size = atoi(tmp);
if (blocksize <= 0) {
use_bsize = get_int_from_profile(fs_types, "blocksize", 4096);
@ -1627,8 +1685,8 @@ static void PRS(int argc, char *argv[])
(use_bsize > 4096))
use_bsize = 4096;
}
if (psector_size && use_bsize < psector_size)
use_bsize = psector_size;
if (lsector_size && use_bsize < lsector_size)
use_bsize = lsector_size;
if ((blocksize < 0) && (use_bsize < (-blocksize)))
use_bsize = -blocksize;
blocksize = use_bsize;
@ -1636,17 +1694,16 @@ static void PRS(int argc, char *argv[])
ext2fs_blocks_count(&fs_param) /
(blocksize / 1024));
} else {
if (blocksize < lsector_size || /* Impossible */
(!force && (blocksize < psector_size))) { /* Suboptimal */
if (blocksize < lsector_size) { /* Impossible */
com_err(program_name, EINVAL,
_("while setting blocksize; too small "
"for device\n"));
exit(1);
} else if (blocksize < psector_size) {
} else if ((blocksize < psector_size) &&
(psector_size <= sys_page_size)) { /* Suboptimal */
fprintf(stderr, _("Warning: specified blocksize %d is "
"less than device physical sectorsize %d, "
"forced to continue\n"), blocksize,
psector_size);
"less than device physical sectorsize %d\n"),
blocksize, psector_size);
}
}
@ -1661,7 +1718,7 @@ static void PRS(int argc, char *argv[])
int_log2(blocksize >> EXT2_MIN_BLOCK_LOG_SIZE);
#ifdef HAVE_BLKID_PROBE_GET_TOPOLOGY
retval = ext2fs_get_device_geometry(device_name, &fs_param);
retval = get_device_geometry(device_name, &fs_param, psector_size);
if (retval < 0) {
fprintf(stderr,
_("warning: Unable to get device geometry for %s\n"),
@ -1676,8 +1733,14 @@ static void PRS(int argc, char *argv[])
blocksize = EXT2_BLOCK_SIZE(&fs_param);
lazy_itable_init = 0;
if (access("/sys/fs/ext4/features/lazy_itable_init", R_OK) == 0)
lazy_itable_init = 1;
lazy_itable_init = get_bool_from_profile(fs_types,
"lazy_itable_init", 0);
"lazy_itable_init",
lazy_itable_init);
discard = get_bool_from_profile(fs_types, "discard" , discard);
/* Get options from profile */
for (cpp = fs_types; *cpp; cpp++) {
@ -2070,6 +2133,7 @@ int main (int argc, char *argv[])
hash_alg_str = get_string_from_profile(fs_types, "hash_alg",
"half_md4");
hash_alg = e2p_string2hash(hash_alg_str);
free(hash_alg_str);
fs->super->s_def_hash_version = (hash_alg >= 0) ? hash_alg :
EXT2_HASH_HALF_MD4;
uuid_generate((unsigned char *) fs->super->s_hash_seed);
@ -2277,5 +2341,8 @@ no_journal:
remove_error_table(&et_ext2_error_table);
remove_error_table(&et_prof_error_table);
profile_release(profile);
for (i=0; fs_types[i]; i++)
free(fs_types[i]);
free(fs_types);
return (retval || val) ? 1 : 0;
}

View File

@ -360,6 +360,11 @@ option. This can be used to configure the default extended options used
by
.BR mke2fs (8)
on a per-filesystem type basis.
.TP
.I discard
This relation is a boolean which specifies whether the
.BR mke2fs (8)
should attempt to discard device prior to filesystem creation.
.SH FILES
.TP
.I /etc/mke2fs.conf

View File

@ -96,6 +96,12 @@ option to
program, or by using the
.BR dumpe2fs (8)
program.
.PP
The
.I device
specifer can either be a filename (i.e., /dev/sda1), or a LABEL or UUID
specifer: "\fBLABEL=\fIvolume-name\fR" or "\fBUUID=\fIuuid\fR". (i.e.,
LABEL=home or UUID=e40486c6-84d5-4f2f-b99c-032281799c9d).
.SH OPTIONS
.TP
.BI \-c " max-mount-counts"

File diff suppressed because it is too large Load Diff

View File

@ -38,8 +38,7 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt,
"on-line resizing required\n"), fs->device_name, mtpt);
if (*new_size < ext2fs_blocks_count(sb)) {
printf(_("On-line shrinking from %llu to %llu not supported.\n"),
ext2fs_blocks_count(sb), *new_size);
com_err(program_name, 0, _("On-line shrinking not supported"));
exit(1);
}

View File

@ -51,6 +51,14 @@ If
.I size
parameter is not specified, it will default to the size of the partition.
.PP
Note: when kilobytes is used above, I mean
.IR real ,
power-of-2 kilobytes, (i.e., 1024 bytes), which some politically correct
folks insist should be the stupid-sounding ``kibibytes''. The same
holds true for megabytes, also sometimes known as ``mebibytes'', or
gigabytes, as the amazingly silly ``gibibytes''. Makes you want to
gibber, doesn't it?
.PP
The
.B resize2fs
program does not manipulate the size of partitions. If you wish to enlarge
@ -108,8 +116,8 @@ Shrink the filesystem to the minimum size.
.B \-p
Prints out a percentage completion bars for each
.B resize2fs
operation, so that the user can keep track of what
the program is doing.
operation during an offline resize, so that the user can keep track
of what the program is doing.
.TP
.B \-P
Print the minimum size of the filesystem and exit.

View File

@ -3,6 +3,7 @@
blocksize = 4096
inode_size = 256
inode_ratio = 16384
lazy_itable_init = false
[fs_types]
ext3 = {

View File

@ -7,5 +7,5 @@
* file may be redistributed under the GNU Public License v2.
*/
#define E2FSPROGS_VERSION "1.41.12"
#define E2FSPROGS_DATE "17-May-2010"
#define E2FSPROGS_VERSION "1.41.13"
#define E2FSPROGS_DATE "13-Dec-2010"