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.
2002-01-03 11:29:19 +03:00
|
|
|
/*
|
|
|
|
* 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"
|
|
|
|
|
2002-02-03 09:28:52 +03:00
|
|
|
void ext2fs_inode_alloc_stats2(ext2_filsys fs, ext2_ino_t ino,
|
|
|
|
int inuse, int isdir)
|
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.
2002-01-03 11:29:19 +03:00
|
|
|
{
|
|
|
|
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;
|
2002-02-03 09:28:52 +03:00
|
|
|
if (isdir)
|
|
|
|
fs->group_desc[group].bg_used_dirs_count += inuse;
|
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.
2002-01-03 11:29:19 +03:00
|
|
|
fs->super->s_free_inodes_count -= inuse;
|
|
|
|
ext2fs_mark_super_dirty(fs);
|
|
|
|
ext2fs_mark_ib_dirty(fs);
|
|
|
|
}
|
|
|
|
|
2002-02-03 09:28:52 +03:00
|
|
|
void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse)
|
|
|
|
{
|
|
|
|
ext2fs_inode_alloc_stats2(fs, ino, inuse, 0);
|
|
|
|
}
|
|
|
|
|
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.
2002-01-03 11:29:19 +03:00
|
|
|
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);
|
|
|
|
}
|