summaryrefslogtreecommitdiff
path: root/e2fsck
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2010-03-15 18:53:45 -0400
committerTheodore Ts'o <tytso@mit.edu>2010-03-15 18:53:45 -0400
commitc5b23f6c0e17503630455fb16d1b2035f844acc9 (patch)
tree4b2aa963bd0068ab61b751a09225ca6e6f3e3b15 /e2fsck
parent1d18a55c528adf997d8edee60bd8003c822c55e8 (diff)
parent7b6f59204ec441a27fa5035308683471cc189ce1 (diff)
downloade2fsprogs-c5b23f6c0e17503630455fb16d1b2035f844acc9.tar.gz
Merge branch 'maint' into next
Diffstat (limited to 'e2fsck')
-rw-r--r--e2fsck/e2fsck.8.in11
-rw-r--r--e2fsck/e2fsck.h2
-rw-r--r--e2fsck/pass1.c3
-rw-r--r--e2fsck/rehash.c7
-rw-r--r--e2fsck/unix.c35
5 files changed, 35 insertions, 23 deletions
diff --git a/e2fsck/e2fsck.8.in b/e2fsck/e2fsck.8.in
index a9701736..3fb15e6d 100644
--- a/e2fsck/e2fsck.8.in
+++ b/e2fsck/e2fsck.8.in
@@ -242,16 +242,7 @@ in the file are added to the bad blocks list.)
Open the filesystem read-only, and assume an answer of `no' to all
questions. Allows
.B e2fsck
-to be used non-interactively. (Note: if the
-.BR \-c ,
-.BR \-l ,
-or
-.B \-L
-options are specified in addition to the
-.B \-n
-option, then the filesystem will be opened read-write, to permit the
-bad-blocks list to be updated. However, no other changes will be made
-to the filesystem.) This option
+to be used non-interactively. This option
may not be specified at the same time as the
.B \-p
or
diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index ff734449..e763b89a 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -210,7 +210,7 @@ struct e2fsck_struct {
blk_t use_superblock; /* sb requested by user */
blk_t superblock; /* sb used to open fs */
int blocksize; /* blocksize */
- blk_t num_blocks; /* Total number of blocks */
+ blk64_t num_blocks; /* Total number of blocks */
int mount_flags;
blkid_cache blkid; /* blkid cache */
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index fb04841b..130b3f69 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -1983,7 +1983,8 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
/* allow allocated blocks to end of PAGE_SIZE */
(size < (__u64)pb.last_block * fs->blocksize) &&
(pb.last_block / blkpg * blkpg != pb.last_block ||
- size < (__u64)(pb.last_block & ~(blkpg-1)) *fs->blocksize))
+ size < (__u64)(pb.last_block & ~(blkpg-1)) *fs->blocksize) &&
+ !(inode->i_flags & EXT4_EOFBLOCKS_FL))
bad_size = 3;
else if (!(extent_fs && (inode->i_flags & EXT4_EXTENTS_FL)) &&
size > ext2_max_sizes[fs->super->s_log_block_size])
diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c
index 6f00d5aa..c0944a92 100644
--- a/e2fsck/rehash.c
+++ b/e2fsck/rehash.c
@@ -763,7 +763,12 @@ retry_nohash:
/* Sort the list */
resort:
- qsort(fd.harray, fd.num_array, sizeof(struct hash_entry), hash_cmp);
+ if (fd.compress)
+ qsort(fd.harray+2, fd.num_array-2, sizeof(struct hash_entry),
+ hash_cmp);
+ else
+ qsort(fd.harray, fd.num_array, sizeof(struct hash_entry),
+ hash_cmp);
/*
* Look for duplicates
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index e6296028..d53921a5 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -230,8 +230,8 @@ static void check_mount(e2fsck_t ctx)
if (!ctx->interactive)
fatal_error(ctx, _("Cannot continue, aborting.\n\n"));
printf(_("\n\n\007\007\007\007WARNING!!! "
- "Running e2fsck on a mounted filesystem may cause\n"
- "SEVERE filesystem damage.\007\007\007\n\n"));
+ "The filesystem is mounted. If you continue you ***WILL***\n"
+ "cause ***SEVERE*** filesystem damage.\007\007\007\n\n"));
cont = ask_yn(_("Do you really want to continue"), -1);
if (!cont) {
printf (_("check aborted.\n"));
@@ -790,8 +790,23 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
return 0;
if (optind != argc - 1)
usage(ctx);
- if ((ctx->options & E2F_OPT_NO) && !bad_blocks_file &&
- !cflag && !(ctx->options & E2F_OPT_COMPRESS_DIRS))
+ if ((ctx->options & E2F_OPT_NO) &&
+ (ctx->options & E2F_OPT_COMPRESS_DIRS)) {
+ com_err(ctx->program_name, 0,
+ _("The -n and -D options are incompatible."));
+ fatal_error(ctx, 0);
+ }
+ if ((ctx->options & E2F_OPT_NO) && cflag) {
+ com_err(ctx->program_name, 0,
+ _("The -n and -c options are incompatible."));
+ fatal_error(ctx, 0);
+ }
+ if ((ctx->options & E2F_OPT_NO) && bad_blocks_file) {
+ com_err(ctx->program_name, 0,
+ _("The -n and -l/-L options are incompatible."));
+ fatal_error(ctx, 0);
+ }
+ if (ctx->options & E2F_OPT_NO)
ctx->options |= E2F_OPT_READONLY;
ctx->io_options = strchr(argv[optind], '?');
@@ -1112,9 +1127,9 @@ failure:
__u32 blocksize = EXT2_BLOCK_SIZE(fs->super);
int need_restart = 0;
- pctx.errcode = ext2fs_get_device_size(ctx->filesystem_name,
- blocksize,
- &ctx->num_blocks);
+ pctx.errcode = ext2fs_get_device_size2(ctx->filesystem_name,
+ blocksize,
+ &ctx->num_blocks);
/*
* The floppy driver refuses to allow anyone else to
* open the device if has been opened with O_EXCL;
@@ -1126,9 +1141,9 @@ failure:
ext2fs_close(fs);
need_restart++;
pctx.errcode =
- ext2fs_get_device_size(ctx->filesystem_name,
- blocksize,
- &ctx->num_blocks);
+ ext2fs_get_device_size2(ctx->filesystem_name,
+ blocksize,
+ &ctx->num_blocks);
}
if (pctx.errcode == EXT2_ET_UNIMPLEMENTED)
ctx->num_blocks = 0;