Many files:

Checked in e2fsprogs 1.06
bitmap-optimize
Theodore Ts'o 1997-04-29 15:29:49 +00:00
parent ef42328871
commit 5c576477cc
53 changed files with 524 additions and 138 deletions

View File

@ -1,3 +1,13 @@
Mon Oct 7 08:22:31 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Makefile.in (all): Don't run "make check" by default. User
should manually run "make check" if they wish to test
things out.
Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs version 1.05
Sat Aug 31 10:55:45 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* configure.in (AC_CHECK_FUNCS): Add fchown to list of functions

12
INSTALL
View File

@ -20,11 +20,15 @@ profiling libraries, add the option --enable-profile.
make
5) Install the programs
5) Check to make sure the installation built correctly:
make check
6) Install the programs
Run `make install'
6) Install the include files and libraries
7) Install the include files and libraries
You can run `make install-libs' to install the include files and
libraries. Please note that this installation is not needed for the
@ -32,7 +36,7 @@ programs to work. It is only needed if you expect to develop other
programs using the libraries or if you want to compile other program
using these libraries (like the 4.4BSD dump and restore port).
7) Remove any pre-formatted man pages.
8) Remove any pre-formatted man pages.
Some distributions will have pre-formatted manual pages which
will always be displayed in preference to newer man pages in /usr/man.
@ -40,7 +44,7 @@ If this is the case, you may need to manually remove them in order to
see the correct manual pages. The shell script in
install-utils/remove_preformat_manpages may be helpful in doing so.
8) Make sure your /etc/fstab file is correct.
9) Make sure your /etc/fstab file is correct.
Some distributions install an /etc/fstab which is missing the
fifth and sixth field of filesystem entry, which are the dump

View File

@ -13,7 +13,7 @@ SUBDIRS=$(LIB_SUBDIRS) $(PROG_SUBDIRS) tests
SUBS= include/linux/types.h
all:: $(SUBS) libs progs check
all:: $(SUBS) libs progs
progs: $(SUBS) all-progs-recursive
libs: $(SUBS) all-libs-recursive

View File

@ -1,3 +1,55 @@
E2fsprogs 1.06 (October 7, 1996)
================================
Fixed serious bug in e2fsck: if the block descriptors are bad, don't
smash the backup copies in ext2fs_close(). (The problem was that when
e2fsck -p discovered the problem, while it was closing the filesystem
and exiting, it was also blowing away the backup superblocks on the
disk, which was less than friendly.) We now make it the case that we
only write out the backup superblock and the back block descriptors if
the filesystem is completely free from problems.
Fixed a bug in block_interate in the lib/ext2fs library which caused
e2fsck to fail on GNU Hurd-created filesystems.
Add support for Linux/FT's bootloader, which actually uses
EXT2_BOOT_LOADER, and sets its mode bits which caused e2fsck to want
to clear the inode.
Add support for the "A" (no atime update) attribute. (Note: this
attribute is not yet in production kernels.)
The test suite is not automatically run when doing a "make all" from
the top level directory. Users should manually run "make check" if
they wish to run the test suite.
Upon a preenhalt(), make the printed message more explicit that
running e2fsck "MANAULLY" means without the -p or -a options.
In e2fsck, if a disconnected inode is zero-length, offer to clear it
instead of offering to connect it to lost+found.
In e2fsck, if a filesystem was just unmounted uncleanly, and needs
e2fsck to be run over it, change e2fsck to explicitly display this
fact.
For dumpe2fs and e2fsck, cause the -V option to print out which
version of the ext2fs library is actually getting used. (This will
help detect mismatches of using a 1.06 utility with a 1.05 library,
etc.)
Programmers' notes:
-------------------
EXT2_SWAP_BYTES was changed to EXT2_FLAG_SWAP_BYTES, which better fits
the naming convention.
In ext2fs_initialize(), make sure the description for the inode bitmap
is correctly initialize.
Fixed minor type typo in ext2fs_allocate_generic_bitmap();
E2fsprogs 1.05 (September 7, 1996)
==================================

View File

@ -1,3 +1,7 @@
Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs version 1.05
Mon Sep 9 23:05:11 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* debugfs.c (unlink_file_by_name): If unlinking a file with a

View File

@ -1,3 +1,39 @@
Mon Oct 7 00:45:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* e2fsck.c (main): Print out the version number of the shared
library when using the -V option.
* swapfs.c (swap_filesys): Change EXT2_SWAP to EXT2_FLAG_SWAP for
consistency's sake.
* e2fsck.c (main): By setting EXT2_FLAG_MASTER_SB_ONLY, only write
out the backup superblocks when we know we have a valid
filesystem.
Tue Oct 1 22:00:29 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* util.c (preenhalt): Make it explicit on preenhalt that running
e2fsck manually means without the -a or -p flag.
Fri Sep 27 14:41:08 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* pass1.c (pass1): Add support for the EXT2_BOOT_LOADER inode.
(Linux/FT actually sets the mode bits, so we have to
handle it specially.)
* e2fsck.c (check_if_skip): Print a message if the filesystem is
just dirty, so that the user knows that it's about to be
checked (since this will take a while).
Mon Sep 16 17:00:01 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* pass4.c: If a disconnected inode is zero-length, prompt to
delete it instead of connecting it to lost+found.
Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs version 1.05
Fri Aug 30 20:24:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* pass4.c (pass4): If the user refuses to connect an unattached

View File

@ -151,7 +151,7 @@ is the sum of the following conditions:
.br
\ 128\ \-\ Shared library error
.br
.SH BUGS
.SH REPORTING BUGS
Almost any piece of software will have bugs. If you manage to find a
filesystem which causes
.B e2fsck

View File

@ -421,19 +421,19 @@ static void check_if_skip(ext2_filsys fs)
time(0) >= (fs->super->s_lastcheck +
fs->super->s_checkinterval))
reason = "has gone too long without being checked";
else if ((fs->super->s_state & EXT2_VALID_FS) == 0)
reason = "was not cleanly unmounted";
if (reason) {
printf("%s %s, check forced.\n", device_name, reason);
return;
}
if (fs->super->s_state & EXT2_VALID_FS) {
printf("%s: clean, %d/%d files, %d/%d blocks\n", device_name,
fs->super->s_inodes_count - fs->super->s_free_inodes_count,
fs->super->s_inodes_count,
fs->super->s_blocks_count - fs->super->s_free_blocks_count,
fs->super->s_blocks_count);
ext2fs_close(fs);
exit(FSCK_OK);
}
printf("%s: clean, %d/%d files, %d/%d blocks\n", device_name,
fs->super->s_inodes_count - fs->super->s_free_inodes_count,
fs->super->s_inodes_count,
fs->super->s_blocks_count - fs->super->s_free_blocks_count,
fs->super->s_blocks_count);
ext2fs_close(fs);
exit(FSCK_OK);
}
#define PATH_SET "PATH=/sbin"
@ -606,8 +606,11 @@ int main (int argc, char *argv[])
E2FSPROGS_VERSION, E2FSPROGS_DATE,
EXT2FS_VERSION, EXT2FS_DATE);
if (show_version_only)
if (show_version_only) {
fprintf(stderr, "\tUsing %s\n",
error_message(EXT2_ET_BASE));
exit(0);
}
check_mount();
@ -671,6 +674,12 @@ restart:
if (superblock && rwflag)
ext2fs_mark_super_dirty(fs);
/*
* Don't overwrite the backup superblock and block
* descriptors, until we're sure the filesystem is OK....
*/
fs->flags |= EXT2_FLAG_MASTER_SB_ONLY;
ehandler_init(fs->io);
invalid_inode_bitmap = allocate_memory(sizeof(int) *
@ -691,7 +700,8 @@ restart:
test_disk(fs);
if (normalize_swapfs) {
if ((fs->flags & EXT2_SWAP_BYTES) == ext2fs_native_flag()) {
if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ==
ext2fs_native_flag()) {
fprintf(stderr, "%s: Filesystem byte order "
"already normalized.\n", device_name);
fatal_error(0);
@ -733,7 +743,9 @@ restart:
exit_value = FSCK_REBOOT;
}
}
if (!ext2fs_test_valid(fs))
if (ext2fs_test_valid(fs))
fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
else
exit_value = FSCK_UNCORRECTED;
if (rwflag) {
if (ext2fs_test_valid(fs)) {

View File

@ -300,6 +300,11 @@ void pass1(ext2_filsys fs)
ext2fs_unmark_valid(fs);
}
}
if (ino == EXT2_BOOT_LOADER_INO) {
ext2fs_mark_inode_bitmap(inode_used_map, ino);
check_blocks(fs, ino, &inode, block_buf);
goto next;
}
if ((ino != EXT2_ROOT_INO) &&
(ino < EXT2_FIRST_INODE(fs->super))) {
ext2fs_mark_inode_bitmap(inode_used_map, ino);
@ -755,7 +760,8 @@ int process_block(ext2_filsys fs,
* get called with BLOCK_FLAG_HOLE
*/
printf("process_block() called with blk == 0, "
"inode %lu???", p->ino);
"blockcnt=%d, inode %lu???\n",
blockcnt, p->ino);
return 0;
}
if (blockcnt < 0)

View File

@ -8,6 +8,63 @@
#include "e2fsck.h"
/*
* This routine is called when an inode is not connected to the
* directory tree.
*
* This subroutine returns 1 then the caller shouldn't bother with the
* rest of the pass 4 tests.
*/
int disconnect_inode(ext2_filsys fs, ino_t i)
{
struct ext2_inode inode;
e2fsck_read_inode(fs, i, &inode, "pass4: disconnect_inode");
if (!inode.i_blocks && (LINUX_S_ISREG(inode.i_mode) ||
LINUX_S_ISDIR(inode.i_mode))) {
/*
* This is a zero-length file; prompt to delete it...
*/
printf("Unattached zero-length inode %lu\n", i);
if (ask("Clear", 1)) {
inode_link_info[i] = 0;
inode.i_links_count = 0;
inode.i_dtime = time(0);
e2fsck_write_inode(fs, i, &inode,
"disconnect_inode");
/*
* Fix up the bitmaps...
*/
read_bitmaps(fs);
ext2fs_unmark_inode_bitmap(inode_used_map, i);
ext2fs_unmark_inode_bitmap(inode_dir_map, i);
ext2fs_unmark_inode_bitmap(fs->inode_map, i);
ext2fs_mark_ib_dirty(fs);
return 0;
}
}
/*
* Prompt to reconnect.
*/
printf("Unattached inode %lu\n", i);
preenhalt(fs);
if (ask("Connect to /lost+found", 1)) {
if (reconnect_file(fs, i))
ext2fs_unmark_valid(fs);
} else {
/*
* If we don't attach the inode, then skip the
* i_links_test since there's no point in trying to
* force i_links_count to zero.
*/
ext2fs_unmark_valid(fs);
return 1;
}
return 0;
}
void pass4(ext2_filsys fs)
{
ino_t i;
@ -29,25 +86,8 @@ void pass4(ext2_filsys fs)
if (!(ext2fs_test_inode_bitmap(inode_used_map, i)))
continue;
if (inode_count[i] == 0) {
/*
* Inode isn't attached to the filesystem;
* prompt to reconnect.
*/
printf("Unattached inode %lu\n", i);
preenhalt(fs);
if (ask("Connect to /lost+found", 1)) {
if (reconnect_file(fs, i))
ext2fs_unmark_valid(fs);
} else {
/*
* If we don't attach the inode, then
* skip the i_links_test since there's
* no point in trying to force
* i_links_count to zero.
*/
ext2fs_unmark_valid(fs);
if (disconnect_inode(fs, i))
continue;
}
}
if (inode_count[i] != inode_link_info[i]) {
e2fsck_read_inode(fs, i, &inode, "pass4");

View File

@ -126,7 +126,7 @@ static void swap_inodes(ext2_filsys fs)
}
inode = (struct ext2_inode *) buf;
for (i=0; i < fs->super->s_inodes_per_group; i++, ino++) {
if (fs->flags & EXT2_SWAP_BYTES_READ)
if (fs->flags & EXT2_FLAG_SWAP_BYTES_READ)
ext2fs_swap_inode(fs, inode, inode, 0);
stashed_ino = ino;
stashed_inode = inode;
@ -137,7 +137,7 @@ static void swap_inodes(ext2_filsys fs)
LINUX_S_ISDIR(inode->i_mode))
swap_inode_blocks(fs, ino, block_buf, inode);
if (fs->flags & EXT2_SWAP_BYTES_WRITE)
if (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)
ext2fs_swap_inode(fs, inode, inode, 1);
inode++;
}
@ -177,17 +177,19 @@ void swap_filesys(ext2_filsys fs)
"byte-swap it.\n", device_name);
fatal_error(0);
}
if (fs->flags & EXT2_SWAP_BYTES) {
fs->flags &= ~(EXT2_SWAP_BYTES|EXT2_SWAP_BYTES_WRITE);
fs->flags |= EXT2_SWAP_BYTES_READ;
if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
fs->flags &= ~(EXT2_FLAG_SWAP_BYTES|
EXT2_FLAG_SWAP_BYTES_WRITE);
fs->flags |= EXT2_FLAG_SWAP_BYTES_READ;
} else {
fs->flags &= ~EXT2_SWAP_BYTES_READ;
fs->flags |= EXT2_SWAP_BYTES_WRITE;
fs->flags &= ~EXT2_FLAG_SWAP_BYTES_READ;
fs->flags |= EXT2_FLAG_SWAP_BYTES_WRITE;
}
swap_inodes(fs);
if (fs->flags & EXT2_SWAP_BYTES_WRITE)
fs->flags |= EXT2_SWAP_BYTES;
fs->flags &= ~(EXT2_SWAP_BYTES_READ|EXT2_SWAP_BYTES_WRITE);
if (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)
fs->flags |= EXT2_FLAG_SWAP_BYTES;
fs->flags &= ~(EXT2_FLAG_SWAP_BYTES_READ|
EXT2_FLAG_SWAP_BYTES_WRITE);
ext2fs_flush(fs);
if (tflag > 1) {

View File

@ -160,7 +160,8 @@ void preenhalt(ext2_filsys fs)
{
if (!preen)
return;
fprintf(stderr, "\n\n%s: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.\n",
fprintf(stderr, "\n\n%s: UNEXPECTED INCONSISTENCY; "
"RUN fsck MANUALLY.\n\t(i.e., without -a or -p options)\n",
device_name);
if (fs != NULL) {
fs->super->s_state |= EXT2_ERROR_FS;

View File

@ -1,10 +1,10 @@
Description: Tools for the second extended (ext2) filesystem
Name: e2fsprogs
Version: 1.05
Version: 1.06
Release: 0
Copyright: GPL
Group: Utilities/System
Source: tsx-11.mit.edu:/pub/linux/packages/ext2fs/e2fsprogs-1.05.tar.gz
Source: tsx-11.mit.edu:/pub/linux/packages/ext2fs/e2fsprogs-1.06.tar.gz
%package devel
Description: e2fs static libs and headers

View File

@ -1,3 +1,7 @@
Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs version 1.05
Thu May 16 11:12:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs version 1.04

View File

@ -1,3 +1,7 @@
Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs version 1.05
Thu May 16 11:12:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs version 1.04

View File

@ -1,3 +1,6 @@
Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs version 1.05
Wed Aug 28 15:20:26 1996 Miles Bader <miles@gnu.ai.mit.edu>
* Makefile.elf-lib (installdirs-elf-lib): Renamed from installdirs

View File

@ -1,3 +1,11 @@
Sun Sep 22 16:20:12 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* pf.c: Add support for the 'A' (no atime) flag.
Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs version 1.05
Sat Sep 7 14:48:35 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* ls.c (interval_string): Pretty print the check interval.

View File

@ -31,6 +31,9 @@ static const unsigned long flags_array[] = {
#endif
#ifdef EXT2_NODUMP_FL
EXT2_NODUMP_FL,
#endif
#ifdef EXT2_NOATIME_FL
EXT2_NOATIME_FL,
#endif
0};
@ -47,6 +50,9 @@ static const char * short_flags[] = {
#endif
#ifdef EXT2_NODUMP_FL
"d",
#endif
#ifdef EXT2_NOATIME_FL
"A",
#endif
NULL};
@ -63,6 +69,9 @@ static const char * long_flags[] = {
#endif
#ifdef EXT2_NODUMP_FL
"No_Dump, ",
#endif
#ifdef EXT2_NOATIME_FL
"No_Atime, ",
#endif
NULL};

View File

@ -1,3 +1,7 @@
Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs version 1.05
Thu May 16 11:12:30 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs version 1.04

View File

@ -1,3 +1,30 @@
Mon Oct 7 00:44:17 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* ext2fs.h, block.c, closefs.c, dirblock.c, inode.c, native.c,
open.c: Change EXT2_SWAP to EXT2_FLAG_SWAP for
consistency's sake.
* closefs.c (ext2fs_flush): If the flag EXT2_MASTER_SB_ONLY is
set, then only write out the master superblock.
Sun Oct 6 21:45:26 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* block.c (ext2fs_block_iterate): Fixed bug which caused
block_iterate to fail to handle HURD created filesystems;
it tested the inode translator field before the inode was
loaded.
Tue Sep 17 14:08:24 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* initialize.c (ext2fs_initialize): Make sure the description for
the inode bitmap is set correctly.
* bitmaps.c (ext2fs_allocate_generic_bitmap): Fix minor type typo.
Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs version 1.05
Sat Sep 7 07:36:03 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* initialize.c: Override the kernel's idea of default

View File

@ -28,7 +28,7 @@ errcode_t ext2fs_allocate_generic_bitmap(__u32 start,
const char *descr,
ext2fs_generic_bitmap *ret)
{
ext2fs_inode_bitmap bitmap;
ext2fs_generic_bitmap bitmap;
int size;
bitmap = malloc(sizeof(struct ext2fs_struct_generic_bitmap));

View File

@ -58,8 +58,8 @@ static int block_iterate_ind(blk_t *ind_block, struct block_context *ctx)
return ret;
}
limit = ctx->fs->blocksize >> 2;
if ((ctx->fs->flags & EXT2_SWAP_BYTES) ||
(ctx->fs->flags & EXT2_SWAP_BYTES_READ)) {
if ((ctx->fs->flags & EXT2_FLAG_SWAP_BYTES) ||
(ctx->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) {
block_nr = (blk_t *) ctx->ind_buf;
for (i = 0; i < limit; i++, block_nr++)
*block_nr = ext2fs_swab32(*block_nr);
@ -89,8 +89,8 @@ static int block_iterate_ind(blk_t *ind_block, struct block_context *ctx)
}
}
if (changed & BLOCK_CHANGED) {
if ((ctx->fs->flags & EXT2_SWAP_BYTES) ||
(ctx->fs->flags & EXT2_SWAP_BYTES_WRITE)) {
if ((ctx->fs->flags & EXT2_FLAG_SWAP_BYTES) ||
(ctx->fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) {
block_nr = (blk_t *) ctx->ind_buf;
for (i = 0; i < limit; i++, block_nr++)
*block_nr = ext2fs_swab32(*block_nr);
@ -133,8 +133,8 @@ static int block_iterate_dind(blk_t *dind_block, struct block_context *ctx)
return ret;
}
limit = ctx->fs->blocksize >> 2;
if ((ctx->fs->flags & EXT2_SWAP_BYTES) ||
(ctx->fs->flags & EXT2_SWAP_BYTES_READ)) {
if ((ctx->fs->flags & EXT2_FLAG_SWAP_BYTES) ||
(ctx->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) {
block_nr = (blk_t *) ctx->dind_buf;
for (i = 0; i < limit; i++, block_nr++)
*block_nr = ext2fs_swab32(*block_nr);
@ -162,8 +162,8 @@ static int block_iterate_dind(blk_t *dind_block, struct block_context *ctx)
}
}
if (changed & BLOCK_CHANGED) {
if ((ctx->fs->flags & EXT2_SWAP_BYTES) ||
(ctx->fs->flags & EXT2_SWAP_BYTES_WRITE)) {
if ((ctx->fs->flags & EXT2_FLAG_SWAP_BYTES) ||
(ctx->fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) {
block_nr = (blk_t *) ctx->dind_buf;
for (i = 0; i < limit; i++, block_nr++)
*block_nr = ext2fs_swab32(*block_nr);
@ -206,8 +206,8 @@ static int block_iterate_tind(blk_t *tind_block, struct block_context *ctx)
return ret;
}
limit = ctx->fs->blocksize >> 2;
if ((ctx->fs->flags & EXT2_SWAP_BYTES) ||
(ctx->fs->flags & EXT2_SWAP_BYTES_READ)) {
if ((ctx->fs->flags & EXT2_FLAG_SWAP_BYTES) ||
(ctx->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) {
block_nr = (blk_t *) ctx->tind_buf;
for (i = 0; i < limit; i++, block_nr++)
*block_nr = ext2fs_swab32(*block_nr);
@ -235,8 +235,8 @@ static int block_iterate_tind(blk_t *tind_block, struct block_context *ctx)
}
}
if (changed & BLOCK_CHANGED) {
if ((ctx->fs->flags & EXT2_SWAP_BYTES) ||
(ctx->fs->flags & EXT2_SWAP_BYTES_WRITE)) {
if ((ctx->fs->flags & EXT2_FLAG_SWAP_BYTES) ||
(ctx->fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) {
block_nr = (blk_t *) ctx->tind_buf;
for (i = 0; i < limit; i++, block_nr++)
*block_nr = ext2fs_swab32(*block_nr);
@ -298,16 +298,17 @@ errcode_t ext2fs_block_iterate(ext2_filsys fs,
* Iterate over the HURD translator block (if present)
*/
if ((fs->super->s_creator_os == EXT2_OS_HURD) &&
!(flags & BLOCK_FLAG_DATA_ONLY) &&
inode.osd1.hurd1.h_i_translator) {
!(flags & BLOCK_FLAG_DATA_ONLY)) {
ctx.errcode = ext2fs_read_inode(fs, ino, &inode);
if (ctx.errcode)
goto abort;
got_inode = 1;
ret |= (*func)(fs, &inode.osd1.hurd1.h_i_translator,
BLOCK_COUNT_TRANSLATOR, private);
if (ret & BLOCK_ABORT)
goto abort;
if (inode.osd1.hurd1.h_i_translator) {
ret |= (*func)(fs, &inode.osd1.hurd1.h_i_translator,
BLOCK_COUNT_TRANSLATOR, private);
if (ret & BLOCK_ABORT)
goto abort;
}
}
/*

View File

@ -20,7 +20,7 @@
errcode_t ext2fs_flush(ext2_filsys fs)
{
int i,j;
int i,j,maxgroup;
int group_block;
errcode_t retval;
char *group_ptr;
@ -34,7 +34,7 @@ errcode_t ext2fs_flush(ext2_filsys fs)
fs_state = fs->super->s_state;
fs->super->s_wtime = time(NULL);
if (fs->flags & EXT2_SWAP_BYTES) {
if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
retval = ENOMEM;
if (!(super_shadow = malloc(SUPERBLOCK_SIZE)))
goto errout;
@ -75,7 +75,7 @@ errcode_t ext2fs_flush(ext2_filsys fs)
* we exit.)
*/
fs->super->s_state &= ~EXT2_VALID_FS;
if (fs->flags & EXT2_SWAP_BYTES) {
if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
*super_shadow = *fs->super;
ext2fs_swap_super(super_shadow);
}
@ -85,7 +85,9 @@ errcode_t ext2fs_flush(ext2_filsys fs)
* superblocks and group descriptors.
*/
group_block = fs->super->s_first_data_block;
for (i = 0; i < fs->group_desc_count; i++) {
maxgroup = (fs->flags & EXT2_FLAG_MASTER_SB_ONLY) ? 1 :
fs->group_desc_count;
for (i = 0; i < maxgroup; i++) {
if (i !=0 ) {
retval = io_channel_write_blk(fs->io, group_block,
-SUPERBLOCK_SIZE,
@ -120,7 +122,7 @@ errcode_t ext2fs_flush(ext2_filsys fs)
retval = 0;
errout:
fs->super->s_state = fs_state;
if (fs->flags & EXT2_SWAP_BYTES) {
if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
if (super_shadow)
free(super_shadow);
if (group_shadow)

View File

@ -27,7 +27,8 @@ errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block,
retval = io_channel_read_blk(fs->io, block, 1, buf);
if (retval)
return retval;
if ((fs->flags & (EXT2_SWAP_BYTES|EXT2_SWAP_BYTES_READ)) == 0)
if ((fs->flags & (EXT2_FLAG_SWAP_BYTES|
EXT2_FLAG_SWAP_BYTES_READ)) == 0)
return 0;
p = buf;
end = (char *) buf + fs->blocksize;
@ -49,8 +50,8 @@ errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block,
char *buf = 0;
struct ext2_dir_entry *dirent;
if ((fs->flags & EXT2_SWAP_BYTES) ||
(fs->flags & EXT2_SWAP_BYTES_WRITE)) {
if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
(fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) {
write_buf = buf = malloc(fs->blocksize);
if (!buf)
return ENOMEM;

View File

@ -71,9 +71,10 @@ typedef struct ext2fs_struct_generic_bitmap *ext2fs_block_bitmap;
#define EXT2_FLAG_VALID 0x08
#define EXT2_FLAG_IB_DIRTY 0x10
#define EXT2_FLAG_BB_DIRTY 0x20
#define EXT2_SWAP_BYTES 0x40
#define EXT2_SWAP_BYTES_READ 0x80
#define EXT2_SWAP_BYTES_WRITE 0x100
#define EXT2_FLAG_SWAP_BYTES 0x40
#define EXT2_FLAG_SWAP_BYTES_READ 0x80
#define EXT2_FLAG_SWAP_BYTES_WRITE 0x100
#define EXT2_FLAG_MASTER_SB_ONLY 0x200
/*
* Special flag in the ext2 inode i_flag field that means that this is

View File

@ -227,7 +227,7 @@ retry:
goto cleanup;
sprintf(buf, "inode bitmap for %s", fs->device_name);
retval = ext2fs_allocate_inode_bitmap(fs, 0, &fs->inode_map);
retval = ext2fs_allocate_inode_bitmap(fs, buf, &fs->inode_map);
if (retval)
goto cleanup;

View File

@ -149,15 +149,15 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino,
scan->ptr += scan->inode_size - extra_bytes;
scan->bytes_left -= scan->inode_size - extra_bytes;
if ((scan->fs->flags & EXT2_SWAP_BYTES) ||
(scan->fs->flags & EXT2_SWAP_BYTES_READ))
if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) ||
(scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
ext2fs_swap_inode(scan->fs, inode,
(struct ext2_inode *) scan->temp_buffer, 0);
else
*inode = *((struct ext2_inode *) scan->temp_buffer);
} else {
if ((scan->fs->flags & EXT2_SWAP_BYTES) ||
(scan->fs->flags & EXT2_SWAP_BYTES_READ))
if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) ||
(scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
ext2fs_swap_inode(scan->fs, inode,
(struct ext2_inode *) scan->ptr, 0);
else
@ -266,8 +266,8 @@ errcode_t ext2fs_read_inode (ext2_filsys fs, unsigned long ino,
} else
memcpy((char *) inode, ptr, length);
if ((fs->flags & EXT2_SWAP_BYTES) ||
(fs->flags & EXT2_SWAP_BYTES_READ))
if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
(fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
ext2fs_swap_inode(fs, inode, inode, 0);
/* Update the inode cache */
@ -322,8 +322,8 @@ errcode_t ext2fs_write_inode(ext2_filsys fs, unsigned long ino,
inode_buffer_size = fs->blocksize;
inode_buffer_block = 0;
}
if ((fs->flags & EXT2_SWAP_BYTES) ||
(fs->flags & EXT2_SWAP_BYTES_WRITE))
if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
(fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE))
ext2fs_swap_inode(fs, &temp_inode, inode, 1);
else
memcpy(&temp_inode, inode, sizeof(struct ext2_inode));

View File

@ -24,7 +24,7 @@ int ext2fs_native_flag(void)
{
if (i386_byteorder())
return 0;
return EXT2_SWAP_BYTES;
return EXT2_FLAG_SWAP_BYTES;
}

View File

@ -89,8 +89,8 @@ errcode_t ext2fs_open(const char *name, int flags, int superblock,
goto cleanup;
if ((fs->super->s_magic == ext2fs_swab16(EXT2_SUPER_MAGIC)) ||
(fs->flags & EXT2_SWAP_BYTES)) {
fs->flags |= EXT2_SWAP_BYTES;
(fs->flags & EXT2_FLAG_SWAP_BYTES)) {
fs->flags |= EXT2_FLAG_SWAP_BYTES;
ext2fs_swap_super(fs->super);
}
@ -156,7 +156,7 @@ errcode_t ext2fs_open(const char *name, int flags, int superblock,
if (retval)
goto cleanup;
group_block++;
if (fs->flags & EXT2_SWAP_BYTES) {
if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
gdp = (struct ext2_group_desc *) dest;
groups_per_block = fs->blocksize /
sizeof(struct ext2_group_desc);

View File

@ -1,3 +1,7 @@
Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs version 1.05
Fri Aug 30 22:36:48 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* invocation.c (ss_create_invocation): Change function prototype

View File

@ -9,8 +9,8 @@
* $Locker$
*
* $Log$
* Revision 1.8 1997/04/29 14:52:31 tytso
* Checked in e2fsprogs 1.05
* Revision 1.9 1997/04/29 15:29:28 tytso
* Checked in e2fsprogs 1.06
*
* Revision 1.1 1993/06/03 12:31:25 tytso
* Initial revision

View File

@ -1,3 +1,7 @@
Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs version 1.05
Tue Aug 27 16:50:43 1996 Miles Bader <miles@gnu.ai.mit.edu>
* uuid/gen_uuid.c [HAVE_NET_IF_H] <net/if.h>: Include guarded.

View File

@ -1,3 +1,18 @@
Mon Oct 7 00:56:24 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* chattr.1.in: Documented the 'A' (noatime) attribute.
* dumpe2fs.c (main): Change EXT2_SWAP to EXT2_FLAG_SWAP for
consistency's sake.
Sun Sep 22 16:18:47 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* chattr.c (decode_arg): Add support for the 'A' (noatime) flag.
Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs version 1.05
Sat Sep 7 07:34:11 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* tune2fs.c (main): Add support for new option -C, which sets the

View File

@ -62,13 +62,18 @@ the `sync' mount option applied to a subset of the files.
When a file with the `u' attribute set is deleted, its contents is saved.
This allows the user to ask for its undeletion.
When a file with the 'A' attribute set is modified, its atime record is
not modified. This avoid a certain amount of disk I/O for laptop
systems.
.SH AUTHOR
.B chattr
has been written by Remy Card <card@masi.ibp.fr>, the developer and maintainer
of the ext2 fs.
.SH BUGS AND LIMITATIONS
As of ext2 fs 0.5a, the `c' and `u' attribute are not honoured by the kernel
code.
code. As of the Linux 2.0 kernel, the 'A' attribute is not yet supported by
the kernel code. (The noatime code is still in testing.)
.PP
These attributes will be implemented in a future ext2 fs version.
.SH AVAILABILITY

View File

@ -88,6 +88,12 @@ static int decode_arg (int * i, int argc, char ** argv)
rf |= EXT2_APPEND_FL;
rem = 1;
break;
#endif
#ifdef EXT2_NOATIME_FL
case 'A':
rf |= EXT2_NOATIME_FL;
rem = 1;
break;
#endif
case 'c':
rf |= EXT2_COMPR_FL;
@ -144,6 +150,11 @@ static int decode_arg (int * i, int argc, char ** argv)
case 'a':
af |= EXT2_APPEND_FL;
break;
#endif
#ifdef EXT2_NOATIME_FL
case 'A':
af |= EXT2_NOATIME_FL;
break;
#endif
case 'c':
af |= EXT2_COMPR_FL;
@ -180,6 +191,11 @@ static int decode_arg (int * i, int argc, char ** argv)
case 'a':
sf |= EXT2_APPEND_FL;
break;
#endif
#ifdef EXT2_NOATIME_FL
case 'A':
sf |= EXT2_NOATIME_FL;
break;
#endif
case 'c':
sf |= EXT2_COMPR_FL;

View File

@ -7,6 +7,12 @@
dumpe2fs \- dump filesystem information
.SH SYNOPSIS
.B dumpe2fs
[
.B -b
]
[
.B -V
]
device
.SH DESCRIPTION
.BI dumpe2fs
@ -18,6 +24,13 @@ present on
is similar to Berkeley's
.BI dumpfs
program for the BSD Fast File System.
.SH OPTIONS
.TP
.I -b
print the blocks which are reserved as bad in the filesystem.
.TP
.I -V
print the version number of dumpe2fs and exit.
.SH BUGS
You need to know the physical filesystem structure to understand the
output.

View File

@ -39,7 +39,7 @@ char * device_name = NULL;
static volatile void usage (void)
{
fprintf (stderr, "usage: %s device\n", program_name);
fprintf (stderr, "usage: %s [-bV] device\n", program_name);
exit (1);
}
@ -166,17 +166,23 @@ void main (int argc, char ** argv)
int big_endian;
char c;
initialize_ext2_error_table();
fprintf (stderr, "dumpe2fs %s, %s for EXT2 FS %s, %s\n",
E2FSPROGS_VERSION, E2FSPROGS_DATE,
EXT2FS_VERSION, EXT2FS_DATE);
if (argc && *argv)
program_name = *argv;
while ((c = getopt (argc, argv, "b")) != EOF) {
while ((c = getopt (argc, argv, "bV")) != EOF) {
switch (c) {
case 'b':
print_badblocks++;
break;
case 'V':
/* Print version number and exit */
fprintf(stderr, "\tUsing %s\n",
error_message(EXT2_ET_BASE));
exit(0);
default:
usage ();
}
@ -184,7 +190,6 @@ void main (int argc, char ** argv)
if (optind > argc - 1)
usage ();
device_name = argv[optind++];
initialize_ext2_error_table();
retval = ext2fs_open (device_name, 0, 0, 0, unix_io_manager, &fs);
if (retval) {
com_err (program_name, retval, "while trying to open %s",
@ -203,7 +208,7 @@ void main (int argc, char ** argv)
ext2fs_close (fs);
exit (1);
}
big_endian = ((fs->flags & EXT2_SWAP_BYTES) != 0);
big_endian = ((fs->flags & EXT2_FLAG_SWAP_BYTES) != 0);
if (!i386_byteorder())
big_endian = !big_endian;
if (big_endian)

View File

@ -1,3 +1,20 @@
Mon Oct 7 07:52:41 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* f_preen: New test case which makes sure that e2fsck -p won't
bash the backup superblock in case of a corrupted master
superblock.
* test_script.in: Let the environment variable TEST_CONFIG to
override the location of the test_config file. Move
definition of TMP_DIR to test_config.
* test_config: Add new defnitions for mke2fs, dumpe2fs, tune2fs,
lsattr, and chattr.
Thu Sep 12 15:23:07 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Release of E2fsprogs version 1.05
Mon Sep 9 23:09:47 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Makefile.in (check): Add explicit ./ to test_script invokation,

View File

@ -1,11 +1,8 @@
Filesystem did not have a UUID; generating one.
Pass 1: Checking inodes, blocks, and sizes
Deleted inode 2 has zero dtime.
Set dtime? yes
Root inode is not a directory. Clear? yes
Pass 2: Checking directory structure
Entry '..' in /lost+found (11) has deleted/unused inode 2.
Entry '..' in ??? (11) has deleted/unused inode 2.
Clear? yes
Pass 3: Checking directory connectivity
@ -556,6 +553,12 @@ Connect to /lost+found? yes
Inode 100 has ref count 2, expecting 1.
Set i_nlinks to count? yes
Unattached inode 101
Connect to /lost+found? yes
Inode 101 has ref count 2, expecting 1.
Set i_nlinks to count? yes
Unattached inode 102
Connect to /lost+found? yes
@ -574,16 +577,57 @@ Connect to /lost+found? yes
Inode 104 has ref count 2, expecting 1.
Set i_nlinks to count? yes
Unattached inode 105
Connect to /lost+found? yes
Inode 105 has ref count 2, expecting 1.
Set i_nlinks to count? yes
Unattached inode 106
Connect to /lost+found? yes
Inode 106 has ref count 2, expecting 1.
Set i_nlinks to count? yes
Unattached inode 107
Connect to /lost+found? yes
Inode 107 has ref count 2, expecting 1.
Set i_nlinks to count? yes
Unattached inode 108
Connect to /lost+found? yes
Inode 108 has ref count 2, expecting 1.
Set i_nlinks to count? yes
Unattached inode 109
Connect to /lost+found? yes
Inode 109 has ref count 2, expecting 1.
Set i_nlinks to count? yes
Unattached inode 110
Connect to /lost+found? yes
Inode 110 has ref count 2, expecting 1.
Set i_nlinks to count? yes
Unattached inode 111
Connect to /lost+found? yes
Inode 111 has ref count 2, expecting 1.
Set i_nlinks to count? yes
Pass 5: Checking group summary information
Fix summary information? yes
Block bitmap differences: -33. FIXED
Free blocks count wrong for group 0 (68, counted=67). FIXED
Free blocks count wrong (68, counted=67). FIXED
Free inodes count wrong for group #0 (1, counted=0). FIXED
Free blocks count wrong for group 0 (56, counted=55). FIXED
Free blocks count wrong (56, counted=55). FIXED
Free inodes count wrong for group #0 (89, counted=88). FIXED
Directories count wrong for group #0 (2, counted=3). FIXED
Free inodes count wrong (1, counted=0). FIXED
Free inodes count wrong (89, counted=88). FIXED
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 104/104 files (0.0% non-contiguous), 33/100 blocks
test_filesys: 112/200 files (0.0% non-contiguous), 145/200 blocks
Exit status is 1

View File

@ -3,5 +3,5 @@ Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 104/104 files (0.0% non-contiguous), 33/100 blocks
test_filesys: 112/200 files (0.9% non-contiguous), 145/200 blocks
Exit status is 0

Binary file not shown.

View File

@ -12,19 +12,11 @@ Clear dtime? yes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Unattached inode 15
Connect to /lost+found? yes
Inode 15 has ref count 2, expecting 1.
Set i_nlinks to count? yes
Unattached zero-length inode 15
Clear? yes
Pass 5: Checking group summary information
Fix summary information? yes
Inode bitmap differences: +15. FIXED
Free inodes count wrong for group #0 (17, counted=16). FIXED
Free inodes count wrong (17, counted=16). FIXED
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 16/32 files (0.0% non-contiguous), 25/100 blocks
test_filesys: 15/32 files (0.0% non-contiguous), 25/100 blocks
Exit status is 1

View File

@ -3,5 +3,5 @@ Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 16/32 files (0.0% non-contiguous), 25/100 blocks
test_filesys: 15/32 files (0.0% non-contiguous), 25/100 blocks
Exit status is 0

View File

@ -29,22 +29,18 @@ Set i_nlinks to count? yes
Inode 12 has ref count 4, expecting 3.
Set i_nlinks to count? yes
Unattached inode 15
Connect to /lost+found? yes
Inode 15 has ref count 2, expecting 1.
Set i_nlinks to count? yes
Unattached zero-length inode 15
Clear? yes
Pass 5: Checking group summary information
Fix summary information? yes
Free blocks count wrong for group 0 (75, counted=74). FIXED
Free blocks count wrong (75, counted=74). FIXED
Inode bitmap differences: +15. FIXED
Free inodes count wrong for group #0 (17, counted=15). FIXED
Free inodes count wrong for group #0 (17, counted=16). FIXED
Directories count wrong for group #0 (4, counted=5). FIXED
Free inodes count wrong (17, counted=15). FIXED
Free inodes count wrong (17, counted=16). FIXED
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 17/32 files (0.0% non-contiguous), 26/100 blocks
test_filesys: 16/32 files (0.0% non-contiguous), 26/100 blocks
Exit status is 1

View File

@ -3,5 +3,5 @@ Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test_filesys: 17/32 files (0.0% non-contiguous), 26/100 blocks
test_filesys: 16/32 files (0.0% non-contiguous), 26/100 blocks
Exit status is 0

12
tests/f_preen/expect.1 Normal file
View File

@ -0,0 +1,12 @@
which require relocation, or one part of the inode table
which must be moved, you may wish to try running e2fsck
the '-b 8193' option first. The problem may lie only with
the primary block group descriptor, and the backup block
group descriptor may be OK.
Block bitmap for group 0 is not in group. (block 0)
test_filesys: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
(i.e., without -a or -p options)
Exit status is 4

18
tests/f_preen/expect.2 Normal file
View File

@ -0,0 +1,18 @@
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Fix summary information? yes
Free blocks count wrong for group 0 (8042, counted=7614). FIXED
Free blocks count wrong for group 1 (170, counted=169). FIXED
Free blocks count wrong (8212, counted=7783). FIXED
Free inodes count wrong for group #0 (1053, counted=1052). FIXED
Free inodes count wrong for group #1 (1064, counted=1063). FIXED
Directories count wrong for group #1 (0, counted=1). FIXED
Free inodes count wrong (2117, counted=2115). FIXED
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 13/2128 files (0.0% non-contiguous), 717/8500 blocks
Exit status is 1

BIN
tests/f_preen/image.gz Normal file

Binary file not shown.

1
tests/f_preen/name Normal file
View File

@ -0,0 +1 @@
preen should't destroy backup superblocks

4
tests/f_preen/script Normal file
View File

@ -0,0 +1,4 @@
FSCK_OPT=-pf
SECOND_FSCK_OPT=-yfb8193
. $cmd_dir/run_e2fsck

View File

@ -3,8 +3,14 @@
#
FSCK=../e2fsck/e2fsck
MKE2FS=../misc/mke2fs
DUMPE2FS=../misc/dumpe2fs
TUNE2FS=../misc/tune2fs
CHATTR=../misc/chattr
LSATTR=../misc/lsattr
DEBUGFS=../debugfs/debugfs
LD_LIBRARY_PATH=../lib:../lib/ext2fs:../lib/e2p:../lib/et:../lib/ss
TMPFILE=./test.img
export LD_LIBRARY_PATH
TZ=GMT
export TZ

View File

@ -14,9 +14,12 @@ else
fi
cmd_dir=$SRCDIR
TMPFILE=./test.img
. $SRCDIR/test_config
if test "$TEST_CONFIG"x = x; then
TEST_CONFIG=$SRCDIR/test_config
fi
. $TEST_CONFIG
for test_dir in $TESTS
do

View File

@ -6,6 +6,6 @@
* under the GNU Public License.
*/
#define E2FSPROGS_VERSION "1.05"
#define E2FSPROGS_DATE "9-Sep-96"
#define E2FSPROGS_VERSION "1.06"
#define E2FSPROGS_DATE "7-Oct-96"