xref: /openbmc/linux/Documentation/filesystems/ext4/bitmaps.rst (revision 8a98ec7c7b3901330a036af0f62f523c31d763da)
1*8a98ec7cSDarrick J. Wong.. SPDX-License-Identifier: GPL-2.0
2*8a98ec7cSDarrick J. Wong
3*8a98ec7cSDarrick J. WongBlock and inode Bitmaps
4*8a98ec7cSDarrick J. Wong-----------------------
5*8a98ec7cSDarrick J. Wong
6*8a98ec7cSDarrick J. WongThe data block bitmap tracks the usage of data blocks within the block
7*8a98ec7cSDarrick J. Wonggroup.
8*8a98ec7cSDarrick J. Wong
9*8a98ec7cSDarrick J. WongThe inode bitmap records which entries in the inode table are in use.
10*8a98ec7cSDarrick J. Wong
11*8a98ec7cSDarrick J. WongAs with most bitmaps, one bit represents the usage status of one data
12*8a98ec7cSDarrick J. Wongblock or inode table entry. This implies a block group size of 8 \*
13*8a98ec7cSDarrick J. Wongnumber\_of\_bytes\_in\_a\_logical\_block.
14*8a98ec7cSDarrick J. Wong
15*8a98ec7cSDarrick J. WongNOTE: If ``BLOCK_UNINIT`` is set for a given block group, various parts
16*8a98ec7cSDarrick J. Wongof the kernel and e2fsprogs code pretends that the block bitmap contains
17*8a98ec7cSDarrick J. Wongzeros (i.e. all blocks in the group are free). However, it is not
18*8a98ec7cSDarrick J. Wongnecessarily the case that no blocks are in use -- if ``meta_bg`` is set,
19*8a98ec7cSDarrick J. Wongthe bitmaps and group descriptor live inside the group. Unfortunately,
20*8a98ec7cSDarrick J. Wongext2fs\_test\_block\_bitmap2() will return '0' for those locations,
21*8a98ec7cSDarrick J. Wongwhich produces confusing debugfs output.
22*8a98ec7cSDarrick J. Wong
23*8a98ec7cSDarrick J. WongInode Table
24*8a98ec7cSDarrick J. Wong-----------
25*8a98ec7cSDarrick J. WongInode tables are statically allocated at mkfs time.  Each block group
26*8a98ec7cSDarrick J. Wongdescriptor points to the start of the table, and the superblock records
27*8a98ec7cSDarrick J. Wongthe number of inodes per group.  See the section on inodes for more
28*8a98ec7cSDarrick J. Wonginformation.
29