Files
reiserfsprogs/fsck/pass4.c
T
Jeff Mahoney c1ff1d5d2d cleanup: rename key and item_head accessors to more friendly names
This patch does a quick search and replace:
B_N_PITEM_HEAD() -> item_head()
B_N_PDELIM_KEY() -> internal_key()
B_N_PKEY() -> leaf_key()
B_N_PITEM() -> item_body()

And the item_head version:
B_I_PITEM() -> ih_item_body()
I_ENTRY_COUNT() -> ih_entry_count()

And the treepath variants:
get_ih() -> tp_item_head()
PATH_PITEM_HEAD() -> tp_item_head()
get_item() -> tp_item_body()

... which makes the code much easier on the eyes.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
2013-08-26 17:15:33 -04:00

92 lines
1.9 KiB
C

/*
* Copyright 1996-2004 by Hans Reiser, licensing governed by
* reiserfsprogs/README
*/
#include "fsck.h"
void pass_4_check_unaccessed_items(void)
{
struct reiserfs_key key;
struct reiserfs_path path;
int i;
struct buffer_head *bh;
struct item_head *ih;
unsigned long items;
struct reiserfs_key *rdkey;
path.path_length = ILLEGAL_PATH_ELEMENT_OFFSET;
key = root_dir_key;
fsck_progress("Pass 4 - ");
items = 0;
while (reiserfs_search_by_key_4(fs, &key, &path) == ITEM_FOUND) {
bh = PATH_PLAST_BUFFER(&path);
/* print ~ how many leaves were scanned and how fast it was */
if (!fsck_quiet(fs))
print_how_fast(items++, 0, 50, 0);
for (i = get_item_pos(&path), ih = tp_item_head(&path);
i < B_NR_ITEMS(bh); i++, ih++) {
if (!is_item_reachable(ih)) {
PATH_LAST_POSITION(&path) = i;
rdkey = reiserfs_next_key(&path);
if (rdkey)
key = *rdkey;
else
memset(&key, 0xff, KEY_SIZE);
pass_4_stat(fs)->deleted_items++;
reiserfsck_delete_item(&path, 0);
goto cont;
}
if (get_ih_flags(ih) != 0) {
clean_ih_flags(ih);
mark_buffer_dirty(bh);
}
}
PATH_LAST_POSITION(&path) = i - 1;
rdkey = reiserfs_next_key(&path);
if (rdkey)
key = *rdkey;
else
memset(&key, 0xff, KEY_SIZE);
pathrelse(&path);
cont:
/* to make gcc 3.2 do not sware here */ ;
}
pathrelse(&path);
fsck_progress("finished\n");
stage_report(4, fs);
/* after pass 4 */
/* put bitmap on place */
reiserfs_bitmap_copy(fs->fs_bitmap2, fsck_new_bitmap(fs));
/* update super block */
set_sb_free_blocks(fs->fs_ondisk_sb,
reiserfs_bitmap_zeros(fsck_new_bitmap(fs)));
mark_buffer_dirty(fs->fs_super_bh);
/* write all dirty blocks */
fsck_progress("Flushing..");
fs->fs_dirt = 1;
id_map_flush(proper_id_map(fs), fs);
reiserfs_flush_to_ondisk_bitmap(fs->fs_bitmap2, fs);
reiserfs_flush(fs);
fsck_progress("finished\n");
return;
}