mirror of https://github.com/vitalif/e2fsprogs
e2fsck: Convert e2fsck to new bitmap interface
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>bitmap-optimize
parent
463e732777
commit
c5d2f50dee
|
@ -97,7 +97,7 @@ void add_empty_dirblock(empty_dir_info edi,
|
|||
printf(_("Empty directory block %u (#%d) in inode %u\n"),
|
||||
db->blk, db->blockcnt, db->ino);
|
||||
|
||||
ext2fs_mark_block_bitmap(edi->empty_dir_blocks, db->blk);
|
||||
ext2fs_mark_block_bitmap2(edi->empty_dir_blocks, db->blk);
|
||||
if (ext2fs_test_inode_bitmap(edi->dir_map, db->ino))
|
||||
return;
|
||||
ext2fs_mark_inode_bitmap(edi->dir_map, db->ino);
|
||||
|
@ -135,7 +135,7 @@ int empty_pass1(ext2_filsys fs, blk_t *block_nr, e2_blkcnt_t blockcnt,
|
|||
if (new_block == 0)
|
||||
break;
|
||||
edi->logblk++;
|
||||
} while (ext2fs_test_block_bitmap(edi->empty_dir_blocks, new_block));
|
||||
} while (ext2fs_test_block_bitmap2(edi->empty_dir_blocks, new_block));
|
||||
|
||||
if (new_block == block)
|
||||
return 0;
|
||||
|
|
|
@ -1009,7 +1009,7 @@ void e2fsck_move_ext3_journal(e2fsck_t ctx)
|
|||
goto err_out;
|
||||
|
||||
group = ext2fs_group_of_ino(fs, ino);
|
||||
ext2fs_unmark_inode_bitmap(fs->inode_map, ino);
|
||||
ext2fs_unmark_inode_bitmap2(fs->inode_map, ino);
|
||||
ext2fs_mark_ib_dirty(fs);
|
||||
fs->group_desc[group].bg_free_inodes_count++;
|
||||
ext2fs_group_desc_csum_set(fs, group);
|
||||
|
|
103
e2fsck/pass1.c
103
e2fsck/pass1.c
|
@ -419,7 +419,7 @@ static void check_is_really_dir(e2fsck_t ctx, struct problem_context *pctx,
|
|||
|
||||
if (blk < ctx->fs->super->s_first_data_block ||
|
||||
blk >= ctx->fs->super->s_blocks_count ||
|
||||
ext2fs_fast_test_block_bitmap(ctx->block_found_map, blk))
|
||||
ext2fs_fast_test_block_bitmap2(ctx->block_found_map, blk))
|
||||
return; /* Invalid block, can't be dir */
|
||||
}
|
||||
|
||||
|
@ -660,8 +660,8 @@ void e2fsck_pass1(e2fsck_t ctx)
|
|||
if (pctx.errcode == EXT2_ET_BAD_BLOCK_IN_INODE_TABLE) {
|
||||
if (!ctx->inode_bb_map)
|
||||
alloc_bb_map(ctx);
|
||||
ext2fs_mark_inode_bitmap(ctx->inode_bb_map, ino);
|
||||
ext2fs_mark_inode_bitmap(ctx->inode_used_map, ino);
|
||||
ext2fs_mark_inode_bitmap2(ctx->inode_bb_map, ino);
|
||||
ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino);
|
||||
continue;
|
||||
}
|
||||
if (pctx.errcode) {
|
||||
|
@ -713,7 +713,7 @@ void e2fsck_pass1(e2fsck_t ctx)
|
|||
clear_inode:
|
||||
e2fsck_clear_inode(ctx, ino, inode, 0, "pass1");
|
||||
if (ino == EXT2_BAD_INO)
|
||||
ext2fs_mark_inode_bitmap(ctx->inode_used_map,
|
||||
ext2fs_mark_inode_bitmap2(ctx->inode_used_map,
|
||||
ino);
|
||||
continue;
|
||||
}
|
||||
|
@ -786,7 +786,7 @@ void e2fsck_pass1(e2fsck_t ctx)
|
|||
ctx->flags |= E2F_FLAG_ABORT;
|
||||
return;
|
||||
}
|
||||
ext2fs_mark_inode_bitmap(ctx->inode_used_map, ino);
|
||||
ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino);
|
||||
clear_problem_context(&pctx);
|
||||
continue;
|
||||
} else if (ino == EXT2_ROOT_INO) {
|
||||
|
@ -816,7 +816,7 @@ void e2fsck_pass1(e2fsck_t ctx)
|
|||
}
|
||||
}
|
||||
} else if (ino == EXT2_JOURNAL_INO) {
|
||||
ext2fs_mark_inode_bitmap(ctx->inode_used_map, ino);
|
||||
ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino);
|
||||
if (fs->super->s_journal_inum == EXT2_JOURNAL_INO) {
|
||||
if (!LINUX_S_ISREG(inode->i_mode) &&
|
||||
fix_problem(ctx, PR_1_JOURNAL_BAD_MODE,
|
||||
|
@ -841,7 +841,7 @@ void e2fsck_pass1(e2fsck_t ctx)
|
|||
} else if (ino < EXT2_FIRST_INODE(fs->super)) {
|
||||
int problem = 0;
|
||||
|
||||
ext2fs_mark_inode_bitmap(ctx->inode_used_map, ino);
|
||||
ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino);
|
||||
if (ino == EXT2_BOOT_LOADER_INO) {
|
||||
if (LINUX_S_ISDIR(inode->i_mode))
|
||||
problem = PR_1_RESERVED_BAD_MODE;
|
||||
|
@ -922,7 +922,7 @@ void e2fsck_pass1(e2fsck_t ctx)
|
|||
}
|
||||
}
|
||||
|
||||
ext2fs_mark_inode_bitmap(ctx->inode_used_map, ino);
|
||||
ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino);
|
||||
switch (fs->super->s_creator_os) {
|
||||
case EXT2_OS_HURD:
|
||||
frag = inode->osd2.hurd2.h_i_frag;
|
||||
|
@ -948,7 +948,7 @@ void e2fsck_pass1(e2fsck_t ctx)
|
|||
if (imagic_fs) {
|
||||
if (!ctx->inode_imagic_map)
|
||||
alloc_imagic_map(ctx);
|
||||
ext2fs_mark_inode_bitmap(ctx->inode_imagic_map,
|
||||
ext2fs_mark_inode_bitmap2(ctx->inode_imagic_map,
|
||||
ino);
|
||||
} else {
|
||||
if (fix_problem(ctx, PR_1_SET_IMAGIC, &pctx)) {
|
||||
|
@ -975,11 +975,11 @@ void e2fsck_pass1(e2fsck_t ctx)
|
|||
}
|
||||
|
||||
if (LINUX_S_ISDIR(inode->i_mode)) {
|
||||
ext2fs_mark_inode_bitmap(ctx->inode_dir_map, ino);
|
||||
ext2fs_mark_inode_bitmap2(ctx->inode_dir_map, ino);
|
||||
e2fsck_add_dir_info(ctx, ino, 0);
|
||||
ctx->fs_directory_count++;
|
||||
} else if (LINUX_S_ISREG (inode->i_mode)) {
|
||||
ext2fs_mark_inode_bitmap(ctx->inode_reg_map, ino);
|
||||
ext2fs_mark_inode_bitmap2(ctx->inode_reg_map, ino);
|
||||
ctx->fs_regular_count++;
|
||||
} else if (LINUX_S_ISCHR (inode->i_mode) &&
|
||||
e2fsck_pass1_check_device_inode(fs, inode)) {
|
||||
|
@ -1230,7 +1230,7 @@ static void mark_inode_bad(e2fsck_t ctx, ino_t ino)
|
|||
return;
|
||||
}
|
||||
}
|
||||
ext2fs_mark_inode_bitmap(ctx->inode_bad_map, ino);
|
||||
ext2fs_mark_inode_bitmap2(ctx->inode_bad_map, ino);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1287,7 +1287,7 @@ static _INLINE_ void mark_block_used(e2fsck_t ctx, blk_t block)
|
|||
|
||||
clear_problem_context(&pctx);
|
||||
|
||||
if (ext2fs_fast_test_block_bitmap(ctx->block_found_map, block)) {
|
||||
if (ext2fs_fast_test_block_bitmap2(ctx->block_found_map, block)) {
|
||||
if (!ctx->block_dup_map) {
|
||||
pctx.errcode = ext2fs_allocate_block_bitmap(ctx->fs,
|
||||
_("multiply claimed block map"),
|
||||
|
@ -1301,9 +1301,9 @@ static _INLINE_ void mark_block_used(e2fsck_t ctx, blk_t block)
|
|||
return;
|
||||
}
|
||||
}
|
||||
ext2fs_fast_mark_block_bitmap(ctx->block_dup_map, block);
|
||||
ext2fs_fast_mark_block_bitmap2(ctx->block_dup_map, block);
|
||||
} else {
|
||||
ext2fs_fast_mark_block_bitmap(ctx->block_found_map, block);
|
||||
ext2fs_fast_mark_block_bitmap2(ctx->block_found_map, block);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1416,7 +1416,7 @@ static int check_ext_attr(e2fsck_t ctx, struct problem_context *pctx,
|
|||
#endif
|
||||
|
||||
/* Have we seen this EA block before? */
|
||||
if (ext2fs_fast_test_block_bitmap(ctx->block_ea_map, blk)) {
|
||||
if (ext2fs_fast_test_block_bitmap2(ctx->block_ea_map, blk)) {
|
||||
if (ea_refcount_decrement(ctx->refcount, blk, 0) == 0)
|
||||
return 1;
|
||||
/* Ooops, this EA was referenced more than it stated */
|
||||
|
@ -1525,7 +1525,7 @@ static int check_ext_attr(e2fsck_t ctx, struct problem_context *pctx,
|
|||
if (count)
|
||||
ea_refcount_store(ctx->refcount, blk, count);
|
||||
mark_block_used(ctx, blk);
|
||||
ext2fs_fast_mark_block_bitmap(ctx->block_ea_map, blk);
|
||||
ext2fs_fast_mark_block_bitmap2(ctx->block_ea_map, blk);
|
||||
return 1;
|
||||
|
||||
clear_extattr:
|
||||
|
@ -1603,12 +1603,12 @@ void e2fsck_clear_inode(e2fsck_t ctx, ext2_ino_t ino,
|
|||
ext2fs_icount_store(ctx->inode_link_info, ino, 0);
|
||||
inode->i_dtime = ctx->now;
|
||||
|
||||
ext2fs_unmark_inode_bitmap(ctx->inode_dir_map, ino);
|
||||
ext2fs_unmark_inode_bitmap(ctx->inode_used_map, ino);
|
||||
ext2fs_unmark_inode_bitmap2(ctx->inode_dir_map, ino);
|
||||
ext2fs_unmark_inode_bitmap2(ctx->inode_used_map, ino);
|
||||
if (ctx->inode_reg_map)
|
||||
ext2fs_unmark_inode_bitmap(ctx->inode_reg_map, ino);
|
||||
ext2fs_unmark_inode_bitmap2(ctx->inode_reg_map, ino);
|
||||
if (ctx->inode_bad_map)
|
||||
ext2fs_unmark_inode_bitmap(ctx->inode_bad_map, ino);
|
||||
ext2fs_unmark_inode_bitmap2(ctx->inode_bad_map, ino);
|
||||
|
||||
/*
|
||||
* If the inode was partially accounted for before processing
|
||||
|
@ -2248,13 +2248,13 @@ static int process_bad_block(ext2_filsys fs,
|
|||
}
|
||||
|
||||
if (blockcnt < 0) {
|
||||
if (ext2fs_test_block_bitmap(p->fs_meta_blocks, blk)) {
|
||||
if (ext2fs_test_block_bitmap2(p->fs_meta_blocks, blk)) {
|
||||
p->bbcheck = 1;
|
||||
if (fix_problem(ctx, PR_1_BB_FS_BLOCK, pctx)) {
|
||||
*block_nr = 0;
|
||||
return BLOCK_CHANGED;
|
||||
}
|
||||
} else if (ext2fs_test_block_bitmap(ctx->block_found_map,
|
||||
} else if (ext2fs_test_block_bitmap2(ctx->block_found_map,
|
||||
blk)) {
|
||||
p->bbcheck = 1;
|
||||
if (fix_problem(ctx, PR_1_BBINODE_BAD_METABLOCK,
|
||||
|
@ -2278,8 +2278,8 @@ static int process_bad_block(ext2_filsys fs,
|
|||
* there's an overlap between the filesystem table blocks
|
||||
* (bitmaps and inode table) and the bad block list.
|
||||
*/
|
||||
if (!ext2fs_test_block_bitmap(ctx->block_found_map, blk)) {
|
||||
ext2fs_mark_block_bitmap(ctx->block_found_map, blk);
|
||||
if (!ext2fs_test_block_bitmap2(ctx->block_found_map, blk)) {
|
||||
ext2fs_mark_block_bitmap2(ctx->block_found_map, blk);
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
|
@ -2373,12 +2373,12 @@ static int process_bad_block(ext2_filsys fs,
|
|||
}
|
||||
|
||||
static void new_table_block(e2fsck_t ctx, blk_t first_block, int group,
|
||||
const char *name, int num, blk_t *new_block)
|
||||
const char *name, int num, blk64_t *new_block)
|
||||
{
|
||||
ext2_filsys fs = ctx->fs;
|
||||
dgrp_t last_grp;
|
||||
blk_t old_block = *new_block;
|
||||
blk_t last_block;
|
||||
blk64_t old_block = *new_block;
|
||||
blk64_t last_block;
|
||||
int i, is_flexbg, flexbg, flexbg_size;
|
||||
char *buf;
|
||||
struct problem_context pctx;
|
||||
|
@ -2407,11 +2407,11 @@ static void new_table_block(e2fsck_t ctx, blk_t first_block, int group,
|
|||
last_block = ext2fs_group_last_block(fs, last_grp);
|
||||
} else
|
||||
last_block = ext2fs_group_last_block(fs, group);
|
||||
pctx.errcode = ext2fs_get_free_blocks(fs, first_block, last_block,
|
||||
num, ctx->block_found_map,
|
||||
new_block);
|
||||
pctx.errcode = ext2fs_get_free_blocks2(fs, first_block, last_block,
|
||||
num, ctx->block_found_map,
|
||||
new_block);
|
||||
if (is_flexbg && (pctx.errcode == EXT2_ET_BLOCK_ALLOC_FAIL))
|
||||
pctx.errcode = ext2fs_get_free_blocks(fs,
|
||||
pctx.errcode = ext2fs_get_free_blocks2(fs,
|
||||
fs->super->s_first_data_block,
|
||||
fs->super->s_blocks_count,
|
||||
num, ctx->block_found_map, new_block);
|
||||
|
@ -2437,7 +2437,7 @@ static void new_table_block(e2fsck_t ctx, blk_t first_block, int group,
|
|||
pctx.blk2 = 0;
|
||||
for (i = 0; i < num; i++) {
|
||||
pctx.blk = i;
|
||||
ext2fs_mark_block_bitmap(ctx->block_found_map, (*new_block)+i);
|
||||
ext2fs_mark_block_bitmap2(ctx->block_found_map, (*new_block)+i);
|
||||
if (old_block) {
|
||||
pctx.errcode = io_channel_read_blk(fs->io,
|
||||
old_block + i, 1, buf);
|
||||
|
@ -2466,23 +2466,30 @@ static void handle_fs_bad_blocks(e2fsck_t ctx)
|
|||
{
|
||||
ext2_filsys fs = ctx->fs;
|
||||
dgrp_t i;
|
||||
blk_t first_block;
|
||||
blk64_t first_block;
|
||||
blk64_t new_blk;
|
||||
|
||||
for (i = 0; i < fs->group_desc_count; i++) {
|
||||
first_block = ext2fs_group_first_block(fs, i);
|
||||
|
||||
if (ctx->invalid_block_bitmap_flag[i]) {
|
||||
new_blk = ext2fs_block_bitmap_loc(fs, i);
|
||||
new_table_block(ctx, first_block, i, _("block bitmap"),
|
||||
1, &fs->group_desc[i].bg_block_bitmap);
|
||||
1, &new_blk);
|
||||
ext2fs_block_bitmap_loc_set(fs, i, new_blk);
|
||||
}
|
||||
if (ctx->invalid_inode_bitmap_flag[i]) {
|
||||
new_blk = ext2fs_inode_bitmap_loc(fs, i);
|
||||
new_table_block(ctx, first_block, i, _("inode bitmap"),
|
||||
1, &fs->group_desc[i].bg_inode_bitmap);
|
||||
1, &new_blk);
|
||||
ext2fs_inode_bitmap_loc_set(fs, i, new_blk);
|
||||
}
|
||||
if (ctx->invalid_inode_table_flag[i]) {
|
||||
new_blk = ext2fs_inode_table_loc(fs, i);
|
||||
new_table_block(ctx, first_block, i, _("inode table"),
|
||||
fs->inode_blocks_per_group,
|
||||
&fs->group_desc[i].bg_inode_table);
|
||||
&new_blk);
|
||||
ext2fs_inode_table_loc_set(fs, i, new_blk);
|
||||
ctx->flags |= E2F_FLAG_RESTART;
|
||||
}
|
||||
}
|
||||
|
@ -2515,7 +2522,7 @@ static void mark_table_blocks(e2fsck_t ctx)
|
|||
for (j = 0, b = fs->group_desc[i].bg_inode_table;
|
||||
j < fs->inode_blocks_per_group;
|
||||
j++, b++) {
|
||||
if (ext2fs_test_block_bitmap(ctx->block_found_map,
|
||||
if (ext2fs_test_block_bitmap2(ctx->block_found_map,
|
||||
b)) {
|
||||
pctx.blk = b;
|
||||
if (!ctx->invalid_inode_table_flag[i] &&
|
||||
|
@ -2525,7 +2532,7 @@ static void mark_table_blocks(e2fsck_t ctx)
|
|||
ctx->invalid_bitmaps++;
|
||||
}
|
||||
} else {
|
||||
ext2fs_mark_block_bitmap(ctx->block_found_map,
|
||||
ext2fs_mark_block_bitmap2(ctx->block_found_map,
|
||||
b);
|
||||
}
|
||||
}
|
||||
|
@ -2535,7 +2542,7 @@ static void mark_table_blocks(e2fsck_t ctx)
|
|||
* Mark block used for the block bitmap
|
||||
*/
|
||||
if (fs->group_desc[i].bg_block_bitmap) {
|
||||
if (ext2fs_test_block_bitmap(ctx->block_found_map,
|
||||
if (ext2fs_test_block_bitmap2(ctx->block_found_map,
|
||||
fs->group_desc[i].bg_block_bitmap)) {
|
||||
pctx.blk = fs->group_desc[i].bg_block_bitmap;
|
||||
if (fix_problem(ctx, PR_1_BB_CONFLICT, &pctx)) {
|
||||
|
@ -2543,7 +2550,7 @@ static void mark_table_blocks(e2fsck_t ctx)
|
|||
ctx->invalid_bitmaps++;
|
||||
}
|
||||
} else {
|
||||
ext2fs_mark_block_bitmap(ctx->block_found_map,
|
||||
ext2fs_mark_block_bitmap2(ctx->block_found_map,
|
||||
fs->group_desc[i].bg_block_bitmap);
|
||||
}
|
||||
|
||||
|
@ -2552,7 +2559,7 @@ static void mark_table_blocks(e2fsck_t ctx)
|
|||
* Mark block used for the inode bitmap
|
||||
*/
|
||||
if (fs->group_desc[i].bg_inode_bitmap) {
|
||||
if (ext2fs_test_block_bitmap(ctx->block_found_map,
|
||||
if (ext2fs_test_block_bitmap2(ctx->block_found_map,
|
||||
fs->group_desc[i].bg_inode_bitmap)) {
|
||||
pctx.blk = fs->group_desc[i].bg_inode_bitmap;
|
||||
if (fix_problem(ctx, PR_1_IB_CONFLICT, &pctx)) {
|
||||
|
@ -2560,7 +2567,7 @@ static void mark_table_blocks(e2fsck_t ctx)
|
|||
ctx->invalid_bitmaps++;
|
||||
}
|
||||
} else {
|
||||
ext2fs_mark_block_bitmap(ctx->block_found_map,
|
||||
ext2fs_mark_block_bitmap2(ctx->block_found_map,
|
||||
fs->group_desc[i].bg_inode_bitmap);
|
||||
}
|
||||
}
|
||||
|
@ -2626,10 +2633,10 @@ static errcode_t e2fsck_get_alloc_block(ext2_filsys fs, blk64_t goal,
|
|||
{
|
||||
e2fsck_t ctx = (e2fsck_t) fs->priv_data;
|
||||
errcode_t retval;
|
||||
blk_t new_block;
|
||||
blk64_t new_block;
|
||||
|
||||
if (ctx->block_found_map) {
|
||||
retval = ext2fs_new_block(fs, (blk_t) goal,
|
||||
retval = ext2fs_new_block2(fs, (blk_t) goal,
|
||||
ctx->block_found_map, &new_block);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
@ -2640,7 +2647,7 @@ static errcode_t e2fsck_get_alloc_block(ext2_filsys fs, blk64_t goal,
|
|||
return retval;
|
||||
}
|
||||
|
||||
retval = ext2fs_new_block(fs, (blk_t) goal, 0, &new_block);
|
||||
retval = ext2fs_new_block2(fs, (blk_t) goal, 0, &new_block);
|
||||
if (retval)
|
||||
return retval;
|
||||
}
|
||||
|
@ -2655,10 +2662,10 @@ static void e2fsck_block_alloc_stats(ext2_filsys fs, blk64_t blk, int inuse)
|
|||
|
||||
if (ctx->block_found_map) {
|
||||
if (inuse > 0)
|
||||
ext2fs_mark_block_bitmap(ctx->block_found_map,
|
||||
ext2fs_mark_block_bitmap2(ctx->block_found_map,
|
||||
(blk_t) blk);
|
||||
else
|
||||
ext2fs_unmark_block_bitmap(ctx->block_found_map,
|
||||
ext2fs_unmark_block_bitmap2(ctx->block_found_map,
|
||||
(blk_t) blk);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -298,7 +298,7 @@ static void pass1b(e2fsck_t ctx, char *block_buf)
|
|||
break;
|
||||
pctx.ino = ctx->stashed_ino = ino;
|
||||
if ((ino != EXT2_BAD_INO) &&
|
||||
!ext2fs_test_inode_bitmap(ctx->inode_used_map, ino))
|
||||
!ext2fs_test_inode_bitmap2(ctx->inode_used_map, ino))
|
||||
continue;
|
||||
|
||||
pb.ino = ino;
|
||||
|
@ -341,7 +341,7 @@ static int process_pass1b_block(ext2_filsys fs EXT2FS_ATTR((unused)),
|
|||
p = (struct process_block_struct *) priv_data;
|
||||
ctx = p->ctx;
|
||||
|
||||
if (!ext2fs_test_block_bitmap(ctx->block_dup_map, *block_nr))
|
||||
if (!ext2fs_test_block_bitmap2(ctx->block_dup_map, *block_nr))
|
||||
return 0;
|
||||
|
||||
/* OK, this is a duplicate block */
|
||||
|
@ -350,7 +350,7 @@ static int process_pass1b_block(ext2_filsys fs EXT2FS_ATTR((unused)),
|
|||
fix_problem(ctx, PR_1B_DUP_BLOCK, p->pctx);
|
||||
}
|
||||
p->dup_blocks++;
|
||||
ext2fs_mark_inode_bitmap(inode_dup_map, p->ino);
|
||||
ext2fs_mark_inode_bitmap2(inode_dup_map, p->ino);
|
||||
|
||||
add_dupe(ctx, p->ino, *block_nr, p->inode);
|
||||
|
||||
|
@ -386,7 +386,7 @@ static int search_dirent_proc(ext2_ino_t dir, int entry,
|
|||
return 0;
|
||||
|
||||
if ((dirent->inode < sd->first_inode) || (entry < DIRENT_OTHER_FILE) ||
|
||||
!ext2fs_test_inode_bitmap(inode_dup_map, dirent->inode))
|
||||
!ext2fs_test_inode_bitmap2(inode_dup_map, dirent->inode))
|
||||
return 0;
|
||||
|
||||
n = dict_lookup(&ino_dict, INT_TO_VOIDPTR(dirent->inode));
|
||||
|
@ -550,7 +550,7 @@ static void decrement_badcount(e2fsck_t ctx, blk_t block, struct dup_block *p)
|
|||
p->num_bad--;
|
||||
if (p->num_bad <= 0 ||
|
||||
(p->num_bad == 1 && !check_if_fs_block(ctx, block)))
|
||||
ext2fs_unmark_block_bitmap(ctx->block_dup_map, block);
|
||||
ext2fs_unmark_block_bitmap2(ctx->block_dup_map, block);
|
||||
}
|
||||
|
||||
static int delete_file_block(ext2_filsys fs,
|
||||
|
@ -571,7 +571,7 @@ static int delete_file_block(ext2_filsys fs,
|
|||
if (HOLE_BLKADDR(*block_nr))
|
||||
return 0;
|
||||
|
||||
if (ext2fs_test_block_bitmap(ctx->block_dup_map, *block_nr)) {
|
||||
if (ext2fs_test_block_bitmap2(ctx->block_dup_map, *block_nr)) {
|
||||
n = dict_lookup(&blk_dict, INT_TO_VOIDPTR(*block_nr));
|
||||
if (n) {
|
||||
p = (struct dup_block *) dnode_get(n);
|
||||
|
@ -581,7 +581,7 @@ static int delete_file_block(ext2_filsys fs,
|
|||
_("internal error: can't find dup_blk for %u\n"),
|
||||
*block_nr);
|
||||
} else {
|
||||
ext2fs_unmark_block_bitmap(ctx->block_found_map, *block_nr);
|
||||
ext2fs_unmark_block_bitmap2(ctx->block_found_map, *block_nr);
|
||||
ext2fs_block_alloc_stats(fs, *block_nr, -1);
|
||||
}
|
||||
|
||||
|
@ -610,7 +610,7 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
|
|||
if (pctx.errcode)
|
||||
fix_problem(ctx, PR_1B_BLOCK_ITERATE, &pctx);
|
||||
if (ctx->inode_bad_map)
|
||||
ext2fs_unmark_inode_bitmap(ctx->inode_bad_map, ino);
|
||||
ext2fs_unmark_inode_bitmap2(ctx->inode_bad_map, ino);
|
||||
ext2fs_inode_alloc_stats2(fs, ino, -1, LINUX_S_ISDIR(inode.i_mode));
|
||||
|
||||
/* Inode may have changed by block_iterate, so reread it */
|
||||
|
@ -636,7 +636,7 @@ static void delete_file(e2fsck_t ctx, ext2_ino_t ino,
|
|||
* of keeping the accounting straight.
|
||||
*/
|
||||
if ((count == 0) ||
|
||||
ext2fs_test_block_bitmap(ctx->block_dup_map,
|
||||
ext2fs_test_block_bitmap2(ctx->block_dup_map,
|
||||
inode.i_file_acl))
|
||||
delete_file_block(fs, &inode.i_file_acl,
|
||||
BLOCK_COUNT_EXTATTR, 0, 0, &pb);
|
||||
|
@ -658,7 +658,7 @@ static int clone_file_block(ext2_filsys fs,
|
|||
void *priv_data)
|
||||
{
|
||||
struct dup_block *p;
|
||||
blk_t new_block;
|
||||
blk64_t new_block;
|
||||
errcode_t retval;
|
||||
struct clone_struct *cs = (struct clone_struct *) priv_data;
|
||||
dnode_t *n;
|
||||
|
@ -669,11 +669,11 @@ static int clone_file_block(ext2_filsys fs,
|
|||
if (HOLE_BLKADDR(*block_nr))
|
||||
return 0;
|
||||
|
||||
if (ext2fs_test_block_bitmap(ctx->block_dup_map, *block_nr)) {
|
||||
if (ext2fs_test_block_bitmap2(ctx->block_dup_map, *block_nr)) {
|
||||
n = dict_lookup(&blk_dict, INT_TO_VOIDPTR(*block_nr));
|
||||
if (n) {
|
||||
p = (struct dup_block *) dnode_get(n);
|
||||
retval = ext2fs_new_block(fs, 0, ctx->block_found_map,
|
||||
retval = ext2fs_new_block2(fs, 0, ctx->block_found_map,
|
||||
&new_block);
|
||||
if (retval) {
|
||||
cs->errcode = retval;
|
||||
|
@ -705,9 +705,9 @@ static int clone_file_block(ext2_filsys fs,
|
|||
}
|
||||
decrement_badcount(ctx, *block_nr, p);
|
||||
*block_nr = new_block;
|
||||
ext2fs_mark_block_bitmap(ctx->block_found_map,
|
||||
ext2fs_mark_block_bitmap2(ctx->block_found_map,
|
||||
new_block);
|
||||
ext2fs_mark_block_bitmap(fs->block_map, new_block);
|
||||
ext2fs_mark_block_bitmap2(fs->block_map, new_block);
|
||||
return BLOCK_CHANGED;
|
||||
} else
|
||||
com_err("clone_file_block", 0,
|
||||
|
@ -738,7 +738,7 @@ static int clone_file(e2fsck_t ctx, ext2_ino_t ino,
|
|||
if (retval)
|
||||
return retval;
|
||||
|
||||
if (ext2fs_test_inode_bitmap(ctx->inode_dir_map, ino))
|
||||
if (ext2fs_test_inode_bitmap2(ctx->inode_dir_map, ino))
|
||||
cs.dir = ino;
|
||||
|
||||
pctx.ino = ino;
|
||||
|
|
|
@ -495,13 +495,13 @@ static _INLINE_ int check_filetype(e2fsck_t ctx,
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (ext2fs_test_inode_bitmap(ctx->inode_dir_map, dirent->inode)) {
|
||||
if (ext2fs_test_inode_bitmap2(ctx->inode_dir_map, dirent->inode)) {
|
||||
should_be = EXT2_FT_DIR;
|
||||
} else if (ext2fs_test_inode_bitmap(ctx->inode_reg_map,
|
||||
} else if (ext2fs_test_inode_bitmap2(ctx->inode_reg_map,
|
||||
dirent->inode)) {
|
||||
should_be = EXT2_FT_REG_FILE;
|
||||
} else if (ctx->inode_bad_map &&
|
||||
ext2fs_test_inode_bitmap(ctx->inode_bad_map,
|
||||
ext2fs_test_inode_bitmap2(ctx->inode_bad_map,
|
||||
dirent->inode))
|
||||
should_be = 0;
|
||||
else {
|
||||
|
@ -749,7 +749,7 @@ static int check_dir_block(ext2_filsys fs,
|
|||
* Make sure the inode is still in use (could have been
|
||||
* deleted in the duplicate/bad blocks pass.
|
||||
*/
|
||||
if (!(ext2fs_test_inode_bitmap(ctx->inode_used_map, ino)))
|
||||
if (!(ext2fs_test_inode_bitmap2(ctx->inode_used_map, ino)))
|
||||
return 0;
|
||||
|
||||
cd->pctx.ino = ino;
|
||||
|
@ -898,7 +898,7 @@ out_htree:
|
|||
(dirent->inode > fs->super->s_inodes_count)) {
|
||||
problem = PR_2_BAD_INO;
|
||||
} else if (ctx->inode_bb_map &&
|
||||
(ext2fs_test_inode_bitmap(ctx->inode_bb_map,
|
||||
(ext2fs_test_inode_bitmap2(ctx->inode_bb_map,
|
||||
dirent->inode))) {
|
||||
/*
|
||||
* If the inode is in a bad block, offer to
|
||||
|
@ -960,7 +960,7 @@ out_htree:
|
|||
* pathname to the user.)
|
||||
*/
|
||||
if (ctx->inode_bad_map &&
|
||||
ext2fs_test_inode_bitmap(ctx->inode_bad_map,
|
||||
ext2fs_test_inode_bitmap2(ctx->inode_bad_map,
|
||||
dirent->inode)) {
|
||||
if (e2fsck_process_bad_inode(ctx, ino,
|
||||
dirent->inode,
|
||||
|
@ -1013,7 +1013,7 @@ out_htree:
|
|||
}
|
||||
}
|
||||
|
||||
if (!(ext2fs_test_inode_bitmap(ctx->inode_used_map,
|
||||
if (!(ext2fs_test_inode_bitmap2(ctx->inode_used_map,
|
||||
dirent->inode))) {
|
||||
/*
|
||||
* If the inode is unused, offer to clear it.
|
||||
|
@ -1059,7 +1059,7 @@ out_htree:
|
|||
* and ask the user if he/she wants to clear this one.
|
||||
*/
|
||||
if ((dot_state > 1) &&
|
||||
(ext2fs_test_inode_bitmap(ctx->inode_dir_map,
|
||||
(ext2fs_test_inode_bitmap2(ctx->inode_dir_map,
|
||||
dirent->inode))) {
|
||||
if (e2fsck_dir_info_get_parent(ctx, dirent->inode,
|
||||
&subdir_parent)) {
|
||||
|
@ -1167,7 +1167,7 @@ static int deallocate_inode_block(ext2_filsys fs,
|
|||
if ((*block_nr < fs->super->s_first_data_block) ||
|
||||
(*block_nr >= fs->super->s_blocks_count))
|
||||
return 0;
|
||||
ext2fs_unmark_block_bitmap(ctx->block_found_map, *block_nr);
|
||||
ext2fs_unmark_block_bitmap2(ctx->block_found_map, *block_nr);
|
||||
ext2fs_block_alloc_stats(fs, *block_nr, -1);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1208,7 +1208,7 @@ static void deallocate_inode(e2fsck_t ctx, ext2_ino_t ino, char* block_buf)
|
|||
return;
|
||||
}
|
||||
if (count == 0) {
|
||||
ext2fs_unmark_block_bitmap(ctx->block_found_map,
|
||||
ext2fs_unmark_block_bitmap2(ctx->block_found_map,
|
||||
inode.i_file_acl);
|
||||
ext2fs_block_alloc_stats(fs, inode.i_file_acl, -1);
|
||||
}
|
||||
|
@ -1384,7 +1384,7 @@ extern int e2fsck_process_bad_inode(e2fsck_t ctx, ext2_ino_t dir,
|
|||
if (inode_modified)
|
||||
e2fsck_write_inode(ctx, ino, &inode, "process_bad_inode");
|
||||
if (!not_fixed && ctx->inode_bad_map)
|
||||
ext2fs_unmark_inode_bitmap(ctx->inode_bad_map, ino);
|
||||
ext2fs_unmark_inode_bitmap2(ctx->inode_bad_map, ino);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1401,7 +1401,7 @@ static int allocate_dir_block(e2fsck_t ctx,
|
|||
struct problem_context *pctx)
|
||||
{
|
||||
ext2_filsys fs = ctx->fs;
|
||||
blk_t blk;
|
||||
blk64_t blk;
|
||||
char *block;
|
||||
struct ext2_inode inode;
|
||||
|
||||
|
@ -1417,14 +1417,14 @@ static int allocate_dir_block(e2fsck_t ctx,
|
|||
/*
|
||||
* First, find a free block
|
||||
*/
|
||||
pctx->errcode = ext2fs_new_block(fs, 0, ctx->block_found_map, &blk);
|
||||
pctx->errcode = ext2fs_new_block2(fs, 0, ctx->block_found_map, &blk);
|
||||
if (pctx->errcode) {
|
||||
pctx->str = "ext2fs_new_block";
|
||||
fix_problem(ctx, PR_2_ALLOC_DIRBOCK, pctx);
|
||||
return 1;
|
||||
}
|
||||
ext2fs_mark_block_bitmap(ctx->block_found_map, blk);
|
||||
ext2fs_mark_block_bitmap(fs->block_map, blk);
|
||||
ext2fs_mark_block_bitmap2(ctx->block_found_map, blk);
|
||||
ext2fs_mark_block_bitmap2(fs->block_map, blk);
|
||||
ext2fs_mark_bb_dirty(fs);
|
||||
|
||||
/*
|
||||
|
|
|
@ -87,7 +87,7 @@ void e2fsck_pass3(e2fsck_t ctx)
|
|||
if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
|
||||
goto abort_exit;
|
||||
|
||||
ext2fs_mark_inode_bitmap(inode_done_map, EXT2_ROOT_INO);
|
||||
ext2fs_mark_inode_bitmap2(inode_done_map, EXT2_ROOT_INO);
|
||||
|
||||
maxdirs = e2fsck_get_num_dirinfo(ctx);
|
||||
count = 1;
|
||||
|
@ -102,7 +102,7 @@ void e2fsck_pass3(e2fsck_t ctx)
|
|||
goto abort_exit;
|
||||
if (ctx->progress && (ctx->progress)(ctx, 3, count++, maxdirs))
|
||||
goto abort_exit;
|
||||
if (ext2fs_test_inode_bitmap(ctx->inode_dir_map, dir->ino))
|
||||
if (ext2fs_test_inode_bitmap2(ctx->inode_dir_map, dir->ino))
|
||||
if (check_directory(ctx, dir->ino, &pctx))
|
||||
goto abort_exit;
|
||||
}
|
||||
|
@ -141,20 +141,20 @@ abort_exit:
|
|||
static void check_root(e2fsck_t ctx)
|
||||
{
|
||||
ext2_filsys fs = ctx->fs;
|
||||
blk_t blk;
|
||||
blk64_t blk;
|
||||
struct ext2_inode inode;
|
||||
char * block;
|
||||
struct problem_context pctx;
|
||||
|
||||
clear_problem_context(&pctx);
|
||||
|
||||
if (ext2fs_test_inode_bitmap(ctx->inode_used_map, EXT2_ROOT_INO)) {
|
||||
if (ext2fs_test_inode_bitmap2(ctx->inode_used_map, EXT2_ROOT_INO)) {
|
||||
/*
|
||||
* If the root inode is not a directory, die here. The
|
||||
* user must have answered 'no' in pass1 when we
|
||||
* offered to clear it.
|
||||
*/
|
||||
if (!(ext2fs_test_inode_bitmap(ctx->inode_dir_map,
|
||||
if (!(ext2fs_test_inode_bitmap2(ctx->inode_dir_map,
|
||||
EXT2_ROOT_INO))) {
|
||||
fix_problem(ctx, PR_3_ROOT_NOT_DIR_ABORT, &pctx);
|
||||
ctx->flags |= E2F_FLAG_ABORT;
|
||||
|
@ -173,15 +173,15 @@ static void check_root(e2fsck_t ctx)
|
|||
/*
|
||||
* First, find a free block
|
||||
*/
|
||||
pctx.errcode = ext2fs_new_block(fs, 0, ctx->block_found_map, &blk);
|
||||
pctx.errcode = ext2fs_new_block2(fs, 0, ctx->block_found_map, &blk);
|
||||
if (pctx.errcode) {
|
||||
pctx.str = "ext2fs_new_block";
|
||||
fix_problem(ctx, PR_3_CREATE_ROOT_ERROR, &pctx);
|
||||
ctx->flags |= E2F_FLAG_ABORT;
|
||||
return;
|
||||
}
|
||||
ext2fs_mark_block_bitmap(ctx->block_found_map, blk);
|
||||
ext2fs_mark_block_bitmap(fs->block_map, blk);
|
||||
ext2fs_mark_block_bitmap2(ctx->block_found_map, blk);
|
||||
ext2fs_mark_block_bitmap2(fs->block_map, blk);
|
||||
ext2fs_mark_bb_dirty(fs);
|
||||
|
||||
/*
|
||||
|
@ -234,9 +234,9 @@ static void check_root(e2fsck_t ctx)
|
|||
ext2fs_icount_store(ctx->inode_count, EXT2_ROOT_INO, 2);
|
||||
ext2fs_icount_store(ctx->inode_link_info, EXT2_ROOT_INO, 2);
|
||||
|
||||
ext2fs_mark_inode_bitmap(ctx->inode_used_map, EXT2_ROOT_INO);
|
||||
ext2fs_mark_inode_bitmap(ctx->inode_dir_map, EXT2_ROOT_INO);
|
||||
ext2fs_mark_inode_bitmap(fs->inode_map, EXT2_ROOT_INO);
|
||||
ext2fs_mark_inode_bitmap2(ctx->inode_used_map, EXT2_ROOT_INO);
|
||||
ext2fs_mark_inode_bitmap2(ctx->inode_dir_map, EXT2_ROOT_INO);
|
||||
ext2fs_mark_inode_bitmap2(fs->inode_map, EXT2_ROOT_INO);
|
||||
ext2fs_mark_ib_dirty(fs);
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ static int check_directory(e2fsck_t ctx, ext2_ino_t dir,
|
|||
* If it was marked done already, then we've reached a
|
||||
* parent we've already checked.
|
||||
*/
|
||||
if (ext2fs_mark_inode_bitmap(inode_done_map, ino))
|
||||
if (ext2fs_mark_inode_bitmap2(inode_done_map, ino))
|
||||
break;
|
||||
|
||||
if (e2fsck_dir_info_get_parent(ctx, ino, &parent)) {
|
||||
|
@ -289,7 +289,7 @@ static int check_directory(e2fsck_t ctx, ext2_ino_t dir,
|
|||
*/
|
||||
if (!parent ||
|
||||
(loop_pass &&
|
||||
(ext2fs_test_inode_bitmap(inode_loop_detect,
|
||||
(ext2fs_test_inode_bitmap2(inode_loop_detect,
|
||||
parent)))) {
|
||||
pctx->ino = ino;
|
||||
if (fix_problem(ctx, PR_3_UNCONNECTED_DIR, pctx)) {
|
||||
|
@ -305,7 +305,7 @@ static int check_directory(e2fsck_t ctx, ext2_ino_t dir,
|
|||
}
|
||||
ino = parent;
|
||||
if (loop_pass) {
|
||||
ext2fs_mark_inode_bitmap(inode_loop_detect, ino);
|
||||
ext2fs_mark_inode_bitmap2(inode_loop_detect, ino);
|
||||
} else if (parent_count++ > 2048) {
|
||||
/*
|
||||
* If we've run into a path depth that's
|
||||
|
@ -355,7 +355,7 @@ ext2_ino_t e2fsck_get_lost_and_found(e2fsck_t ctx, int fix)
|
|||
{
|
||||
ext2_filsys fs = ctx->fs;
|
||||
ext2_ino_t ino;
|
||||
blk_t blk;
|
||||
blk64_t blk;
|
||||
errcode_t retval;
|
||||
struct ext2_inode inode;
|
||||
char * block;
|
||||
|
@ -372,7 +372,7 @@ ext2_ino_t e2fsck_get_lost_and_found(e2fsck_t ctx, int fix)
|
|||
if (retval && !fix)
|
||||
return 0;
|
||||
if (!retval) {
|
||||
if (ext2fs_test_inode_bitmap(ctx->inode_dir_map, ino)) {
|
||||
if (ext2fs_test_inode_bitmap2(ctx->inode_dir_map, ino)) {
|
||||
ctx->lost_and_found = ino;
|
||||
return ino;
|
||||
}
|
||||
|
@ -409,13 +409,13 @@ ext2_ino_t e2fsck_get_lost_and_found(e2fsck_t ctx, int fix)
|
|||
/*
|
||||
* First, find a free block
|
||||
*/
|
||||
retval = ext2fs_new_block(fs, 0, ctx->block_found_map, &blk);
|
||||
retval = ext2fs_new_block2(fs, 0, ctx->block_found_map, &blk);
|
||||
if (retval) {
|
||||
pctx.errcode = retval;
|
||||
fix_problem(ctx, PR_3_ERR_LPF_NEW_BLOCK, &pctx);
|
||||
return 0;
|
||||
}
|
||||
ext2fs_mark_block_bitmap(ctx->block_found_map, blk);
|
||||
ext2fs_mark_block_bitmap2(ctx->block_found_map, blk);
|
||||
ext2fs_block_alloc_stats(fs, blk, +1);
|
||||
|
||||
/*
|
||||
|
@ -428,8 +428,8 @@ ext2_ino_t e2fsck_get_lost_and_found(e2fsck_t ctx, int fix)
|
|||
fix_problem(ctx, PR_3_ERR_LPF_NEW_INODE, &pctx);
|
||||
return 0;
|
||||
}
|
||||
ext2fs_mark_inode_bitmap(ctx->inode_used_map, ino);
|
||||
ext2fs_mark_inode_bitmap(ctx->inode_dir_map, ino);
|
||||
ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino);
|
||||
ext2fs_mark_inode_bitmap2(ctx->inode_dir_map, ino);
|
||||
ext2fs_inode_alloc_stats2(fs, ino, +1, 1);
|
||||
|
||||
/*
|
||||
|
@ -691,7 +691,7 @@ static int expand_dir_proc(ext2_filsys fs,
|
|||
void *priv_data)
|
||||
{
|
||||
struct expand_dir_struct *es = (struct expand_dir_struct *) priv_data;
|
||||
blk_t new_blk;
|
||||
blk64_t new_blk;
|
||||
static blk_t last_blk = 0;
|
||||
char *block;
|
||||
errcode_t retval;
|
||||
|
@ -708,7 +708,7 @@ static int expand_dir_proc(ext2_filsys fs,
|
|||
last_blk = *blocknr;
|
||||
return 0;
|
||||
}
|
||||
retval = ext2fs_new_block(fs, last_blk, ctx->block_found_map,
|
||||
retval = ext2fs_new_block2(fs, last_blk, ctx->block_found_map,
|
||||
&new_blk);
|
||||
if (retval) {
|
||||
es->err = retval;
|
||||
|
@ -737,7 +737,7 @@ static int expand_dir_proc(ext2_filsys fs,
|
|||
}
|
||||
ext2fs_free_mem(&block);
|
||||
*blocknr = new_blk;
|
||||
ext2fs_mark_block_bitmap(ctx->block_found_map, new_blk);
|
||||
ext2fs_mark_block_bitmap2(ctx->block_found_map, new_blk);
|
||||
ext2fs_block_alloc_stats(fs, new_blk, +1);
|
||||
es->newblocks++;
|
||||
|
||||
|
|
|
@ -132,11 +132,11 @@ void e2fsck_pass4(e2fsck_t ctx)
|
|||
if (i == EXT2_BAD_INO ||
|
||||
(i > EXT2_ROOT_INO && i < EXT2_FIRST_INODE(fs->super)))
|
||||
continue;
|
||||
if (!(ext2fs_test_inode_bitmap(ctx->inode_used_map, i)) ||
|
||||
if (!(ext2fs_test_inode_bitmap2(ctx->inode_used_map, i)) ||
|
||||
(ctx->inode_imagic_map &&
|
||||
ext2fs_test_inode_bitmap(ctx->inode_imagic_map, i)) ||
|
||||
ext2fs_test_inode_bitmap2(ctx->inode_imagic_map, i)) ||
|
||||
(ctx->inode_bb_map &&
|
||||
ext2fs_test_inode_bitmap(ctx->inode_bb_map, i)))
|
||||
ext2fs_test_inode_bitmap2(ctx->inode_bb_map, i)))
|
||||
continue;
|
||||
ext2fs_icount_fetch(ctx->inode_link_info, i, &link_count);
|
||||
ext2fs_icount_fetch(ctx->inode_count, i, &link_counted);
|
||||
|
@ -153,7 +153,7 @@ void e2fsck_pass4(e2fsck_t ctx)
|
|||
ext2fs_icount_fetch(ctx->inode_count, i,
|
||||
&link_counted);
|
||||
}
|
||||
if (ext2fs_test_inode_bitmap(ctx->inode_dir_map, i) &&
|
||||
if (ext2fs_test_inode_bitmap2(ctx->inode_dir_map, i) &&
|
||||
(link_counted > EXT2_LINK_MAX))
|
||||
link_counted = 1;
|
||||
if (link_counted != link_count) {
|
||||
|
|
|
@ -126,14 +126,14 @@ static void check_block_bitmaps(e2fsck_t ctx)
|
|||
fs->group_desc_count * sizeof(int), "free block count array");
|
||||
|
||||
if ((fs->super->s_first_data_block <
|
||||
ext2fs_get_block_bitmap_start(ctx->block_found_map)) ||
|
||||
ext2fs_get_block_bitmap_start2(ctx->block_found_map)) ||
|
||||
(fs->super->s_blocks_count-1 >
|
||||
ext2fs_get_block_bitmap_end(ctx->block_found_map))) {
|
||||
ext2fs_get_block_bitmap_end2(ctx->block_found_map))) {
|
||||
pctx.num = 1;
|
||||
pctx.blk = fs->super->s_first_data_block;
|
||||
pctx.blk2 = fs->super->s_blocks_count -1;
|
||||
pctx.ino = ext2fs_get_block_bitmap_start(ctx->block_found_map);
|
||||
pctx.ino2 = ext2fs_get_block_bitmap_end(ctx->block_found_map);
|
||||
pctx.ino = ext2fs_get_block_bitmap_start2(ctx->block_found_map);
|
||||
pctx.ino2 = ext2fs_get_block_bitmap_end2(ctx->block_found_map);
|
||||
fix_problem(ctx, PR_5_BMAP_ENDPOINTS, &pctx);
|
||||
|
||||
ctx->flags |= E2F_FLAG_ABORT; /* fatal */
|
||||
|
@ -141,14 +141,14 @@ static void check_block_bitmaps(e2fsck_t ctx)
|
|||
}
|
||||
|
||||
if ((fs->super->s_first_data_block <
|
||||
ext2fs_get_block_bitmap_start(fs->block_map)) ||
|
||||
ext2fs_get_block_bitmap_start2(fs->block_map)) ||
|
||||
(fs->super->s_blocks_count-1 >
|
||||
ext2fs_get_block_bitmap_end(fs->block_map))) {
|
||||
ext2fs_get_block_bitmap_end2(fs->block_map))) {
|
||||
pctx.num = 2;
|
||||
pctx.blk = fs->super->s_first_data_block;
|
||||
pctx.blk2 = fs->super->s_blocks_count -1;
|
||||
pctx.ino = ext2fs_get_block_bitmap_start(fs->block_map);
|
||||
pctx.ino2 = ext2fs_get_block_bitmap_end(fs->block_map);
|
||||
pctx.ino = ext2fs_get_block_bitmap_start2(fs->block_map);
|
||||
pctx.ino2 = ext2fs_get_block_bitmap_end2(fs->block_map);
|
||||
fix_problem(ctx, PR_5_BMAP_ENDPOINTS, &pctx);
|
||||
|
||||
ctx->flags |= E2F_FLAG_ABORT; /* fatal */
|
||||
|
@ -167,7 +167,7 @@ redo_counts:
|
|||
for (i = fs->super->s_first_data_block;
|
||||
i < fs->super->s_blocks_count;
|
||||
i++) {
|
||||
actual = ext2fs_fast_test_block_bitmap(ctx->block_found_map, i);
|
||||
actual = ext2fs_fast_test_block_bitmap2(ctx->block_found_map, i);
|
||||
|
||||
if (skip_group) {
|
||||
if ((i - fs->super->s_first_data_block) %
|
||||
|
@ -216,7 +216,7 @@ redo_counts:
|
|||
* are 0, count the free block,
|
||||
* skip the current block group.
|
||||
*/
|
||||
if (ext2fs_test_block_bitmap_range(
|
||||
if (ext2fs_test_block_bitmap_range2(
|
||||
ctx->block_found_map, i,
|
||||
cmp_block)) {
|
||||
/*
|
||||
|
@ -239,7 +239,7 @@ redo_counts:
|
|||
} else if (redo_flag)
|
||||
bitmap = actual;
|
||||
else
|
||||
bitmap = ext2fs_fast_test_block_bitmap(fs->block_map, i);
|
||||
bitmap = ext2fs_fast_test_block_bitmap2(fs->block_map, i);
|
||||
|
||||
if (actual == bitmap)
|
||||
goto do_counts;
|
||||
|
@ -391,27 +391,27 @@ static void check_inode_bitmaps(e2fsck_t ctx)
|
|||
dir_array = (int *) e2fsck_allocate_memory(ctx,
|
||||
fs->group_desc_count * sizeof(int), "directory count array");
|
||||
|
||||
if ((1 < ext2fs_get_inode_bitmap_start(ctx->inode_used_map)) ||
|
||||
if ((1 < ext2fs_get_inode_bitmap_start2(ctx->inode_used_map)) ||
|
||||
(fs->super->s_inodes_count >
|
||||
ext2fs_get_inode_bitmap_end(ctx->inode_used_map))) {
|
||||
ext2fs_get_inode_bitmap_end2(ctx->inode_used_map))) {
|
||||
pctx.num = 3;
|
||||
pctx.blk = 1;
|
||||
pctx.blk2 = fs->super->s_inodes_count;
|
||||
pctx.ino = ext2fs_get_inode_bitmap_start(ctx->inode_used_map);
|
||||
pctx.ino2 = ext2fs_get_inode_bitmap_end(ctx->inode_used_map);
|
||||
pctx.ino = ext2fs_get_inode_bitmap_start2(ctx->inode_used_map);
|
||||
pctx.ino2 = ext2fs_get_inode_bitmap_end2(ctx->inode_used_map);
|
||||
fix_problem(ctx, PR_5_BMAP_ENDPOINTS, &pctx);
|
||||
|
||||
ctx->flags |= E2F_FLAG_ABORT; /* fatal */
|
||||
goto errout;
|
||||
}
|
||||
if ((1 < ext2fs_get_inode_bitmap_start(fs->inode_map)) ||
|
||||
if ((1 < ext2fs_get_inode_bitmap_start2(fs->inode_map)) ||
|
||||
(fs->super->s_inodes_count >
|
||||
ext2fs_get_inode_bitmap_end(fs->inode_map))) {
|
||||
ext2fs_get_inode_bitmap_end2(fs->inode_map))) {
|
||||
pctx.num = 4;
|
||||
pctx.blk = 1;
|
||||
pctx.blk2 = fs->super->s_inodes_count;
|
||||
pctx.ino = ext2fs_get_inode_bitmap_start(fs->inode_map);
|
||||
pctx.ino2 = ext2fs_get_inode_bitmap_end(fs->inode_map);
|
||||
pctx.ino = ext2fs_get_inode_bitmap_start2(fs->inode_map);
|
||||
pctx.ino2 = ext2fs_get_inode_bitmap_end2(fs->inode_map);
|
||||
fix_problem(ctx, PR_5_BMAP_ENDPOINTS, &pctx);
|
||||
|
||||
ctx->flags |= E2F_FLAG_ABORT; /* fatal */
|
||||
|
@ -454,11 +454,11 @@ redo_counts:
|
|||
}
|
||||
}
|
||||
|
||||
actual = ext2fs_fast_test_inode_bitmap(ctx->inode_used_map, i);
|
||||
actual = ext2fs_fast_test_inode_bitmap2(ctx->inode_used_map, i);
|
||||
if (redo_flag)
|
||||
bitmap = actual;
|
||||
else if (!skip_group)
|
||||
bitmap = ext2fs_fast_test_inode_bitmap(fs->inode_map, i);
|
||||
bitmap = ext2fs_fast_test_inode_bitmap2(fs->inode_map, i);
|
||||
if (actual == bitmap)
|
||||
goto do_counts;
|
||||
|
||||
|
@ -506,7 +506,7 @@ redo_counts:
|
|||
|
||||
do_counts:
|
||||
if (bitmap) {
|
||||
if (ext2fs_test_inode_bitmap(ctx->inode_dir_map, i))
|
||||
if (ext2fs_test_inode_bitmap2(ctx->inode_dir_map, i))
|
||||
dirs_count++;
|
||||
} else if (!skip_group || csum_flag) {
|
||||
group_free++;
|
||||
|
@ -656,14 +656,14 @@ static void check_inode_end(e2fsck_t ctx)
|
|||
static void check_block_end(e2fsck_t ctx)
|
||||
{
|
||||
ext2_filsys fs = ctx->fs;
|
||||
blk_t end, save_blocks_count, i;
|
||||
blk64_t end, save_blocks_count, i;
|
||||
struct problem_context pctx;
|
||||
|
||||
clear_problem_context(&pctx);
|
||||
|
||||
end = ext2fs_get_block_bitmap_start(fs->block_map) +
|
||||
end = ext2fs_get_block_bitmap_start2(fs->block_map) +
|
||||
(EXT2_BLOCKS_PER_GROUP(fs->super) * fs->group_desc_count) - 1;
|
||||
pctx.errcode = ext2fs_fudge_block_bitmap_end(fs->block_map, end,
|
||||
pctx.errcode = ext2fs_fudge_block_bitmap_end2(fs->block_map, end,
|
||||
&save_blocks_count);
|
||||
if (pctx.errcode) {
|
||||
pctx.num = 3;
|
||||
|
@ -676,11 +676,11 @@ static void check_block_end(e2fsck_t ctx)
|
|||
|
||||
/* Protect loop from wrap-around if end is maxed */
|
||||
for (i = save_blocks_count + 1; i <= end && i > save_blocks_count; i++) {
|
||||
if (!ext2fs_test_block_bitmap(fs->block_map, i)) {
|
||||
if (!ext2fs_test_block_bitmap2(fs->block_map, i)) {
|
||||
if (fix_problem(ctx, PR_5_BLOCK_BMAP_PADDING, &pctx)) {
|
||||
for (; i <= end; i++)
|
||||
ext2fs_mark_block_bitmap(fs->block_map,
|
||||
i);
|
||||
ext2fs_mark_block_bitmap2(fs->block_map,
|
||||
i);
|
||||
ext2fs_mark_bb_dirty(fs);
|
||||
} else
|
||||
ext2fs_unmark_valid(fs);
|
||||
|
@ -688,7 +688,7 @@ static void check_block_end(e2fsck_t ctx)
|
|||
}
|
||||
}
|
||||
|
||||
pctx.errcode = ext2fs_fudge_block_bitmap_end(fs->block_map,
|
||||
pctx.errcode = ext2fs_fudge_block_bitmap_end2(fs->block_map,
|
||||
save_blocks_count, 0);
|
||||
if (pctx.errcode) {
|
||||
pctx.num = 4;
|
||||
|
|
|
@ -647,7 +647,7 @@ static int write_dir_block(ext2_filsys fs,
|
|||
if (blockcnt >= wd->outdir->num) {
|
||||
e2fsck_read_bitmaps(wd->ctx);
|
||||
blk = *block_nr;
|
||||
ext2fs_unmark_block_bitmap(wd->ctx->block_found_map, blk);
|
||||
ext2fs_unmark_block_bitmap2(wd->ctx->block_found_map, blk);
|
||||
ext2fs_block_alloc_stats(fs, blk, -1);
|
||||
*block_nr = 0;
|
||||
wd->cleared++;
|
||||
|
|
|
@ -84,7 +84,7 @@ static int release_inode_block(ext2_filsys fs,
|
|||
return BLOCK_ABORT;
|
||||
}
|
||||
|
||||
if (!ext2fs_test_block_bitmap(fs->block_map, blk)) {
|
||||
if (!ext2fs_test_block_bitmap2(fs->block_map, blk)) {
|
||||
fix_problem(ctx, PR_0_ORPHAN_ALREADY_CLEARED_BLOCK, pctx);
|
||||
goto return_abort;
|
||||
}
|
||||
|
|
|
@ -939,6 +939,7 @@ int main (int argc, char *argv[])
|
|||
int flags, run_result;
|
||||
int journal_size;
|
||||
int sysval, sys_page_size = 4096;
|
||||
int old_bitmaps;
|
||||
__u32 features[3];
|
||||
char *cp;
|
||||
|
||||
|
@ -1001,6 +1002,10 @@ restart:
|
|||
#endif
|
||||
io_ptr = unix_io_manager;
|
||||
flags = EXT2_FLAG_NOFREE_ON_ERROR;
|
||||
profile_get_boolean(ctx->profile, "options", "old_bitmaps", 0, 0,
|
||||
&old_bitmaps);
|
||||
if (!old_bitmaps)
|
||||
flags |= EXT2_FLAG_64BITS;
|
||||
if ((ctx->options & E2F_OPT_READONLY) == 0)
|
||||
flags |= EXT2_FLAG_RW;
|
||||
if ((ctx->mount_flags & EXT2_MF_MOUNTED) == 0)
|
||||
|
|
Loading…
Reference in New Issue