aboutsummaryrefslogtreecommitdiff
path: root/e2fsprogs/e2fsck.c
diff options
context:
space:
mode:
Diffstat (limited to 'e2fsprogs/e2fsck.c')
-rw-r--r--e2fsprogs/e2fsck.c398
1 files changed, 9 insertions, 389 deletions
diff --git a/e2fsprogs/e2fsck.c b/e2fsprogs/e2fsck.c
index fb1e772a4..52069fe60 100644
--- a/e2fsprogs/e2fsck.c
+++ b/e2fsprogs/e2fsck.c
@@ -35,40 +35,8 @@
35#ifndef _GNU_SOURCE 35#ifndef _GNU_SOURCE
36#define _GNU_SOURCE 1 /* get strnlen() */ 36#define _GNU_SOURCE 1 /* get strnlen() */
37#endif 37#endif
38#include <sys/types.h> 38
39#include <inttypes.h> 39#include "e2fsck.h" /*Put all of our defines here to clean things up*/
40#include <stdio.h>
41#include <string.h>
42#include <unistd.h>
43#include <stdlib.h>
44#include <time.h>
45#include <fcntl.h>
46#include <ctype.h>
47#include <setjmp.h>
48#include <errno.h>
49#include <getopt.h>
50#include <limits.h>
51#include <stddef.h>
52#include <assert.h>
53#include <signal.h>
54#include <sys/time.h>
55#include <sys/stat.h>
56#include <sys/resource.h>
57#include <sys/param.h>
58#include <sys/mount.h>
59#include <sys/ioctl.h>
60#include <malloc.h>
61#include <termios.h>
62#include <mntent.h>
63#include <dirent.h>
64
65#include "fsck.h"
66
67#include "ext2fs/ext2_fs.h"
68#include "ext2fs/ext2fs.h"
69#include "blkid/blkid.h"
70#include "ext2fs/ext2_ext_attr.h"
71#include "uuid/uuid.h"
72 40
73#ifdef __GNUC__ 41#ifdef __GNUC__
74#define _INLINE_ __inline__ 42#define _INLINE_ __inline__
@@ -79,274 +47,6 @@
79#endif 47#endif
80 48
81/* 49/*
82 * The last ext2fs revision level that this version of e2fsck is able to
83 * support
84 */
85#define E2FSCK_CURRENT_REV 1
86
87/*
88 * The directory information structure; stores directory information
89 * collected in earlier passes, to avoid disk i/o in fetching the
90 * directory information.
91 */
92struct dir_info {
93 ext2_ino_t ino; /* Inode number */
94 ext2_ino_t dotdot; /* Parent according to '..' */
95 ext2_ino_t parent; /* Parent according to treewalk */
96};
97
98
99/*
100 * The indexed directory information structure; stores information for
101 * directories which contain a hash tree index.
102 */
103struct dx_dir_info {
104 ext2_ino_t ino; /* Inode number */
105 int numblocks; /* number of blocks */
106 int hashversion;
107 short depth; /* depth of tree */
108 struct dx_dirblock_info *dx_block; /* Array of size numblocks */
109};
110
111#define DX_DIRBLOCK_ROOT 1
112#define DX_DIRBLOCK_LEAF 2
113#define DX_DIRBLOCK_NODE 3
114#define DX_DIRBLOCK_CORRUPT 4
115#define DX_DIRBLOCK_CLEARED 8
116
117struct dx_dirblock_info {
118 int type;
119 blk_t phys;
120 int flags;
121 blk_t parent;
122 ext2_dirhash_t min_hash;
123 ext2_dirhash_t max_hash;
124 ext2_dirhash_t node_min_hash;
125 ext2_dirhash_t node_max_hash;
126};
127
128#define DX_FLAG_REFERENCED 1
129#define DX_FLAG_DUP_REF 2
130#define DX_FLAG_FIRST 4
131#define DX_FLAG_LAST 8
132
133#ifdef RESOURCE_TRACK
134/*
135 * This structure is used for keeping track of how much resources have
136 * been used for a particular pass of e2fsck.
137 */
138struct resource_track {
139 struct timeval time_start;
140 struct timeval user_start;
141 struct timeval system_start;
142 void *brk_start;
143};
144#endif
145
146/*
147 * E2fsck options
148 */
149#define E2F_OPT_READONLY 0x0001
150#define E2F_OPT_PREEN 0x0002
151#define E2F_OPT_YES 0x0004
152#define E2F_OPT_NO 0x0008
153#define E2F_OPT_TIME 0x0010
154#define E2F_OPT_TIME2 0x0020
155#define E2F_OPT_CHECKBLOCKS 0x0040
156#define E2F_OPT_DEBUG 0x0080
157#define E2F_OPT_FORCE 0x0100
158#define E2F_OPT_WRITECHECK 0x0200
159#define E2F_OPT_COMPRESS_DIRS 0x0400
160
161/*
162 * E2fsck flags
163 */
164#define E2F_FLAG_ABORT 0x0001 /* Abort signaled */
165#define E2F_FLAG_CANCEL 0x0002 /* Cancel signaled */
166#define E2F_FLAG_SIGNAL_MASK 0x0003
167#define E2F_FLAG_RESTART 0x0004 /* Restart signaled */
168
169#define E2F_FLAG_SETJMP_OK 0x0010 /* Setjmp valid for abort */
170
171#define E2F_FLAG_PROG_BAR 0x0020 /* Progress bar on screen */
172#define E2F_FLAG_PROG_SUPPRESS 0x0040 /* Progress suspended */
173#define E2F_FLAG_JOURNAL_INODE 0x0080 /* Create a new ext3 journal inode */
174#define E2F_FLAG_SB_SPECIFIED 0x0100 /* The superblock was explicitly
175 * specified by the user */
176#define E2F_FLAG_RESTARTED 0x0200 /* E2fsck has been restarted */
177#define E2F_FLAG_RESIZE_INODE 0x0400 /* Request to recreate resize inode */
178
179/*
180 * Defines for indicating the e2fsck pass number
181 */
182#define E2F_PASS_1 1
183#define E2F_PASS_2 2
184#define E2F_PASS_3 3
185#define E2F_PASS_4 4
186#define E2F_PASS_5 5
187#define E2F_PASS_1B 6
188
189
190/*
191 * This is the global e2fsck structure.
192 */
193typedef struct e2fsck_struct *e2fsck_t;
194
195/*
196 * Define the extended attribute refcount structure
197 */
198typedef struct ea_refcount *ext2_refcount_t;
199
200struct e2fsck_struct {
201 ext2_filsys fs;
202 const char *program_name;
203 char *filesystem_name;
204 char *device_name;
205 char *io_options;
206 int flags; /* E2fsck internal flags */
207 int options;
208 blk_t use_superblock; /* sb requested by user */
209 blk_t superblock; /* sb used to open fs */
210 int blocksize; /* blocksize */
211 blk_t num_blocks; /* Total number of blocks */
212 int mount_flags;
213 blkid_cache blkid; /* blkid cache */
214
215 jmp_buf abort_loc;
216
217 unsigned long abort_code;
218
219 int (*progress)(e2fsck_t ctx, int pass, unsigned long cur,
220 unsigned long max);
221
222 ext2fs_inode_bitmap inode_used_map; /* Inodes which are in use */
223 ext2fs_inode_bitmap inode_bad_map; /* Inodes which are bad somehow */
224 ext2fs_inode_bitmap inode_dir_map; /* Inodes which are directories */
225 ext2fs_inode_bitmap inode_bb_map; /* Inodes which are in bad blocks */
226 ext2fs_inode_bitmap inode_imagic_map; /* AFS inodes */
227 ext2fs_inode_bitmap inode_reg_map; /* Inodes which are regular files*/
228
229 ext2fs_block_bitmap block_found_map; /* Blocks which are in use */
230 ext2fs_block_bitmap block_dup_map; /* Blks referenced more than once */
231 ext2fs_block_bitmap block_ea_map; /* Blocks which are used by EA's */
232
233 /*
234 * Inode count arrays
235 */
236 ext2_icount_t inode_count;
237 ext2_icount_t inode_link_info;
238
239 ext2_refcount_t refcount;
240 ext2_refcount_t refcount_extra;
241
242 /*
243 * Array of flags indicating whether an inode bitmap, block
244 * bitmap, or inode table is invalid
245 */
246 int *invalid_inode_bitmap_flag;
247 int *invalid_block_bitmap_flag;
248 int *invalid_inode_table_flag;
249 int invalid_bitmaps; /* There are invalid bitmaps/itable */
250
251 /*
252 * Block buffer
253 */
254 char *block_buf;
255
256 /*
257 * For pass1_check_directory and pass1_get_blocks
258 */
259 ext2_ino_t stashed_ino;
260 struct ext2_inode *stashed_inode;
261
262 /*
263 * Location of the lost and found directory
264 */
265 ext2_ino_t lost_and_found;
266 int bad_lost_and_found;
267
268 /*
269 * Directory information
270 */
271 int dir_info_count;
272 int dir_info_size;
273 struct dir_info *dir_info;
274
275 /*
276 * Indexed directory information
277 */
278 int dx_dir_info_count;
279 int dx_dir_info_size;
280 struct dx_dir_info *dx_dir_info;
281
282 /*
283 * Directories to hash
284 */
285 ext2_u32_list dirs_to_hash;
286
287 /*
288 * Tuning parameters
289 */
290 int process_inode_size;
291 int inode_buffer_blocks;
292
293 /*
294 * ext3 journal support
295 */
296 io_channel journal_io;
297 char *journal_name;
298
299#ifdef RESOURCE_TRACK
300 /*
301 * For timing purposes
302 */
303 struct resource_track global_rtrack;
304#endif
305
306 /*
307 * How we display the progress update (for unix)
308 */
309 int progress_fd;
310 int progress_pos;
311 int progress_last_percent;
312 unsigned int progress_last_time;
313 int interactive; /* Are we connected directly to a tty? */
314 char start_meta[2], stop_meta[2];
315
316 /* File counts */
317 int fs_directory_count;
318 int fs_regular_count;
319 int fs_blockdev_count;
320 int fs_chardev_count;
321 int fs_links_count;
322 int fs_symlinks_count;
323 int fs_fast_symlinks_count;
324 int fs_fifo_count;
325 int fs_total_count;
326 int fs_badblocks_count;
327 int fs_sockets_count;
328 int fs_ind_count;
329 int fs_dind_count;
330 int fs_tind_count;
331 int fs_fragmented;
332 int large_files;
333 int fs_ext_attr_inodes;
334 int fs_ext_attr_blocks;
335
336 int ext_attr_ver;
337
338 /*
339 * For the use of callers of the e2fsck functions; not used by
340 * e2fsck functions themselves.
341 */
342 void *priv_data;
343};
344
345/* Used by the region allocation code */
346typedef __u32 region_addr_t;
347typedef struct region_struct *region_t;
348
349/*
350 * Procedure declarations 50 * Procedure declarations
351 */ 51 */
352 52
@@ -395,6 +95,8 @@ static blk_t get_backup_sb(e2fsck_t ctx, ext2_filsys fs,
395static void e2fsck_clear_progbar(e2fsck_t ctx); 95static void e2fsck_clear_progbar(e2fsck_t ctx);
396static int e2fsck_simple_progress(e2fsck_t ctx, const char *label, 96static int e2fsck_simple_progress(e2fsck_t ctx, const char *label,
397 float percent, unsigned int dpynum); 97 float percent, unsigned int dpynum);
98
99
398/* 100/*
399 * problem.h --- e2fsck problem error codes 101 * problem.h --- e2fsck problem error codes
400 */ 102 */
@@ -1349,7 +1051,6 @@ typedef struct dict_load_t {
1349 * Pull in the definition of the e2fsck context structure 1051 * Pull in the definition of the e2fsck context structure
1350 */ 1052 */
1351 1053
1352
1353struct buffer_head { 1054struct buffer_head {
1354 char b_data[8192]; 1055 char b_data[8192];
1355 e2fsck_t b_ctx; 1056 e2fsck_t b_ctx;
@@ -1361,22 +1062,10 @@ struct buffer_head {
1361 int b_err; 1062 int b_err;
1362}; 1063};
1363 1064
1364struct inode {
1365 e2fsck_t i_ctx;
1366 ext2_ino_t i_ino;
1367 struct ext2_inode i_ext2;
1368};
1369
1370struct kdev_s {
1371 e2fsck_t k_ctx;
1372 int k_dev;
1373};
1374 1065
1375#define K_DEV_FS 1 1066#define K_DEV_FS 1
1376#define K_DEV_JOURNAL 2 1067#define K_DEV_JOURNAL 2
1377 1068
1378typedef struct kdev_s *kdev_t;
1379
1380#define lock_buffer(bh) do {} while(0) 1069#define lock_buffer(bh) do {} while(0)
1381#define unlock_buffer(bh) do {} while(0) 1070#define unlock_buffer(bh) do {} while(0)
1382#define buffer_req(bh) 1 1071#define buffer_req(bh) 1
@@ -1411,11 +1100,6 @@ static _INLINE_ void do_cache_destroy(kmem_cache_t *cache)
1411} 1100}
1412 1101
1413/* 1102/*
1414 * Now pull in the real linux/jfs.h definitions.
1415 */
1416#include "ext2fs/kernel-jbd.h"
1417
1418/*
1419 * badblocks.c --- replace/append bad blocks to the bad block inode 1103 * badblocks.c --- replace/append bad blocks to the bad block inode
1420 */ 1104 */
1421 1105
@@ -2720,11 +2404,6 @@ static void ehandler_init(io_channel channel)
2720 2404
2721#define MNT_FL (MS_MGC_VAL | MS_RDONLY) 2405#define MNT_FL (MS_MGC_VAL | MS_RDONLY)
2722 2406
2723
2724#ifdef __CONFIG_JBD_DEBUG__E2FS /* Enabled by configure --enable-jfs-debug */
2725static int bh_count = 0;
2726#endif
2727
2728/* 2407/*
2729 * Define USE_INODE_IO to use the inode_io.c / fileio.c codepaths. 2408 * Define USE_INODE_IO to use the inode_io.c / fileio.c codepaths.
2730 * This creates a larger static binary, and a smaller binary using 2409 * This creates a larger static binary, and a smaller binary using
@@ -2768,9 +2447,6 @@ static struct buffer_head *getblk(kdev_t kdev, blk_t blocknr, int blocksize)
2768 if (!bh) 2447 if (!bh)
2769 return NULL; 2448 return NULL;
2770 2449
2771 jfs_debug(4, "getblk for block %lu (%d bytes)(total %d)\n",
2772 (unsigned long) blocknr, blocksize, ++bh_count);
2773
2774 bh->b_ctx = kdev->k_ctx; 2450 bh->b_ctx = kdev->k_ctx;
2775 if (kdev->k_dev == K_DEV_FS) 2451 if (kdev->k_dev == K_DEV_FS)
2776 bh->b_io = kdev->k_ctx->fs->io; 2452 bh->b_io = kdev->k_ctx->fs->io;
@@ -2802,8 +2478,6 @@ static void ll_rw_block(int rw, int nr, struct buffer_head *bhp[])
2802 for (; nr > 0; --nr) { 2478 for (; nr > 0; --nr) {
2803 bh = *bhp++; 2479 bh = *bhp++;
2804 if (rw == READ && !bh->b_uptodate) { 2480 if (rw == READ && !bh->b_uptodate) {
2805 jfs_debug(3, "reading block %lu/%p\n",
2806 (unsigned long) bh->b_blocknr, (void *) bh);
2807 retval = io_channel_read_blk(bh->b_io, 2481 retval = io_channel_read_blk(bh->b_io,
2808 bh->b_blocknr, 2482 bh->b_blocknr,
2809 1, bh->b_data); 2483 1, bh->b_data);
@@ -2816,8 +2490,6 @@ static void ll_rw_block(int rw, int nr, struct buffer_head *bhp[])
2816 } 2490 }
2817 bh->b_uptodate = 1; 2491 bh->b_uptodate = 1;
2818 } else if (rw == WRITE && bh->b_dirty) { 2492 } else if (rw == WRITE && bh->b_dirty) {
2819 jfs_debug(3, "writing block %lu/%p\n",
2820 (unsigned long) bh->b_blocknr, (void *) bh);
2821 retval = io_channel_write_blk(bh->b_io, 2493 retval = io_channel_write_blk(bh->b_io,
2822 bh->b_blocknr, 2494 bh->b_blocknr,
2823 1, bh->b_data); 2495 1, bh->b_data);
@@ -2830,10 +2502,6 @@ static void ll_rw_block(int rw, int nr, struct buffer_head *bhp[])
2830 } 2502 }
2831 bh->b_dirty = 0; 2503 bh->b_dirty = 0;
2832 bh->b_uptodate = 1; 2504 bh->b_uptodate = 1;
2833 } else {
2834 jfs_debug(3, "no-op %s for block %lu\n",
2835 rw == READ ? "read" : "write",
2836 (unsigned long) bh->b_blocknr);
2837 } 2505 }
2838 } 2506 }
2839} 2507}
@@ -2852,8 +2520,6 @@ static void brelse(struct buffer_head *bh)
2852{ 2520{
2853 if (bh->b_dirty) 2521 if (bh->b_dirty)
2854 ll_rw_block(WRITE, 1, &bh); 2522 ll_rw_block(WRITE, 1, &bh);
2855 jfs_debug(3, "freeing block %lu/%p (total %d)\n",
2856 (unsigned long) bh->b_blocknr, (void *) bh, --bh_count);
2857 ext2fs_free_mem(&bh); 2523 ext2fs_free_mem(&bh);
2858} 2524}
2859 2525
@@ -3012,14 +2678,9 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
3012 return EXT2_ET_LOAD_EXT_JOURNAL; 2678 return EXT2_ET_LOAD_EXT_JOURNAL;
3013 } 2679 }
3014 2680
3015 jfs_debug(1, "Using journal file %s\n", journal_name);
3016 io_ptr = unix_io_manager; 2681 io_ptr = unix_io_manager;
3017 } 2682 }
3018 2683
3019#if 0
3020 test_io_backing_manager = io_ptr;
3021 io_ptr = test_io_manager;
3022#endif
3023#ifndef USE_INODE_IO 2684#ifndef USE_INODE_IO
3024 if (ext_journal) 2685 if (ext_journal)
3025#endif 2686#endif
@@ -11681,13 +11342,10 @@ static int jread(struct buffer_head **bhp, journal_t *journal,
11681 11342
11682 *bhp = NULL; 11343 *bhp = NULL;
11683 11344
11684 J_ASSERT (offset < journal->j_maxlen);
11685
11686 err = journal_bmap(journal, offset, &blocknr); 11345 err = journal_bmap(journal, offset, &blocknr);
11687 11346
11688 if (err) { 11347 if (err) {
11689 printk (KERN_ERR "JBD: bad block at offset %u\n", 11348 printf ("JBD: bad block at offset %u\n", offset);
11690 offset);
11691 return err; 11349 return err;
11692 } 11350 }
11693 11351
@@ -11704,8 +11362,7 @@ static int jread(struct buffer_head **bhp, journal_t *journal,
11704 } 11362 }
11705 11363
11706 if (!buffer_uptodate(bh)) { 11364 if (!buffer_uptodate(bh)) {
11707 printk (KERN_ERR "JBD: Failed to read block at offset %u\n", 11365 printf ("JBD: Failed to read block at offset %u\n", offset);
11708 offset);
11709 brelse(bh); 11366 brelse(bh);
11710 return -EIO; 11367 return -EIO;
11711 } 11368 }
@@ -11779,8 +11436,6 @@ int journal_recover(journal_t *journal)
11779 */ 11436 */
11780 11437
11781 if (!sb->s_start) { 11438 if (!sb->s_start) {
11782 jbd_debug(1, "No recovery required, last transaction %d\n",
11783 ntohl(sb->s_sequence));
11784 journal->j_transaction_sequence = ntohl(sb->s_sequence) + 1; 11439 journal->j_transaction_sequence = ntohl(sb->s_sequence) + 1;
11785 return 0; 11440 return 0;
11786 } 11441 }
@@ -11791,12 +11446,6 @@ int journal_recover(journal_t *journal)
11791 if (!err) 11446 if (!err)
11792 err = do_one_pass(journal, &info, PASS_REPLAY); 11447 err = do_one_pass(journal, &info, PASS_REPLAY);
11793 11448
11794 jbd_debug(0, "JBD: recovery, exit status %d, "
11795 "recovered transactions %u to %u\n",
11796 err, info.start_transaction, info.end_transaction);
11797 jbd_debug(0, "JBD: Replayed %d and revoked %d/%d blocks\n",
11798 info.nr_replays, info.nr_revoke_hits, info.nr_revokes);
11799
11800 /* Restart the log at the next transaction ID, thus invalidating 11449 /* Restart the log at the next transaction ID, thus invalidating
11801 * any existing commit records in the log. */ 11450 * any existing commit records in the log. */
11802 journal->j_transaction_sequence = ++info.end_transaction; 11451 journal->j_transaction_sequence = ++info.end_transaction;
@@ -11837,8 +11486,6 @@ static int do_one_pass(journal_t *journal,
11837 if (pass == PASS_SCAN) 11486 if (pass == PASS_SCAN)
11838 info->start_transaction = first_commit_ID; 11487 info->start_transaction = first_commit_ID;
11839 11488
11840 jbd_debug(1, "Starting recovery pass %d\n", pass);
11841
11842 /* 11489 /*
11843 * Now we walk through the log, transaction by transaction, 11490 * Now we walk through the log, transaction by transaction,
11844 * making sure that each transaction has a commit block in the 11491 * making sure that each transaction has a commit block in the
@@ -11861,14 +11508,10 @@ static int do_one_pass(journal_t *journal,
11861 if (tid_geq(next_commit_ID, info->end_transaction)) 11508 if (tid_geq(next_commit_ID, info->end_transaction))
11862 break; 11509 break;
11863 11510
11864 jbd_debug(2, "Scanning for sequence ID %u at %lu/%lu\n",
11865 next_commit_ID, next_log_block, journal->j_last);
11866
11867 /* Skip over each chunk of the transaction looking 11511 /* Skip over each chunk of the transaction looking
11868 * either the next descriptor block or the final commit 11512 * either the next descriptor block or the final commit
11869 * record. */ 11513 * record. */
11870 11514
11871 jbd_debug(3, "JBD: checking block %ld\n", next_log_block);
11872 err = jread(&bh, journal, next_log_block); 11515 err = jread(&bh, journal, next_log_block);
11873 if (err) 11516 if (err)
11874 goto failed; 11517 goto failed;
@@ -11891,8 +11534,6 @@ static int do_one_pass(journal_t *journal,
11891 11534
11892 blocktype = ntohl(tmp->h_blocktype); 11535 blocktype = ntohl(tmp->h_blocktype);
11893 sequence = ntohl(tmp->h_sequence); 11536 sequence = ntohl(tmp->h_sequence);
11894 jbd_debug(3, "Found magic %d, sequence %d\n",
11895 blocktype, sequence);
11896 11537
11897 if (sequence != next_commit_ID) { 11538 if (sequence != next_commit_ID) {
11898 brelse(bh); 11539 brelse(bh);
@@ -11935,14 +11576,12 @@ static int do_one_pass(journal_t *journal,
11935 /* Recover what we can, but 11576 /* Recover what we can, but
11936 * report failure at the end. */ 11577 * report failure at the end. */
11937 success = err; 11578 success = err;
11938 printk (KERN_ERR 11579 printf ("JBD: IO error %d recovering "
11939 "JBD: IO error %d recovering "
11940 "block %ld in log\n", 11580 "block %ld in log\n",
11941 err, io_block); 11581 err, io_block);
11942 } else { 11582 } else {
11943 unsigned long blocknr; 11583 unsigned long blocknr;
11944 11584
11945 J_ASSERT(obh != NULL);
11946 blocknr = ntohl(tag->t_blocknr); 11585 blocknr = ntohl(tag->t_blocknr);
11947 11586
11948 /* If the block has been 11587 /* If the block has been
@@ -11962,8 +11601,7 @@ static int do_one_pass(journal_t *journal,
11962 blocknr, 11601 blocknr,
11963 journal->j_blocksize); 11602 journal->j_blocksize);
11964 if (nbh == NULL) { 11603 if (nbh == NULL) {
11965 printk(KERN_ERR 11604 printf ("JBD: Out of memory "
11966 "JBD: Out of memory "
11967 "during recovery.\n"); 11605 "during recovery.\n");
11968 err = -ENOMEM; 11606 err = -ENOMEM;
11969 brelse(bh); 11607 brelse(bh);
@@ -11979,10 +11617,8 @@ static int do_one_pass(journal_t *journal,
11979 htonl(JFS_MAGIC_NUMBER); 11617 htonl(JFS_MAGIC_NUMBER);
11980 } 11618 }
11981 11619
11982 BUFFER_TRACE(nbh, "marking dirty");
11983 mark_buffer_uptodate(nbh, 1); 11620 mark_buffer_uptodate(nbh, 1);
11984 mark_buffer_dirty(nbh); 11621 mark_buffer_dirty(nbh);
11985 BUFFER_TRACE(nbh, "marking uptodate");
11986 ++info->nr_replays; 11622 ++info->nr_replays;
11987 /* ll_rw_block(WRITE, 1, &nbh); */ 11623 /* ll_rw_block(WRITE, 1, &nbh); */
11988 unlock_buffer(nbh); 11624 unlock_buffer(nbh);
@@ -12026,8 +11662,6 @@ static int do_one_pass(journal_t *journal,
12026 continue; 11662 continue;
12027 11663
12028 default: 11664 default:
12029 jbd_debug(3, "Unrecognised magic %d, end of scan.\n",
12030 blocktype);
12031 goto done; 11665 goto done;
12032 } 11666 }
12033 } 11667 }
@@ -12046,7 +11680,7 @@ static int do_one_pass(journal_t *journal,
12046 /* It's really bad news if different passes end up at 11680 /* It's really bad news if different passes end up at
12047 * different places (but possible due to IO errors). */ 11681 * different places (but possible due to IO errors). */
12048 if (info->end_transaction != next_commit_ID) { 11682 if (info->end_transaction != next_commit_ID) {
12049 printk (KERN_ERR "JBD: recovery pass %d ended at " 11683 printf ("JBD: recovery pass %d ended at "
12050 "transaction %u, expected %u\n", 11684 "transaction %u, expected %u\n",
12051 pass, next_commit_ID, info->end_transaction); 11685 pass, next_commit_ID, info->end_transaction);
12052 if (!success) 11686 if (!success)
@@ -13067,15 +12701,11 @@ int journal_init_revoke(journal_t *journal, int hash_size)
13067{ 12701{
13068 int shift, tmp; 12702 int shift, tmp;
13069 12703
13070 J_ASSERT (journal->j_revoke == NULL);
13071
13072 journal->j_revoke = kmem_cache_alloc(revoke_table_cache, GFP_KERNEL); 12704 journal->j_revoke = kmem_cache_alloc(revoke_table_cache, GFP_KERNEL);
13073 if (!journal->j_revoke) 12705 if (!journal->j_revoke)
13074 return -ENOMEM; 12706 return -ENOMEM;
13075 12707
13076 /* Check that the hash_size is a power of two */ 12708 /* Check that the hash_size is a power of two */
13077 J_ASSERT ((hash_size & (hash_size-1)) == 0);
13078
13079 journal->j_revoke->hash_size = hash_size; 12709 journal->j_revoke->hash_size = hash_size;
13080 12710
13081 shift = 0; 12711 shift = 0;
@@ -13111,7 +12741,6 @@ void journal_destroy_revoke(journal_t *journal)
13111 12741
13112 for (i=0; i<table->hash_size; i++) { 12742 for (i=0; i<table->hash_size; i++) {
13113 hash_list = &table->hash_table[i]; 12743 hash_list = &table->hash_table[i];
13114 J_ASSERT (list_empty(hash_list));
13115 } 12744 }
13116 12745
13117 free(table->hash_table); 12746 free(table->hash_table);
@@ -14158,15 +13787,6 @@ static void swap_filesys(e2fsck_t ctx)
14158 * util.c --- miscellaneous utilities 13787 * util.c --- miscellaneous utilities
14159 */ 13788 */
14160 13789
14161#ifdef HAVE_CONIO_H
14162#undef HAVE_TERMIOS_H
14163#include <conio.h>
14164#define read_a_char() getch()
14165#else
14166#ifdef HAVE_TERMIOS_H
14167#include <termios.h>
14168#endif
14169#endif
14170 13790
14171#if 0 13791#if 0
14172void fatal_error(e2fsck_t ctx, const char *msg) 13792void fatal_error(e2fsck_t ctx, const char *msg)