Merge branch 'next'

pu
Theodore Ts'o 2012-09-02 23:32:14 -04:00
commit 19dcd5cce4
10 changed files with 35 additions and 8 deletions

View File

@ -166,7 +166,7 @@ request do_imap, "Calculate the location of an inode",
request do_dump_unused, "Dump unused blocks",
dump_unused;
request do_set_current_time, "Set current time to use when setting filesystme fields",
request do_set_current_time, "Set current time to use when setting filesystem fields",
set_current_time;
request do_supported_features, "Print features supported by this version of e2fsprogs",

View File

@ -1299,6 +1299,12 @@ endit:
ext2fs_free_mem(&block_buf);
ext2fs_free_mem(&inode);
/*
* The l+f inode may have been cleared, so zap it now and
* later passes will recalculate it if necessary
*/
ctx->lost_and_found = 0;
print_resource_track(ctx, _("Pass 1"), &rtrack, ctx->fs->io);
}
@ -2248,7 +2254,7 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
}
if (ctx->dirs_to_hash && pb.is_dir &&
(ctx->lost_and_found == ino) &&
!(ctx->lost_and_found && ctx->lost_and_found == ino) &&
!(inode->i_flags & EXT2_INDEX_FL) &&
((inode->i_size / fs->blocksize) >= 3))
e2fsck_rehash_dir_later(ctx, ino);

View File

@ -375,7 +375,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_bitmap2(ctx->inode_dir_map, ino)) {
if (ext2fs_check_directory(fs, ino) == 0) {
ctx->lost_and_found = ino;
return ino;
}

View File

@ -694,11 +694,23 @@ static int write_dir_block(ext2_filsys fs,
{
struct write_dir_struct *wd = (struct write_dir_struct *) priv_data;
blk64_t blk;
char *dir;
char *dir, *buf = 0;
if (*block_nr == 0)
return 0;
if (blockcnt >= wd->outdir->num) {
if (blockcnt < 0)
return 0;
if (blockcnt < wd->outdir->num)
dir = wd->outdir->buf + (blockcnt * fs->blocksize);
else if (wd->ctx->lost_and_found == wd->dir) {
/* Don't release any extra directory blocks for lost+found */
wd->err = ext2fs_new_dir_block(fs, 0, 0, &buf);
if (wd->err)
return BLOCK_ABORT;
dir = buf;
wd->outdir->num++;
} else {
/* We don't need this block, so release it */
e2fsck_read_bitmaps(wd->ctx);
blk = *block_nr;
ext2fs_unmark_block_bitmap2(wd->ctx->block_found_map, blk);
@ -707,11 +719,11 @@ static int write_dir_block(ext2_filsys fs,
wd->cleared++;
return BLOCK_CHANGED;
}
if (blockcnt < 0)
return 0;
dir = wd->outdir->buf + (blockcnt * fs->blocksize);
wd->err = ext2fs_write_dir_block4(fs, *block_nr, dir, 0, wd->dir);
if (buf)
ext2fs_free_mem(&buf);
if (wd->err)
return BLOCK_ABORT;
return 0;
@ -890,6 +902,8 @@ void e2fsck_rehash_directories(e2fsck_t ctx)
if (!ctx->dirs_to_hash && !all_dirs)
return;
(void) e2fsck_get_lost_and_found(ctx, 0);
clear_problem_context(&pctx);
dir_index = ctx->fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_DIR_INDEX;

View File

@ -1,5 +1,6 @@
FSCK_OPT=-yf
[ -f "$TMPFILE" ] && rm -f $TMPFILE
TMPFILE=$test_name.tmp
> $TMPFILE

View File

@ -1,5 +1,6 @@
FSCK_OPT=-yf
[ -f "$TMPFILE" ] && rm -f $TMPFILE
TMPFILE=$test_name.tmp
> $TMPFILE

View File

@ -2,6 +2,7 @@ DESCRIPTION="enable MMP during mke2fs"
FS_SIZE=65536
MKE2FS_DEVICE_SECTSIZE=2048
export MKE2FS_DEVICE_SECTSIZE
[ -f "$TMPFILE" ] && rm -f $TMPFILE
TMPFILE=$test_name.tmp
> $TMPFILE
stat -f $TMPFILE | grep -q "Type: tmpfs"

View File

@ -1,5 +1,6 @@
FSCK_OPT=-yf
[ -f "$TMPFILE" ] && rm -f $TMPFILE
TMPFILE=$test_name.tmp
> $TMPFILE

View File

@ -1,5 +1,6 @@
FSCK_OPT=-yf
[ -f "$TMPFILE" ] && rm -f $TMPFILE
TMPFILE=$test_name.tmp
> $TMPFILE

View File

@ -8,7 +8,9 @@
#endif
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <string.h>
#include <fcntl.h>
#include <sys/param.h>