From: Theodore Ts'o Date: Fri, 25 Jul 2014 12:38:39 +0000 (-0400) Subject: Merge branch 'maint' into next X-Git-Tag: v1.43-WIP-2015-05-18~272 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=60203cb17147d1fdca9482f295be1f3de6d01240;p=thirdparty%2Fe2fsprogs.git Merge branch 'maint' into next Conflicts: e2fsck/pass1.c --- 60203cb17147d1fdca9482f295be1f3de6d01240 diff --cc e2fsck/pass1.c index 3f287b094,87e6d341d..648c578d7 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@@ -762,8 -690,8 +762,9 @@@ void e2fsck_pass1(e2fsck_t ctx } block_buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize * 3, "block interate buffer"); - e2fsck_use_inode_shortcuts(ctx, 1); + if (EXT2_INODE_SIZE(fs->super) == EXT2_GOOD_OLD_INODE_SIZE) + e2fsck_use_inode_shortcuts(ctx, 1); + e2fsck_intercept_block_allocations(ctx); old_op = ehandler_operation(_("opening inode scan")); pctx.errcode = ext2fs_open_inode_scan(fs, ctx->inode_buffer_blocks, &scan); @@@ -2132,6 -1927,45 +2128,45 @@@ fix_problem_now } pb->fragmented = 1; } + /* + * If we notice a gap in the logical block mappings of an + * extent-mapped directory, offer to close the hole by + * moving the logical block down, otherwise we'll go mad in + * pass 3 allocating empty directory blocks to fill the hole. + */ - if (is_dir && ++ if (try_repairs && is_dir && + pb->last_block + 1 < (e2_blkcnt_t)extent.e_lblk) { + blk64_t new_lblk; + + new_lblk = pb->last_block + 1; + if (EXT2FS_CLUSTER_RATIO(ctx->fs) > 1) + new_lblk = ((new_lblk + + EXT2FS_CLUSTER_RATIO(ctx->fs)) & + EXT2FS_CLUSTER_MASK(ctx->fs)) | + (extent.e_lblk & + EXT2FS_CLUSTER_MASK(ctx->fs)); + pctx->blk = extent.e_lblk; + pctx->blk2 = new_lblk; + if (fix_problem(ctx, PR_1_COLLAPSE_DBLOCK, pctx)) { + extent.e_lblk = new_lblk; + pb->inode_modified = 1; + pctx->errcode = ext2fs_extent_replace(ehandle, + 0, &extent); + if (pctx->errcode) { + pctx->errcode = 0; + goto alloc_later; + } + pctx->errcode = ext2fs_extent_fix_parents(ehandle); + if (pctx->errcode) + goto failed_add_dir_block; + pctx->errcode = ext2fs_extent_goto(ehandle, + extent.e_lblk); + if (pctx->errcode) + goto failed_add_dir_block; + last_lblk = extent.e_lblk + extent.e_len - 1; + } + } + alloc_later: while (is_dir && (++pb->last_db_block < (e2_blkcnt_t) extent.e_lblk)) { pctx->errcode = ext2fs_add_dir_block2(ctx->fs->dblist, diff --cc e2fsck/pass3.c index 6f7f8559e,f9d4aae36..4fc390a82 --- a/e2fsck/pass3.c +++ b/e2fsck/pass3.c @@@ -828,9 -789,7 +807,8 @@@ errcode_t e2fsck_expand_directory(e2fsc es.err = 0; es.newblocks = 0; es.ctx = ctx; + es.dir = dir; - before = ext2fs_free_blocks_count(fs->super); retval = ext2fs_block_iterate3(fs, dir, BLOCK_FLAG_APPEND, 0, expand_dir_proc, &es); diff --cc e2fsck/problem.c index 18d80259b,837d11109..a1986c677 --- a/e2fsck/problem.c +++ b/e2fsck/problem.c @@@ -1020,24 -966,12 +1020,29 @@@ static struct e2fsck_problem problem_ta N_("@i %i, end of extent exceeds allowed value\n\t(logical @b %c, physical @b %b, len %N)\n"), PROMPT_CLEAR, 0 }, + /* Inode has inline data, but superblock is missing INLINE_DATA feature. */ + { PR_1_INLINE_DATA_FEATURE, + N_("@i %i has inline data, but @S is missing INLINE_DATA feature\n"), + PROMPT_CLEAR, PR_PREEN_OK }, + + /* INLINE_DATA feature is set in a non-inline-data filesystem */ + { PR_1_INLINE_DATA_SET, + N_("@i %i has INLINE_DATA_FL flag on @f without inline data support.\n"), + PROMPT_CLEAR, 0 }, + + /* + * Inode block conflicts with critical metadata, skipping + * block checks + */ + { PR_1_CRITICAL_METADATA_COLLISION, + N_("@i %i block %b conflicts with critical metadata, skipping block checks.\n"), + PROMPT_NONE, 0 }, + /* Directory inode block should be at block */ + { PR_1_COLLAPSE_DBLOCK, + N_("@d @i %i @b %b should be at @b %c. "), + PROMPT_FIX, 0 }, + /* Pass 1b errors */ /* Pass 1B: Rescan for duplicate/bad blocks */