diff options
author | Theodore Ts'o <tytso@mit.edu> | 2002-01-03 03:29:19 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2002-01-03 03:29:19 -0500 |
commit | 8bd0c95908baa3af706b9e731daff9472bec74c9 (patch) | |
tree | a98b28dc42ee8981ea33b057d63c277b96babe84 /lib/ext2fs/alloc_stats.c | |
parent | 5493a27dc1138d2e30193b80217a0127d247af1e (diff) | |
download | android_external_e2fsprogs-8bd0c95908baa3af706b9e731daff9472bec74c9.tar.gz android_external_e2fsprogs-8bd0c95908baa3af706b9e731daff9472bec74c9.tar.bz2 android_external_e2fsprogs-8bd0c95908baa3af706b9e731daff9472bec74c9.zip |
dir_iterate.c (ext2fs_dir_iterate2, ext2fs_process_dir_block):
Add support for a new flag, DIRENT_FLAG_INCLUDE_REMOVED,
which will return deleted directory entries.
ext2fs_dir_iterate2 takes a new callback function which
is identical with the one used by
ext2fs_dblist_dir_iterate(). If the directory entry is
deleted, the callback function will be called with the
entry paraemter set to DIRENT_DELETED_FILE.
Makefile.in, alloc_stats.c (ext2fs_inode_alloc_stats,
ext2fs_block_alloc_stats): New functions which update
block/inode allocation statistics in the bitmaps, block
group descriptors, and superblock.
mkjournal.c (mkjournal_proc), mkdir.c (ext2fs_mkdir),
expanddir.c (expand_dir_proc), bb_inode.c
(clear_bad_block_proc, set_bad_block_proc,
ext2fs_update_bb_inode), alloc.c (ext2fs_alloc_block):
Update to use new block/inode allocation statistics.
Diffstat (limited to 'lib/ext2fs/alloc_stats.c')
-rw-r--r-- | lib/ext2fs/alloc_stats.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/ext2fs/alloc_stats.c b/lib/ext2fs/alloc_stats.c new file mode 100644 index 00000000..986f459f --- /dev/null +++ b/lib/ext2fs/alloc_stats.c @@ -0,0 +1,44 @@ +/* + * alloc_stats.c --- Update allocation statistics for ext2fs + * + * Copyright (C) 2001 Theodore Ts'o. + * + * %Begin-Header% + * This file may be redistributed under the terms of the GNU Public + * License. + * %End-Header% + * + */ + +#include <stdio.h> + +#include "ext2_fs.h" +#include "ext2fs.h" + +void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse) +{ + int group = ext2fs_group_of_ino(fs, ino); + + if (inuse > 0) + ext2fs_mark_inode_bitmap(fs->inode_map, ino); + else + ext2fs_unmark_inode_bitmap(fs->inode_map, ino); + fs->group_desc[group].bg_free_inodes_count -= inuse; + fs->super->s_free_inodes_count -= inuse; + ext2fs_mark_super_dirty(fs); + ext2fs_mark_ib_dirty(fs); +} + +void ext2fs_block_alloc_stats(ext2_filsys fs, blk_t blk, int inuse) +{ + int group = ext2fs_group_of_blk(fs, blk); + + if (inuse > 0) + ext2fs_mark_block_bitmap(fs->block_map, blk); + else + ext2fs_unmark_block_bitmap(fs->block_map, blk); + fs->group_desc[group].bg_free_blocks_count -= inuse; + fs->super->s_free_blocks_count -= inuse; + ext2fs_mark_super_dirty(fs); + ext2fs_mark_bb_dirty(fs); +} |