add patch improve-code-readability-in-ext4_iget
[ext4-patch-queue.git] / import-bitmaps-chapter-from-wiki-page
blob7b105efc50c3089091627b4eef991ece0a18a2c6
1 ext4: import bitmaps chapter from wiki page
3 From: Darrick J. Wong <darrick.wong@oracle.com>
5 Import the chapter about bitmaps from the on-disk format wiki
6 page into the kernel documentation.
8 Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
9 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 ---
11  Documentation/filesystems/ext4/ondisk/bitmaps.rst |   28 +++++++++++++++++++++
12  Documentation/filesystems/ext4/ondisk/globals.rst |    1 +
13  2 files changed, 29 insertions(+)
14  create mode 100644 Documentation/filesystems/ext4/ondisk/bitmaps.rst
17 diff --git a/Documentation/filesystems/ext4/ondisk/bitmaps.rst b/Documentation/filesystems/ext4/ondisk/bitmaps.rst
18 new file mode 100644
19 index 000000000000..c7546dbc197a
20 --- /dev/null
21 +++ b/Documentation/filesystems/ext4/ondisk/bitmaps.rst
22 @@ -0,0 +1,28 @@
23 +.. SPDX-License-Identifier: GPL-2.0
25 +Block and inode Bitmaps
26 +-----------------------
28 +The data block bitmap tracks the usage of data blocks within the block
29 +group.
31 +The inode bitmap records which entries in the inode table are in use.
33 +As with most bitmaps, one bit represents the usage status of one data
34 +block or inode table entry. This implies a block group size of 8 \*
35 +number\_of\_bytes\_in\_a\_logical\_block.
37 +NOTE: If ``BLOCK_UNINIT`` is set for a given block group, various parts
38 +of the kernel and e2fsprogs code pretends that the block bitmap contains
39 +zeros (i.e. all blocks in the group are free). However, it is not
40 +necessarily the case that no blocks are in use -- if ``meta_bg`` is set,
41 +the bitmaps and group descriptor live inside the group. Unfortunately,
42 +ext2fs\_test\_block\_bitmap2() will return '0' for those locations,
43 +which produces confusing debugfs output.
45 +Inode Table
46 +-----------
47 +Inode tables are statically allocated at mkfs time.  Each block group
48 +descriptor points to the start of the table, and the superblock records
49 +the number of inodes per group.  See the section on inodes for more
50 +information.
51 diff --git a/Documentation/filesystems/ext4/ondisk/globals.rst b/Documentation/filesystems/ext4/ondisk/globals.rst
52 index c0dea6297e7f..5891ee137749 100644
53 --- a/Documentation/filesystems/ext4/ondisk/globals.rst
54 +++ b/Documentation/filesystems/ext4/ondisk/globals.rst
55 @@ -8,3 +8,4 @@ have static metadata at fixed locations.
57  .. include:: super.rst
58  .. include:: group_descr.rst
59 +.. include:: bitmaps.rst