MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / ext4_init_inode_bitmap

Function ext4_init_inode_bitmap

Ext4Fsd/ext3/generic.c:2665–2691  ·  view source on GitHub ↗

Initializes an uninitialized inode bitmap */

Source from the content-addressed store, hash-verified

2663
2664/* Initializes an uninitialized inode bitmap */
2665unsigned ext4_init_inode_bitmap(struct super_block *sb, struct buffer_head *bh,
2666 ext4_group_t block_group,
2667 struct ext4_group_desc *gdp)
2668{
2669 struct ext4_sb_info *sbi = EXT4_SB(sb);
2670
2671 mark_buffer_dirty(bh);
2672
2673 /* If checksum is bad mark all blocks and inodes use to prevent
2674 * allocation, essentially implementing a per-group read-only flag. */
2675 if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) {
2676 ext4_error(sb, __FUNCTION__, "Checksum bad for group %u",
2677 block_group);
2678 ext4_free_blks_set(sb, gdp, 0);
2679 ext4_free_inodes_set(sb, gdp, 0);
2680 ext4_itable_unused_set(sb, gdp, 0);
2681 memset(bh->b_data, 0xff, sb->s_blocksize);
2682 return 0;
2683 }
2684
2685 memset(bh->b_data, 0, (EXT4_INODES_PER_GROUP(sb) + 7) / 8);
2686 mark_bitmap_end(EXT4_INODES_PER_GROUP(sb), sb->s_blocksize * 8,
2687 bh->b_data);
2688 ext4_itable_unused_set(sb, gdp, EXT4_INODES_PER_GROUP(sb));
2689
2690 return EXT4_INODES_PER_GROUP(sb);
2691}
2692
2693/*
2694 * Calculate the block group number and offset, given a block number

Callers 1

Ext2NewInodeFunction · 0.85

Calls 7

EXT4_SBFunction · 0.85
mark_buffer_dirtyFunction · 0.85
ext4_free_blks_setFunction · 0.85
ext4_free_inodes_setFunction · 0.85
ext4_itable_unused_setFunction · 0.85
mark_bitmap_endFunction · 0.85

Tested by

no test coverage detected