xref: /OK3568_Linux_fs/kernel/Documentation/filesystems/ext4/bitmaps.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunBlock and inode Bitmaps
4*4882a593Smuzhiyun-----------------------
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunThe data block bitmap tracks the usage of data blocks within the block
7*4882a593Smuzhiyungroup.
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunThe inode bitmap records which entries in the inode table are in use.
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunAs with most bitmaps, one bit represents the usage status of one data
12*4882a593Smuzhiyunblock or inode table entry. This implies a block group size of 8 \*
13*4882a593Smuzhiyunnumber\_of\_bytes\_in\_a\_logical\_block.
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunNOTE: If ``BLOCK_UNINIT`` is set for a given block group, various parts
16*4882a593Smuzhiyunof the kernel and e2fsprogs code pretends that the block bitmap contains
17*4882a593Smuzhiyunzeros (i.e. all blocks in the group are free). However, it is not
18*4882a593Smuzhiyunnecessarily the case that no blocks are in use -- if ``meta_bg`` is set,
19*4882a593Smuzhiyunthe bitmaps and group descriptor live inside the group. Unfortunately,
20*4882a593Smuzhiyunext2fs\_test\_block\_bitmap2() will return '0' for those locations,
21*4882a593Smuzhiyunwhich produces confusing debugfs output.
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunInode Table
24*4882a593Smuzhiyun-----------
25*4882a593SmuzhiyunInode tables are statically allocated at mkfs time.  Each block group
26*4882a593Smuzhiyundescriptor points to the start of the table, and the superblock records
27*4882a593Smuzhiyunthe number of inodes per group.  See the section on inodes for more
28*4882a593Smuzhiyuninformation.
29