xref: /openbmc/linux/Documentation/filesystems/ext4/bitmaps.rst (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
18a98ec7cSDarrick J. Wong.. SPDX-License-Identifier: GPL-2.0
28a98ec7cSDarrick J. Wong
38a98ec7cSDarrick J. WongBlock and inode Bitmaps
48a98ec7cSDarrick J. Wong-----------------------
58a98ec7cSDarrick J. Wong
68a98ec7cSDarrick J. WongThe data block bitmap tracks the usage of data blocks within the block
78a98ec7cSDarrick J. Wonggroup.
88a98ec7cSDarrick J. Wong
98a98ec7cSDarrick J. WongThe inode bitmap records which entries in the inode table are in use.
108a98ec7cSDarrick J. Wong
118a98ec7cSDarrick J. WongAs with most bitmaps, one bit represents the usage status of one data
12*3103084aSWang Jianjianblock or inode table entry. This implies a block group size of 8 *
13*3103084aSWang Jianjiannumber_of_bytes_in_a_logical_block.
148a98ec7cSDarrick J. Wong
158a98ec7cSDarrick J. WongNOTE: If ``BLOCK_UNINIT`` is set for a given block group, various parts
168a98ec7cSDarrick J. Wongof the kernel and e2fsprogs code pretends that the block bitmap contains
178a98ec7cSDarrick J. Wongzeros (i.e. all blocks in the group are free). However, it is not
188a98ec7cSDarrick J. Wongnecessarily the case that no blocks are in use -- if ``meta_bg`` is set,
198a98ec7cSDarrick J. Wongthe bitmaps and group descriptor live inside the group. Unfortunately,
20*3103084aSWang Jianjianext2fs_test_block_bitmap2() will return '0' for those locations,
218a98ec7cSDarrick J. Wongwhich produces confusing debugfs output.
228a98ec7cSDarrick J. Wong
238a98ec7cSDarrick J. WongInode Table
248a98ec7cSDarrick J. Wong-----------
258a98ec7cSDarrick J. WongInode tables are statically allocated at mkfs time.  Each block group
268a98ec7cSDarrick J. Wongdescriptor points to the start of the table, and the superblock records
278a98ec7cSDarrick J. Wongthe number of inodes per group.  See the section on inodes for more
288a98ec7cSDarrick J. Wonginformation.
29