mirror of https://github.com/vitalif/e2fsprogs
ChangeLog, e2fsck.h, pass1.c, pass2.c, pass4.c, swapfs.c:
e2fsck.h: pass1.c (pass1_get_blocks, pass1_read_inode, pass1_write_inode, pass1_check_directory, e2fsck_use_inode_shortcuts): Make pass1_* be private static functions, and create new function e2fsck_use_inode_shortcuts which sets and clears the inode shortcut functions in the fs structure. e2fsck.h: pass2.c (e2fsck_process_bad_inode): Make process_bad_inode() an exported function. pass4.c (e2fsck_pass4): Call e2fsck_process_bad_inode to check if a disconnected inode has any problems before connecting it to /lost+found. Bug and suggested fix by Pavel Machek <pavel@bug.ucw.cz> ChangeLog, swapfs.c: swapfs.c (ext2fs_swap_inode): Add compatibility for Linux 2.3 kernels that use i_generation instead of i_version. Patch supplied by Jon Bright <sircus@sircus.demon.co.uk>. ChangeLog, mke2fs.8.in: mke2fs.8.in: Fix typo in man page which caused the badblocks command to not show up in the "SEE ALSO" section. ChangeLog, expect.1, expect.2, image.gz, name: f_recnect_bad: New test which checks the case where a disconnect inode also bad inode fields; we need to make sure e2fsck offers to fix the inode (or clear the inode, as necessary).bitmap-optimize
parent
b41d360bf5
commit
e72a9ba394
|
@ -1,4 +1,22 @@
|
|||
1999-06-21 <tytso@rsts-11.mit.edu>
|
||||
1999-06-25 <tytso@rsts-11.mit.edu>
|
||||
|
||||
* e2fsck.h:
|
||||
* pass1.c (pass1_get_blocks, pass1_read_inode, pass1_write_inode,
|
||||
pass1_check_directory, e2fsck_use_inode_shortcuts): Make
|
||||
pass1_* be private static functions, and create new
|
||||
function e2fsck_use_inode_shortcuts which sets and clears
|
||||
the inode shortcut functions in the fs structure.
|
||||
|
||||
* e2fsck.h:
|
||||
* pass2.c (e2fsck_process_bad_inode): Make process_bad_inode() an
|
||||
exported function.
|
||||
|
||||
* pass4.c (e2fsck_pass4): Call e2fsck_process_bad_inode to check
|
||||
if a disconnected inode has any problems before
|
||||
connecting it to /lost+found. Bug and suggested fix by
|
||||
Pavel Machek <pavel@bug.ucw.cz>
|
||||
|
||||
1999-06-21 <tytso@valinux.com>
|
||||
|
||||
* unix.c (main): Add missing space in the disk write-protected
|
||||
message.
|
||||
|
|
|
@ -241,15 +241,6 @@ extern void e2fsck_free_context(e2fsck_t ctx);
|
|||
extern int e2fsck_run(e2fsck_t ctx);
|
||||
|
||||
|
||||
/* pass1.c */
|
||||
extern errcode_t pass1_check_directory(ext2_filsys fs, ino_t ino);
|
||||
extern errcode_t pass1_get_blocks(ext2_filsys fs, ino_t ino, blk_t *blocks);
|
||||
extern errcode_t pass1_read_inode(ext2_filsys fs, ino_t ino,
|
||||
struct ext2_inode *inode);
|
||||
extern errcode_t pass1_write_inode(ext2_filsys fs, ino_t ino,
|
||||
struct ext2_inode *inode);
|
||||
extern int e2fsck_pass1_check_device_inode(struct ext2_inode *inode);
|
||||
|
||||
/* badblock.c */
|
||||
extern void read_bad_blocks_file(e2fsck_t ctx, const char *bad_blocks_file,
|
||||
int replace_bad_blocks);
|
||||
|
@ -267,6 +258,16 @@ extern struct dir_info *e2fsck_dir_info_iter(e2fsck_t ctx, int *control);
|
|||
extern const char *ehandler_operation(const char *op);
|
||||
extern void ehandler_init(io_channel channel);
|
||||
|
||||
/* pass1.c */
|
||||
extern void e2fsck_use_inode_shortcuts(e2fsck_t ctx, int bool);
|
||||
extern int e2fsck_pass1_check_device_inode(struct ext2_inode *inode);
|
||||
|
||||
/* pass2.c */
|
||||
extern int e2fsck_process_bad_inode(e2fsck_t ctx, ino_t dir, ino_t ino);
|
||||
|
||||
/* pass3.c */
|
||||
extern int e2fsck_reconnect_file(e2fsck_t ctx, ino_t inode);
|
||||
|
||||
/* super.c */
|
||||
void check_super_block(e2fsck_t ctx);
|
||||
errcode_t e2fsck_get_device_size(e2fsck_t ctx);
|
||||
|
@ -298,7 +299,3 @@ extern void mtrace_print(char *mesg);
|
|||
#endif
|
||||
extern blk_t get_backup_sb(ext2_filsys fs);
|
||||
|
||||
/*
|
||||
* pass3.c
|
||||
*/
|
||||
extern int e2fsck_reconnect_file(e2fsck_t ctx, ino_t inode);
|
||||
|
|
|
@ -239,10 +239,7 @@ void e2fsck_pass1(e2fsck_t ctx)
|
|||
mark_table_blocks(ctx);
|
||||
block_buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize * 3,
|
||||
"block interate buffer");
|
||||
fs->get_blocks = pass1_get_blocks;
|
||||
fs->check_directory = pass1_check_directory;
|
||||
fs->read_inode = pass1_read_inode;
|
||||
fs->write_inode = pass1_write_inode;
|
||||
e2fsck_use_inode_shortcuts(ctx, 1);
|
||||
ehandler_operation("doing inode scan");
|
||||
pctx.errcode = ext2fs_open_inode_scan(fs, ctx->inode_buffer_blocks,
|
||||
&scan);
|
||||
|
@ -501,10 +498,7 @@ void e2fsck_pass1(e2fsck_t ctx)
|
|||
}
|
||||
ext2fs_free_mem((void **) &inodes_to_process);
|
||||
endit:
|
||||
fs->get_blocks = 0;
|
||||
fs->check_directory = 0;
|
||||
fs->read_inode = 0;
|
||||
fs->write_inode = 0;
|
||||
e2fsck_use_inode_shortcuts(ctx, 0);
|
||||
|
||||
ext2fs_free_mem((void **) &block_buf);
|
||||
ext2fs_free_block_bitmap(ctx->block_illegal_map);
|
||||
|
@ -1313,12 +1307,12 @@ static void mark_table_blocks(e2fsck_t ctx)
|
|||
}
|
||||
|
||||
/*
|
||||
* This subroutines short circuits ext2fs_get_blocks and
|
||||
* Thes subroutines short circuits ext2fs_get_blocks and
|
||||
* ext2fs_check_directory; we use them since we already have the inode
|
||||
* structure, so there's no point in letting the ext2fs library read
|
||||
* the inode again.
|
||||
*/
|
||||
errcode_t pass1_get_blocks(ext2_filsys fs, ino_t ino, blk_t *blocks)
|
||||
static errcode_t pass1_get_blocks(ext2_filsys fs, ino_t ino, blk_t *blocks)
|
||||
{
|
||||
e2fsck_t ctx = (e2fsck_t) fs->priv_data;
|
||||
int i;
|
||||
|
@ -1331,7 +1325,8 @@ errcode_t pass1_get_blocks(ext2_filsys fs, ino_t ino, blk_t *blocks)
|
|||
return 0;
|
||||
}
|
||||
|
||||
errcode_t pass1_read_inode(ext2_filsys fs, ino_t ino, struct ext2_inode *inode)
|
||||
static errcode_t pass1_read_inode(ext2_filsys fs, ino_t ino,
|
||||
struct ext2_inode *inode)
|
||||
{
|
||||
e2fsck_t ctx = (e2fsck_t) fs->priv_data;
|
||||
|
||||
|
@ -1341,7 +1336,7 @@ errcode_t pass1_read_inode(ext2_filsys fs, ino_t ino, struct ext2_inode *inode)
|
|||
return 0;
|
||||
}
|
||||
|
||||
errcode_t pass1_write_inode(ext2_filsys fs, ino_t ino,
|
||||
static errcode_t pass1_write_inode(ext2_filsys fs, ino_t ino,
|
||||
struct ext2_inode *inode)
|
||||
{
|
||||
e2fsck_t ctx = (e2fsck_t) fs->priv_data;
|
||||
|
@ -1351,7 +1346,7 @@ errcode_t pass1_write_inode(ext2_filsys fs, ino_t ino,
|
|||
return EXT2_ET_CALLBACK_NOTHANDLED;
|
||||
}
|
||||
|
||||
errcode_t pass1_check_directory(ext2_filsys fs, ino_t ino)
|
||||
static errcode_t pass1_check_directory(ext2_filsys fs, ino_t ino)
|
||||
{
|
||||
e2fsck_t ctx = (e2fsck_t) fs->priv_data;
|
||||
|
||||
|
@ -1362,3 +1357,23 @@ errcode_t pass1_check_directory(ext2_filsys fs, ino_t ino)
|
|||
return EXT2_ET_NO_DIRECTORY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void e2fsck_use_inode_shortcuts(e2fsck_t ctx, int bool)
|
||||
{
|
||||
ext2_filsys fs = ctx->fs;
|
||||
|
||||
if (bool) {
|
||||
fs->get_blocks = pass1_get_blocks;
|
||||
fs->check_directory = pass1_check_directory;
|
||||
fs->read_inode = pass1_read_inode;
|
||||
fs->write_inode = pass1_write_inode;
|
||||
ctx->stashed_ino = 0;
|
||||
} else {
|
||||
fs->get_blocks = 0;
|
||||
fs->check_directory = 0;
|
||||
fs->read_inode = 0;
|
||||
fs->write_inode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
*/
|
||||
static void deallocate_inode(e2fsck_t ctx, ino_t ino,
|
||||
char* block_buf);
|
||||
static int process_bad_inode(e2fsck_t ctx, ino_t dir, ino_t ino);
|
||||
static int check_dir_block(ext2_filsys fs,
|
||||
struct ext2_db_entry *dir_blocks_info,
|
||||
void *priv_data);
|
||||
|
@ -451,7 +450,8 @@ static int check_dir_block(ext2_filsys fs,
|
|||
if (ctx->inode_bad_map &&
|
||||
ext2fs_test_inode_bitmap(ctx->inode_bad_map,
|
||||
dirent->inode)) {
|
||||
if (process_bad_inode(ctx, ino, dirent->inode)) {
|
||||
if (e2fsck_process_bad_inode(ctx, ino,
|
||||
dirent->inode)) {
|
||||
dirent->inode = 0;
|
||||
dir_modified++;
|
||||
goto next;
|
||||
|
@ -585,7 +585,7 @@ static void deallocate_inode(e2fsck_t ctx, ino_t ino,
|
|||
}
|
||||
}
|
||||
|
||||
static int process_bad_inode(e2fsck_t ctx, ino_t dir, ino_t ino)
|
||||
extern int e2fsck_process_bad_inode(e2fsck_t ctx, ino_t dir, ino_t ino)
|
||||
{
|
||||
ext2_filsys fs = ctx->fs;
|
||||
struct ext2_inode inode;
|
||||
|
|
|
@ -123,6 +123,8 @@ void e2fsck_pass4(e2fsck_t ctx)
|
|||
ext2fs_icount_fetch(ctx->inode_link_info, i, &link_count);
|
||||
ext2fs_icount_fetch(ctx->inode_count, i, &link_counted);
|
||||
if (link_counted == 0) {
|
||||
if (e2fsck_process_bad_inode(ctx, 0, i))
|
||||
continue;
|
||||
if (disconnect_inode(ctx, i))
|
||||
continue;
|
||||
ext2fs_icount_fetch(ctx->inode_link_info, i,
|
||||
|
|
|
@ -114,8 +114,7 @@ static void swap_inodes(e2fsck_t ctx)
|
|||
errcode_t retval;
|
||||
struct ext2_inode * inode;
|
||||
|
||||
fs->read_inode = pass1_read_inode;
|
||||
fs->get_blocks = pass1_get_blocks;
|
||||
e2fsck_use_inode_shortcuts(ctx, 1);
|
||||
|
||||
retval = ext2fs_get_mem(fs->blocksize * fs->inode_blocks_per_group,
|
||||
(void **) &buf);
|
||||
|
@ -179,8 +178,7 @@ static void swap_inodes(e2fsck_t ctx)
|
|||
}
|
||||
ext2fs_free_mem((void **) &buf);
|
||||
ext2fs_free_mem((void **) &block_buf);
|
||||
fs->read_inode = 0;
|
||||
fs->get_blocks = 0;
|
||||
e2fsck_use_inode_shortcuts(ctx, 0);
|
||||
}
|
||||
|
||||
void swap_filesys(e2fsck_t ctx)
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
1999-06-21 <tytso@rsts-11.mit.edu>
|
||||
1999-06-23 <tytso@valinux.com>
|
||||
|
||||
* swapfs.c (ext2fs_swap_inode): Add compatibility for Linux 2.3
|
||||
kernels that use i_generation instead of i_version. Patch
|
||||
supplied by Jon Bright <sircus@sircus.demon.co.uk>.
|
||||
|
||||
1999-06-21 <tytso@valinux.com>
|
||||
|
||||
* dir_iterate.c (ext2fs_process_dir_block): Check for corrupted
|
||||
directory entry before calling the callback function.
|
||||
|
|
|
@ -100,7 +100,11 @@ void ext2fs_swap_inode(ext2_filsys fs, struct ext2_inode *t,
|
|||
for (i = 0; i < EXT2_N_BLOCKS; i++)
|
||||
t->i_block[i] = f->i_block[i];
|
||||
}
|
||||
#if defined(HAVE_EXT2_INODE_VERSION)
|
||||
t->i_version = ext2fs_swab32(f->i_version);
|
||||
#else
|
||||
t->i_generation = ext2fs_swab32(f->i_generation);
|
||||
#endif
|
||||
t->i_file_acl = ext2fs_swab32(f->i_file_acl);
|
||||
t->i_dir_acl = ext2fs_swab32(f->i_dir_acl);
|
||||
t->i_faddr = ext2fs_swab32(f->i_faddr);
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
1999-06-24 <tytso@valinux.com>
|
||||
|
||||
* mke2fs.8.in: Fix typo in man page which caused the badblocks
|
||||
command to not show up in the "SEE ALSO" section.
|
||||
|
||||
1999-05-02 <tytso@rsts-11.mit.edu>
|
||||
|
||||
* findsuper.c: Added documentation from aeb@cwi.nl; some minor
|
||||
|
|
|
@ -208,7 +208,7 @@ There may be some other ones. Please, report them to the author.
|
|||
is part of the e2fsprogs package and is available for anonymous
|
||||
ftp from tsx-11.mit.edu in /pub/linux/packages/ext2fs.
|
||||
.SH SEE ALSO
|
||||
.BT badblocks (8),
|
||||
.BR badblocks (8),
|
||||
.BR dumpe2fs (8),
|
||||
.BR e2fsck (8),
|
||||
.BR tune2fs (8)
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
1999-06-25 <tytso@rsts-11.mit.edu>
|
||||
|
||||
* f_recnect_bad: New test which checks the case where a disconnect
|
||||
inode also bad inode fields; we need to make sure e2fsck
|
||||
offers to fix the inode (or clear the inode, as necessary).
|
||||
|
||||
1999-03-14 Theodore Ts'o <tytso@rsts-11.mit.edu>
|
||||
|
||||
* f_lpffile: New test which checks how e2fsck handles a the case
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
Pass 1: Checking inodes, blocks, and sizes
|
||||
Pass 2: Checking directory structure
|
||||
i_faddr for inode 15 (/test/quux) is 23, should be zero.
|
||||
Clear? yes
|
||||
|
||||
i_dir_acl for inode 15 (/test/quux) is 12, should be zero.
|
||||
Clear? yes
|
||||
|
||||
i_faddr for inode 13 (/test/???) is 12, should be zero.
|
||||
Clear? yes
|
||||
|
||||
i_file_acl for inode 13 (/test/???) is 12, should be zero.
|
||||
Clear? yes
|
||||
|
||||
Pass 3: Checking directory connectivity
|
||||
Unconnected directory inode 13 (/test/???)
|
||||
Connect to /lost+found? yes
|
||||
|
||||
Pass 4: Checking reference counts
|
||||
Inode 13 ref count is 4, should be 3. Fix? yes
|
||||
|
||||
Inode 28 (...) has a bad mode (0177777).
|
||||
Clear? yes
|
||||
|
||||
Pass 5: Checking group summary information
|
||||
|
||||
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
|
||||
test_filesys: 15/32 files (0.0% non-contiguous), 26/100 blocks
|
||||
Exit status is 1
|
|
@ -0,0 +1,7 @@
|
|||
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
|
||||
test_filesys: 15/32 files (0.0% non-contiguous), 26/100 blocks
|
||||
Exit status is 0
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
Reconnecting bad inode
|
Loading…
Reference in New Issue