Documentation/filesystems/ext4/super.rst

Source file repositories/reference/linux-study-clean/Documentation/filesystems/ext4/super.rst

File Facts

System
Linux kernel
Corpus path
Documentation/filesystems/ext4/super.rst
Extension
.rst
Size
23789 bytes
Lines
842
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

.. SPDX-License-Identifier: GPL-2.0

Super Block
-----------

The superblock records various information about the enclosing
filesystem, such as block counts, inode counts, supported features,
maintenance information, and more.

If the sparse_super feature flag is set, redundant copies of the
superblock and group descriptors are kept only in the groups whose group
number is either 0 or a power of 3, 5, or 7. If the flag is not set,
redundant copies are kept in all groups.

The superblock checksum is calculated against the superblock structure,
which includes the FS UUID.

The ext4 superblock is laid out as follows in
``struct ext4_super_block``:

.. list-table::
   :widths: 8 8 24 40
   :header-rows: 1

   * - Offset
     - Size
     - Name
     - Description
   * - 0x0
     - __le32
     - s_inodes_count
     - Total inode count.
   * - 0x4
     - __le32
     - s_blocks_count_lo
     - Total block count.
   * - 0x8
     - __le32
     - s_r_blocks_count_lo
     - This number of blocks can only be allocated by the super-user.
   * - 0xC
     - __le32
     - s_free_blocks_count_lo
     - Free block count.
   * - 0x10
     - __le32
     - s_free_inodes_count
     - Free inode count.
   * - 0x14
     - __le32
     - s_first_data_block
     - First data block. This must be at least 1 for 1k-block filesystems and
       is typically 0 for all other block sizes.
   * - 0x18
     - __le32
     - s_log_block_size
     - Block size is 2 ^ (10 + s_log_block_size).
   * - 0x1C
     - __le32
     - s_log_cluster_size
     - Cluster size is 2 ^ (10 + s_log_cluster_size) blocks if bigalloc is
       enabled. Otherwise s_log_cluster_size must equal s_log_block_size.
   * - 0x20
     - __le32
     - s_blocks_per_group
     - Blocks per group.
   * - 0x24
     - __le32
     - s_clusters_per_group
     - Clusters per group, if bigalloc is enabled. Otherwise

Annotation

Implementation Notes