Maybe yes, for debug purposes Le dim. 23 janv. 2022 à 10:48, Samuel Thibault <samuel.thiba...@gnu.org> a écrit :
> They might still be useful some day? > > Etienne Brateau, le dim. 23 janv. 2022 05:17:15 +0100, a ecrit: > > --- > > ext2fs/ialloc.c | 72 ------------------------------------------------- > > 1 file changed, 72 deletions(-) > > > > diff --git a/ext2fs/ialloc.c b/ext2fs/ialloc.c > > index 568d7eae..e1a09a82 100644 > > --- a/ext2fs/ialloc.c > > +++ b/ext2fs/ialloc.c > > @@ -344,75 +344,3 @@ diskfs_alloc_node (struct node *dir, mode_t mode, > struct node **node) > > *node = np; > > return 0; > > } > > - > > -/* ---------------------------------------------------------------- */ > > - > > -unsigned long > > -ext2_count_free_inodes () > > -{ > > -#ifdef EXT2FS_DEBUG > > - unsigned long desc_count, bitmap_count, x; > > - struct ext2_group_desc *gdp; > > - int i; > > - > > - pthread_spin_lock (&global_lock); > > - > > - desc_count = 0; > > - bitmap_count = 0; > > - gdp = NULL; > > - for (i = 0; i < groups_count; i++) > > - { > > - void *bh; > > - gdp = group_desc (i); > > - desc_count += le16toh (gdp->bg_free_inodes_count); > > - bh = disk_cache_block_ref (le32toh (gdp->bg_inode_bitmap)); > > - x = count_free (bh, le32toh (sblock->s_inodes_per_group) / 8); > > - disk_cache_block_deref (bh); > > - ext2_debug ("group %d: stored = %d, counted = %lu", > > - i, le16toh (gdp->bg_free_inodes_count), x); > > - bitmap_count += x; > > - } > > - ext2_debug ("stored = %u, computed = %lu, %lu", > > - le32toh (sblock->s_free_inodes_count), desc_count, > bitmap_count); > > - pthread_spin_unlock (&global_lock); > > - return desc_count; > > -#else > > - return le32toh (sblock->s_free_inodes_count); > > -#endif > > -} > > - > > -/* ---------------------------------------------------------------- */ > > - > > -void > > -ext2_check_inodes_bitmap () > > -{ > > - int i; > > - struct ext2_group_desc *gdp; > > - unsigned long desc_count, bitmap_count, x; > > - > > - pthread_spin_lock (&global_lock); > > - > > - desc_count = 0; > > - bitmap_count = 0; > > - gdp = NULL; > > - for (i = 0; i < groups_count; i++) > > - { > > - void *bh; > > - gdp = group_desc (i); > > - desc_count += le16toh (gdp->bg_free_inodes_count); > > - bh = disk_cache_block_ref (le32toh (gdp->bg_inode_bitmap)); > > - x = count_free (bh, le32toh (sblock->s_inodes_per_group) / 8); > > - disk_cache_block_deref (bh); > > - if (le16toh (gdp->bg_free_inodes_count) != x) > > - ext2_error ("wrong free inodes count in group %d, " > > - "stored = %d, counted = %lu", > > - i, le16toh (gdp->bg_free_inodes_count), x); > > - bitmap_count += x; > > - } > > - if (le32toh (sblock->s_free_inodes_count) != bitmap_count) > > - ext2_error ("wrong free inodes count in super block, " > > - "stored = %lu, counted = %lu", > > - (unsigned long) le32toh (sblock->s_free_inodes_count), > bitmap_count); > > - > > - pthread_spin_unlock (&global_lock); > > -} > > -- > > 2.34.1 >