Exemple #1
0
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 += gdp->bg_free_inodes_count;
      bh = disk_cache_block_ref (gdp->bg_inode_bitmap);
      x = count_free (bh, sblock->s_inodes_per_group / 8);
      disk_cache_block_deref (bh);
      if (gdp->bg_free_inodes_count != x)
	ext2_error ("wrong free inodes count in group %d, "
		    "stored = %d, counted = %lu",
		    i, gdp->bg_free_inodes_count, x);
      bitmap_count += x;
    }
  if (sblock->s_free_inodes_count != bitmap_count)
    ext2_error ("wrong free inodes count in super block, "
		"stored = %lu, counted = %lu",
		(unsigned long) sblock->s_free_inodes_count, bitmap_count);

  pthread_spin_unlock (&global_lock);
}
unsigned long minix_count_free_inodes(struct super_block *sb)
{
	struct minix_sb_info *sbi = minix_sb(sb);
	u32 bits = sbi->s_ninodes + 1;

	return count_free(sbi->s_imap, sb->s_blocksize, bits);
}
Exemple #3
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 += gdp->bg_free_inodes_count;
      bh = disk_cache_block_ref (gdp->bg_inode_bitmap);
      x = count_free (bh, sblock->s_inodes_per_group / 8);
      disk_cache_block_deref (bh);
      ext2_debug ("group %d: stored = %d, counted = %lu",
		  i, gdp->bg_free_inodes_count, x);
      bitmap_count += x;
    }
  ext2_debug ("stored = %u, computed = %lu, %lu",
	      sblock->s_free_inodes_count, desc_count, bitmap_count);
  pthread_spin_unlock (&global_lock);
  return desc_count;
#else
  return sblock->s_free_inodes_count;
#endif
}
unsigned long minix_count_free_blocks(struct super_block *sb)
{
	struct minix_sb_info *sbi = minix_sb(sb);
	u32 bits = sbi->s_nzones - (sbi->s_firstdatazone + 1);

	return (count_free(sbi->s_zmap, sb->s_blocksize, bits)
		<< sbi->s_log_zone_size);
}
Exemple #5
0
unsigned long
minixfs_count_free_inodes ()
{
  unsigned long bitmap_count;

  /*spin_lock (&global_lock);*/

  bitmap_count = count_free (bptr (I_MAP_BOFFS),
			     sblock->s_imap_blocks << log2_block_size);

  /*spin_unlock (&global_lock);*/

  return bitmap_count;
}
Exemple #6
0
unsigned long minix_count_free_blocks(struct minix_sb_info *sbi) {
    u32 bits = sbi->s_nzones - sbi->s_firstdatazone + 1;
    return (count_free(sbi->s_zmap,sbi->s_blocksize,bits) 
            << sbi->s_log_zone_size);
}
Exemple #7
0
/**
 * wufs_count_free_blocks: (utility function)
 * Count the number of zeros in the block bitmap.
 * We start at bit zero.
 */
unsigned long wufs_count_free_blocks(struct wufs_sb_info *sbi)
{
  /* count the number of bits that are zero in the bmap */
  return count_free(sbi->sbi_bmap, sbi->sbi_bmap_bcnt);
}
Exemple #8
0
/**
 * wufs_count_free_inodes: (utility function)
 * Count the number of zeros in the inode bitmap.
 * We start at bit index 0 (corresponding to inode 1).
 */
unsigned long wufs_count_free_inodes(struct wufs_sb_info *sbi)
{
  return count_free(sbi->sbi_imap, sbi->sbi_imap_bcnt);
}