From: Theodore Ts'o Date: Mon, 7 Jun 2010 16:42:40 +0000 (-0400) Subject: Merge branch 'maint' into next X-Git-Tag: v1.42-WIP-0702~108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97d26ce9e3589e9f5fa17014467a9730a884d158;p=thirdparty%2Fe2fsprogs.git Merge branch 'maint' into next Conflicts: e2fsck/journal.c e2fsck/pass1.c e2fsck/pass2.c misc/mke2fs.c --- 97d26ce9e3589e9f5fa17014467a9730a884d158 diff --cc e2fsck/journal.c index 57783ebbf,64a0fd627..c2f8951a2 --- a/e2fsck/journal.c +++ b/e2fsck/journal.c @@@ -214,8 -214,8 +214,8 @@@ static int process_journal_block(ext2_f p = (struct process_block_struct *) priv_data; - if (blk < fs->super->s_first_data_block || + if (!blk || blk < fs->super->s_first_data_block || - blk >= fs->super->s_blocks_count) + blk >= ext2fs_blocks_count(fs->super)) return BLOCK_ABORT; if (blockcnt >= 0) diff --cc e2fsck/pass1.c index 3c6f91ce3,4bf80d255..ade5ff654 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@@ -1690,8 -1694,9 +1695,9 @@@ static void scan_extent_node(e2fsck_t c is_dir = LINUX_S_ISDIR(pctx->inode->i_mode); problem = 0; - if (extent.e_pblk < ctx->fs->super->s_first_data_block || + if (extent.e_pblk == 0 || + extent.e_pblk < ctx->fs->super->s_first_data_block || - extent.e_pblk >= ctx->fs->super->s_blocks_count) + extent.e_pblk >= ext2fs_blocks_count(ctx->fs->super)) problem = PR_1_EXTENT_BAD_START_BLK; else if (extent.e_lblk < start_block) problem = PR_1_OUT_OF_ORDER_EXTENTS; diff --cc e2fsck/pass2.c index 29a0174a4,2847901b4..1300e3874 --- a/e2fsck/pass2.c +++ b/e2fsck/pass2.c @@@ -1007,13 -1007,18 +1007,18 @@@ out_htree } } - if (!(ext2fs_test_inode_bitmap2(ctx->inode_used_map, - dirent->inode))) { - /* - * If the inode is unused, offer to clear it. - */ + /* + * Offer to clear unused inodes; if we are going to be + * restarting the scan due to bg_itable_unused being + * wrong, then don't clear any inodes to avoid zapping + * inodes that were skipped during pass1 due to an + * incorrect bg_itable_unused; we'll get any real + * problems after we restart. + */ + if (!(ctx->flags & E2F_FLAG_RESTART_LATER) && - !(ext2fs_test_inode_bitmap(ctx->inode_used_map, - dirent->inode))) ++ !(ext2fs_test_inode_bitmap2(ctx->inode_used_map, ++ dirent->inode))) problem = PR_2_UNUSED_INODE; - } if (problem) { if (fix_problem(ctx, problem, &cd->pctx)) { diff --cc misc/mke2fs.c index 022c12cb6,ac87b8ec9..ca39d905b --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@@ -1617,9 -1679,20 +1626,22 @@@ got_size if ((blocksize < 0) && (use_bsize < (-blocksize))) use_bsize = -blocksize; blocksize = use_bsize; - fs_param.s_blocks_count /= blocksize / 1024; + ext2fs_blocks_count_set(&fs_param, + ext2fs_blocks_count(&fs_param) / + (blocksize / 1024)); + } else { + if (blocksize < lsector_size || /* Impossible */ + (!force && (blocksize < psector_size))) { /* Suboptimal */ + com_err(program_name, EINVAL, + _("while setting blocksize; too small " + "for device\n")); + exit(1); + } else if (blocksize < psector_size) { + fprintf(stderr, _("Warning: specified blocksize %d is " + "less than device physical sectorsize %d, " + "forced to continue\n"), blocksize, + psector_size); + } } if (inode_ratio == 0) {