mirror of https://github.com/vitalif/e2fsprogs
ChangeLog, pass3.c, problem.c, problem.h, util.c:
util.c (print_resource_track): Use mallinfo if present to get more accurate malloc statistics. pass3.c (get_lost_and_found): Check to see if lost+found is a plain fail; if so, offer to unlink it. problem.c, problem.h (PR_3_LPF_NOTDIR): Add new problem code. problem.c: Fix problem message for PR_1_BAD_GROUP_DESCRIPTORS so that the block group number is printed. Add new prompt, PROMPT_UNLINK.bitmap-optimize
parent
6454d84b0d
commit
4a9f59366b
|
@ -1,3 +1,23 @@
|
|||
1999-03-14 Theodore Ts'o <tytso@rsts-11.mit.edu>
|
||||
|
||||
* util.c (print_resource_track): Use mallinfo if present to get
|
||||
more accurate malloc statistics.
|
||||
|
||||
* pass3.c (get_lost_and_found): Check to see if lost+found is a
|
||||
plain fail; if so, offer to unlink it.
|
||||
|
||||
* problem.c, problem.h (PR_3_LPF_NOTDIR): Add new problem code.
|
||||
|
||||
1999-03-09 Theodore Ts'o <tytso@rsts-11.mit.edu>
|
||||
|
||||
* problem.c: Fix problem message for PR_1_BAD_GROUP_DESCRIPTORS so
|
||||
that the block group number is printed. Add new prompt,
|
||||
PROMPT_UNLINK.
|
||||
|
||||
1999-01-09 Theodore Ts'o <tytso@rsts-11.mit.edu>
|
||||
|
||||
* Release of E2fsprogs 1.14
|
||||
|
||||
1999-01-09 Theodore Ts'o <tytso@rsts-11.mit.edu>
|
||||
|
||||
* message.c (safe_print): New function which prints strings,
|
||||
|
|
|
@ -340,14 +340,32 @@ ino_t get_lost_and_found(e2fsck_t ctx)
|
|||
char * block;
|
||||
const char name[] = "lost+found";
|
||||
struct problem_context pctx;
|
||||
struct dir_info *dirinfo;
|
||||
|
||||
clear_problem_context(&pctx);
|
||||
|
||||
retval = ext2fs_lookup(fs, EXT2_ROOT_INO, name,
|
||||
sizeof(name)-1, 0, &ino);
|
||||
if (!retval)
|
||||
return ino;
|
||||
if (retval != EXT2_ET_FILE_NOT_FOUND) {
|
||||
if (!retval) {
|
||||
if (ext2fs_test_inode_bitmap(ctx->inode_dir_map, ino))
|
||||
return ino;
|
||||
/* Lost+found isn't a directory! */
|
||||
pctx.ino = ino;
|
||||
if (!fix_problem(ctx, PR_3_LPF_NOTDIR, &pctx))
|
||||
return 0;
|
||||
|
||||
/* OK, unlink the old /lost+found directory. */
|
||||
pctx.errcode = ext2fs_unlink(fs, EXT2_ROOT_INO, name, ino, 0);
|
||||
if (pctx.errcode) {
|
||||
pctx.str = "ext2fs_unlink";
|
||||
fix_problem(ctx, PR_3_CREATE_LPF_ERROR, &pctx);
|
||||
return 0;
|
||||
}
|
||||
dirinfo = e2fsck_get_dir_info(ctx, ino);
|
||||
if (dirinfo)
|
||||
dirinfo->parent = 0;
|
||||
adjust_inode_count(ctx, ino, -1);
|
||||
} else if (retval != EXT2_ET_FILE_NOT_FOUND) {
|
||||
pctx.errcode = retval;
|
||||
fix_problem(ctx, PR_3_ERR_FIND_LPF, &pctx);
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#define PROMPT_CLONE 14
|
||||
#define PROMPT_DELETE 15
|
||||
#define PROMPT_SUPPRESS 16
|
||||
#define PROMPT_UNLINK 17
|
||||
|
||||
/*
|
||||
* These are the prompts which are used to ask the user if they want
|
||||
|
@ -60,6 +61,7 @@ static const char *prompt[] = {
|
|||
"Clone duplicate/bad blocks", /* 14 */
|
||||
"Delete file", /* 15 */
|
||||
"Suppress messages", /* 16 */
|
||||
"Unlink", /* 17 */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -84,6 +86,7 @@ static const char *preen_msg[] = {
|
|||
"DUPLICATE/BAD BLOCKS CLONED", /* 14 */
|
||||
"FILE DELETED", /* 15 */
|
||||
"SUPPRESSED", /* 16 */
|
||||
"UNLINKED", /* 17 */
|
||||
};
|
||||
|
||||
static const struct e2fsck_problem problem_table[] = {
|
||||
|
@ -311,7 +314,7 @@ static const struct e2fsck_problem problem_table[] = {
|
|||
|
||||
/* Bad block group descriptors in group */
|
||||
{ PR_1_BAD_GROUP_DESCRIPTORS,
|
||||
"Warning: Group %d's copy of the @g descriptors has a bad "
|
||||
"Warning: Group %g's copy of the @g descriptors has a bad "
|
||||
"@b (%b).\n",
|
||||
PROMPT_NONE, PR_PREEN_OK | PR_PREEN_NOMSG },
|
||||
|
||||
|
@ -802,6 +805,11 @@ static const struct e2fsck_problem problem_table[] = {
|
|||
"Internal error: couldn't find dir_info for %i.\n",
|
||||
PROMPT_NONE, PR_FATAL },
|
||||
|
||||
/* Lost+found not a directory */
|
||||
{ PR_3_LPF_NOTDIR,
|
||||
"/@l is not a @d (ino=%i)\n",
|
||||
PROMPT_UNLINK, 0 },
|
||||
|
||||
/* Pass 4 errors */
|
||||
|
||||
/* Pass 4: Checking reference counts */
|
||||
|
|
|
@ -479,7 +479,10 @@ struct problem_context {
|
|||
#define PR_3_NO_ROOT_INODE_ABORT 0x030015
|
||||
|
||||
/* Internal error: couldn't find dir_info */
|
||||
#define PR_3_NO_DIRINFO 0x020016
|
||||
#define PR_3_NO_DIRINFO 0x030016
|
||||
|
||||
/* Lost+found is not a directory */
|
||||
#define PR_3_LPF_NOTDIR 0x030017
|
||||
|
||||
/*
|
||||
* Pass 4 errors
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <termios.h>
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include "e2fsck.h"
|
||||
|
||||
|
@ -218,6 +221,9 @@ void print_resource_track(const char *desc, struct resource_track *track)
|
|||
{
|
||||
#ifdef HAVE_GETRUSAGE
|
||||
struct rusage r;
|
||||
#endif
|
||||
#ifdef HAVE_MALLINFO
|
||||
struct mallinfo malloc_info;
|
||||
#endif
|
||||
struct timeval time_end;
|
||||
|
||||
|
@ -225,18 +231,23 @@ void print_resource_track(const char *desc, struct resource_track *track)
|
|||
|
||||
if (desc)
|
||||
printf("%s: ", desc);
|
||||
|
||||
|
||||
#ifdef HAVE_MALLINFO
|
||||
malloc_info = mallinfo();
|
||||
printf("Memory used: %d/%d, ", malloc_info.arena, malloc_info.hblkhd);
|
||||
#else
|
||||
printf("Memory used: %d, ",
|
||||
(int) (((char *) sbrk(0)) - ((char *) track->brk_start)));
|
||||
#endif
|
||||
#ifdef HAVE_GETRUSAGE
|
||||
getrusage(RUSAGE_SELF, &r);
|
||||
|
||||
printf("Memory used: %d, elapsed time: %6.3f/%6.3f/%6.3f\n",
|
||||
(int) (((char *) sbrk(0)) - ((char *) track->brk_start)),
|
||||
printf("elapsed time: %6.3f/%6.3f/%6.3f\n",
|
||||
timeval_subtract(&time_end, &track->time_start),
|
||||
timeval_subtract(&r.ru_utime, &track->user_start),
|
||||
timeval_subtract(&r.ru_stime, &track->system_start));
|
||||
#else
|
||||
printf("Memory used: %d, elapsed time: %6.3f\n",
|
||||
(int) (((char *) sbrk(0)) - ((char *) track->brk_start)),
|
||||
printf("elapsed time: %6.3f\n",
|
||||
timeval_subtract(&time_end, &track->time_start));
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue