1 /* vi: set sw=4 ts=4: */
3 * alloc_stats.c --- Update allocation statistics for ext2fs
5 * Copyright (C) 2001 Theodore Ts'o.
8 * This file may be redistributed under the terms of the GNU Public
19 void ext2fs_inode_alloc_stats2(ext2_filsys fs, ext2_ino_t ino,
22 int group = ext2fs_group_of_ino(fs, ino);
25 ext2fs_mark_inode_bitmap(fs->inode_map, ino);
27 ext2fs_unmark_inode_bitmap(fs->inode_map, ino);
28 fs->group_desc[group].bg_free_inodes_count -= inuse;
30 fs->group_desc[group].bg_used_dirs_count += inuse;
31 fs->super->s_free_inodes_count -= inuse;
32 ext2fs_mark_super_dirty(fs);
33 ext2fs_mark_ib_dirty(fs);
36 void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse)
38 ext2fs_inode_alloc_stats2(fs, ino, inuse, 0);
41 void ext2fs_block_alloc_stats(ext2_filsys fs, blk_t blk, int inuse)
43 int group = ext2fs_group_of_blk(fs, blk);
46 ext2fs_mark_block_bitmap(fs->block_map, blk);
48 ext2fs_unmark_block_bitmap(fs->block_map, blk);
49 fs->group_desc[group].bg_free_blocks_count -= inuse;
50 fs->super->s_free_blocks_count -= inuse;
51 ext2fs_mark_super_dirty(fs);
52 ext2fs_mark_bb_dirty(fs);