Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) .. SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) Index Nodes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) In a regular UNIX filesystem, the inode stores all the metadata
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) pertaining to the file (time stamps, block maps, extended attributes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) etc), not the directory entry. To find the information associated with a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) file, one must traverse the directory files to find the directory entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) associated with a file, then load the inode to find the metadata for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) that file. ext4 appears to cheat (for performance reasons) a little bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) by storing a copy of the file type (normally stored in the inode) in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) directory entry. (Compare all this to FAT, which stores all the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) information directly in the directory entry, but does not support hard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) links and is in general more seek-happy than ext4 due to its simpler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) block allocator and extensive use of linked lists.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) The inode table is a linear array of ``struct ext4_inode``. The table is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) sized to have enough blocks to store at least
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) ``sb.s_inode_size * sb.s_inodes_per_group`` bytes. The number of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) block group containing an inode can be calculated as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) ``(inode_number - 1) / sb.s_inodes_per_group``, and the offset into the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) group's table is ``(inode_number - 1) % sb.s_inodes_per_group``. There
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) is no inode 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) The inode checksum is calculated against the FS UUID, the inode number,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) and the inode structure itself.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) The inode table entry is laid out in ``struct ext4_inode``.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) .. list-table::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)    :widths: 8 8 24 40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)    :header-rows: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)    :class: longtable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)    * - Offset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)      - Size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)      - Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)      - Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)    * - 0x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)      - \_\_le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)      - i\_mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)      - File mode. See the table i_mode_ below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)    * - 0x2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)      - \_\_le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)      - i\_uid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)      - Lower 16-bits of Owner UID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)    * - 0x4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)      - i\_size\_lo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)      - Lower 32-bits of size in bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)    * - 0x8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)      - i\_atime
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)      - Last access time, in seconds since the epoch. However, if the EA\_INODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)        inode flag is set, this inode stores an extended attribute value and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)        this field contains the checksum of the value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)    * - 0xC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)      - i\_ctime
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)      - Last inode change time, in seconds since the epoch. However, if the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)        EA\_INODE inode flag is set, this inode stores an extended attribute
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)        value and this field contains the lower 32 bits of the attribute value's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)        reference count.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)    * - 0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)      - i\_mtime
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)      - Last data modification time, in seconds since the epoch. However, if the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)        EA\_INODE inode flag is set, this inode stores an extended attribute
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)        value and this field contains the number of the inode that owns the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)        extended attribute.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)    * - 0x14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)      - i\_dtime
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)      - Deletion Time, in seconds since the epoch.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)    * - 0x18
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)      - \_\_le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)      - i\_gid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)      - Lower 16-bits of GID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)    * - 0x1A
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)      - \_\_le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)      - i\_links\_count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)      - Hard link count. Normally, ext4 does not permit an inode to have more
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)        than 65,000 hard links. This applies to files as well as directories,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)        which means that there cannot be more than 64,998 subdirectories in a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)        directory (each subdirectory's '..' entry counts as a hard link, as does
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)        the '.' entry in the directory itself). With the DIR\_NLINK feature
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)        enabled, ext4 supports more than 64,998 subdirectories by setting this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)        field to 1 to indicate that the number of hard links is not known.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)    * - 0x1C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)      - i\_blocks\_lo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)      - Lower 32-bits of “block” count. If the huge\_file feature flag is not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)        set on the filesystem, the file consumes ``i_blocks_lo`` 512-byte blocks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)        on disk. If huge\_file is set and EXT4\_HUGE\_FILE\_FL is NOT set in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)        ``inode.i_flags``, then the file consumes ``i_blocks_lo + (i_blocks_hi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)        << 32)`` 512-byte blocks on disk. If huge\_file is set and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)        EXT4\_HUGE\_FILE\_FL IS set in ``inode.i_flags``, then this file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)        consumes (``i_blocks_lo + i_blocks_hi`` << 32) filesystem blocks on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)        disk.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)    * - 0x20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)      - i\_flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)      - Inode flags. See the table i_flags_ below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)    * - 0x24
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)      - 4 bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)      - i\_osd1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)      - See the table i_osd1_ for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)    * - 0x28
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)      - 60 bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)      - i\_block[EXT4\_N\_BLOCKS=15]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)      - Block map or extent tree. See the section “The Contents of inode.i\_block”.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)    * - 0x64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)      - i\_generation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)      - File version (for NFS).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)    * - 0x68
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)      - i\_file\_acl\_lo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)      - Lower 32-bits of extended attribute block. ACLs are of course one of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)        many possible extended attributes; I think the name of this field is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)        result of the first use of extended attributes being for ACLs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)    * - 0x6C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)      - i\_size\_high / i\_dir\_acl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)      - Upper 32-bits of file/directory size. In ext2/3 this field was named
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)        i\_dir\_acl, though it was usually set to zero and never used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)    * - 0x70
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)      - i\_obso\_faddr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)      - (Obsolete) fragment address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)    * - 0x74
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)      - 12 bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)      - i\_osd2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)      - See the table i_osd2_ for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)    * - 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)      - \_\_le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)      - i\_extra\_isize
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)      - Size of this inode - 128. Alternately, the size of the extended inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)        fields beyond the original ext2 inode, including this field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)    * - 0x82
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)      - \_\_le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)      - i\_checksum\_hi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)      - Upper 16-bits of the inode checksum.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)    * - 0x84
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)      - i\_ctime\_extra
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)      - Extra change time bits. This provides sub-second precision. See Inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)        Timestamps section.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)    * - 0x88
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)      - i\_mtime\_extra
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)      - Extra modification time bits. This provides sub-second precision.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)    * - 0x8C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)      - i\_atime\_extra
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)      - Extra access time bits. This provides sub-second precision.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)    * - 0x90
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)      - i\_crtime
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)      - File creation time, in seconds since the epoch.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)    * - 0x94
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)      - i\_crtime\_extra
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)      - Extra file creation time bits. This provides sub-second precision.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)    * - 0x98
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)      - i\_version\_hi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)      - Upper 32-bits for version number.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)    * - 0x9C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)      - i\_projid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)      - Project ID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) .. _i_mode:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) The ``i_mode`` value is a combination of the following flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) .. list-table::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)    :widths: 16 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)    :header-rows: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)    * - Value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)      - Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)    * - 0x1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)      - S\_IXOTH (Others may execute)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)    * - 0x2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)      - S\_IWOTH (Others may write)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)    * - 0x4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)      - S\_IROTH (Others may read)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)    * - 0x8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)      - S\_IXGRP (Group members may execute)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)    * - 0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)      - S\_IWGRP (Group members may write)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)    * - 0x20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)      - S\_IRGRP (Group members may read)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)    * - 0x40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)      - S\_IXUSR (Owner may execute)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)    * - 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)      - S\_IWUSR (Owner may write)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)    * - 0x100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)      - S\_IRUSR (Owner may read)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)    * - 0x200
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)      - S\_ISVTX (Sticky bit)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)    * - 0x400
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)      - S\_ISGID (Set GID)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)    * - 0x800
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)      - S\_ISUID (Set UID)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)    * -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)      - These are mutually-exclusive file types:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)    * - 0x1000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)      - S\_IFIFO (FIFO)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)    * - 0x2000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)      - S\_IFCHR (Character device)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)    * - 0x4000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)      - S\_IFDIR (Directory)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)    * - 0x6000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)      - S\_IFBLK (Block device)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)    * - 0x8000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)      - S\_IFREG (Regular file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)    * - 0xA000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)      - S\_IFLNK (Symbolic link)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)    * - 0xC000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)      - S\_IFSOCK (Socket)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) .. _i_flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) The ``i_flags`` field is a combination of these values:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) .. list-table::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)    :widths: 16 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)    :header-rows: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)    * - Value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)      - Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)    * - 0x1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)      - This file requires secure deletion (EXT4\_SECRM\_FL). (not implemented)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)    * - 0x2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)      - This file should be preserved, should undeletion be desired
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)        (EXT4\_UNRM\_FL). (not implemented)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)    * - 0x4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)      - File is compressed (EXT4\_COMPR\_FL). (not really implemented)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)    * - 0x8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)      - All writes to the file must be synchronous (EXT4\_SYNC\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)    * - 0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)      - File is immutable (EXT4\_IMMUTABLE\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)    * - 0x20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)      - File can only be appended (EXT4\_APPEND\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)    * - 0x40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)      - The dump(1) utility should not dump this file (EXT4\_NODUMP\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)    * - 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)      - Do not update access time (EXT4\_NOATIME\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)    * - 0x100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)      - Dirty compressed file (EXT4\_DIRTY\_FL). (not used)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)    * - 0x200
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)      - File has one or more compressed clusters (EXT4\_COMPRBLK\_FL). (not used)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)    * - 0x400
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)      - Do not compress file (EXT4\_NOCOMPR\_FL). (not used)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)    * - 0x800
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)      - Encrypted inode (EXT4\_ENCRYPT\_FL). This bit value previously was
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)        EXT4\_ECOMPR\_FL (compression error), which was never used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)    * - 0x1000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)      - Directory has hashed indexes (EXT4\_INDEX\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)    * - 0x2000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)      - AFS magic directory (EXT4\_IMAGIC\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)    * - 0x4000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)      - File data must always be written through the journal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)        (EXT4\_JOURNAL\_DATA\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)    * - 0x8000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)      - File tail should not be merged (EXT4\_NOTAIL\_FL). (not used by ext4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)    * - 0x10000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)      - All directory entry data should be written synchronously (see
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)        ``dirsync``) (EXT4\_DIRSYNC\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)    * - 0x20000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)      - Top of directory hierarchy (EXT4\_TOPDIR\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)    * - 0x40000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)      - This is a huge file (EXT4\_HUGE\_FILE\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)    * - 0x80000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)      - Inode uses extents (EXT4\_EXTENTS\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)    * - 0x100000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)      - Verity protected file (EXT4\_VERITY\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)    * - 0x200000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)      - Inode stores a large extended attribute value in its data blocks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)        (EXT4\_EA\_INODE\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)    * - 0x400000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)      - This file has blocks allocated past EOF (EXT4\_EOFBLOCKS\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)        (deprecated)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)    * - 0x01000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)      - Inode is a snapshot (``EXT4_SNAPFILE_FL``). (not in mainline)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)    * - 0x04000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)      - Snapshot is being deleted (``EXT4_SNAPFILE_DELETED_FL``). (not in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)        mainline)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)    * - 0x08000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)      - Snapshot shrink has completed (``EXT4_SNAPFILE_SHRUNK_FL``). (not in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)        mainline)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)    * - 0x10000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)      - Inode has inline data (EXT4\_INLINE\_DATA\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)    * - 0x20000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)      - Create children with the same project ID (EXT4\_PROJINHERIT\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)    * - 0x80000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)      - Reserved for ext4 library (EXT4\_RESERVED\_FL).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)    * -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)      - Aggregate flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)    * - 0x705BDFFF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)      - User-visible flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)    * - 0x604BC0FF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)      - User-modifiable flags. Note that while EXT4\_JOURNAL\_DATA\_FL and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)        EXT4\_EXTENTS\_FL can be set with setattr, they are not in the kernel's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)        EXT4\_FL\_USER\_MODIFIABLE mask, since it needs to handle the setting of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)        these flags in a special manner and they are masked out of the set of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)        flags that are saved directly to i\_flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) .. _i_osd1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) The ``osd1`` field has multiple meanings depending on the creator:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) Linux:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) .. list-table::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)    :widths: 8 8 24 40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)    :header-rows: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)    * - Offset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)      - Size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)      - Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)      - Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)    * - 0x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)      - l\_i\_version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)      - Inode version. However, if the EA\_INODE inode flag is set, this inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)        stores an extended attribute value and this field contains the upper 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332)        bits of the attribute value's reference count.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) Hurd:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) .. list-table::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)    :widths: 8 8 24 40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)    :header-rows: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)    * - Offset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)      - Size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)      - Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)      - Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)    * - 0x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)      - h\_i\_translator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)      - ??
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) Masix:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) .. list-table::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)    :widths: 8 8 24 40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)    :header-rows: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)    * - Offset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)      - Size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)      - Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)      - Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)    * - 0x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)      - \_\_le32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)      - m\_i\_reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)      - ??
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) .. _i_osd2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) The ``osd2`` field has multiple meanings depending on the filesystem creator:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) Linux:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) .. list-table::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)    :widths: 8 8 24 40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)    :header-rows: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)    * - Offset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375)      - Size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)      - Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)      - Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378)    * - 0x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)      - \_\_le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)      - l\_i\_blocks\_high
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381)      - Upper 16-bits of the block count. Please see the note attached to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)        i\_blocks\_lo.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)    * - 0x2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384)      - \_\_le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)      - l\_i\_file\_acl\_high
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)      - Upper 16-bits of the extended attribute block (historically, the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387)        ACL location). See the Extended Attributes section below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)    * - 0x4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)      - \_\_le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390)      - l\_i\_uid\_high
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391)      - Upper 16-bits of the Owner UID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)    * - 0x6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)      - \_\_le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394)      - l\_i\_gid\_high
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395)      - Upper 16-bits of the GID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)    * - 0x8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397)      - \_\_le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)      - l\_i\_checksum\_lo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399)      - Lower 16-bits of the inode checksum.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)    * - 0xA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)      - \_\_le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)      - l\_i\_reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)      - Unused.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) Hurd:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) .. list-table::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408)    :widths: 8 8 24 40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)    :header-rows: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)    * - Offset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412)      - Size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)      - Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)      - Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415)    * - 0x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)      - \_\_le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417)      - h\_i\_reserved1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)      - ??
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419)    * - 0x2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420)      - \_\_u16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)      - h\_i\_mode\_high
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422)      - Upper 16-bits of the file mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)    * - 0x4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)      - \_\_le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425)      - h\_i\_uid\_high
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)      - Upper 16-bits of the Owner UID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)    * - 0x6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428)      - \_\_le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429)      - h\_i\_gid\_high
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)      - Upper 16-bits of the GID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431)    * - 0x8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432)      - \_\_u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)      - h\_i\_author
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434)      - Author code?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) Masix:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) .. list-table::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439)    :widths: 8 8 24 40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440)    :header-rows: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)    * - Offset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443)      - Size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)      - Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)      - Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)    * - 0x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447)      - \_\_le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)      - h\_i\_reserved1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449)      - ??
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)    * - 0x2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451)      - \_\_u16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452)      - m\_i\_file\_acl\_high
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453)      - Upper 16-bits of the extended attribute block (historically, the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454)        ACL location).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455)    * - 0x4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)      - \_\_u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457)      - m\_i\_reserved2[2]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458)      - ??
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) Inode Size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) ~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) In ext2 and ext3, the inode structure size was fixed at 128 bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) (``EXT2_GOOD_OLD_INODE_SIZE``) and each inode had a disk record size of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 128 bytes. Starting with ext4, it is possible to allocate a larger
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) on-disk inode at format time for all inodes in the filesystem to provide
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) space beyond the end of the original ext2 inode. The on-disk inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) record size is recorded in the superblock as ``s_inode_size``. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) number of bytes actually used by struct ext4\_inode beyond the original
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) 128-byte ext2 inode is recorded in the ``i_extra_isize`` field for each
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) inode, which allows struct ext4\_inode to grow for a new kernel without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) having to upgrade all of the on-disk inodes. Access to fields beyond
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) EXT2\_GOOD\_OLD\_INODE\_SIZE should be verified to be within
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) ``i_extra_isize``. By default, ext4 inode records are 256 bytes, and (as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) of August 2019) the inode structure is 160 bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) (``i_extra_isize = 32``). The extra space between the end of the inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) structure and the end of the inode record can be used to store extended
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) attributes. Each inode record can be as large as the filesystem block
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) size, though this is not terribly efficient.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) Finding an Inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) ~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) Each block group contains ``sb->s_inodes_per_group`` inodes. Because
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) inode 0 is defined not to exist, this formula can be used to find the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) block group that an inode lives in:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) ``bg = (inode_num - 1) / sb->s_inodes_per_group``. The particular inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) can be found within the block group's inode table at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) ``index = (inode_num - 1) % sb->s_inodes_per_group``. To get the byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) address within the inode table, use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) ``offset = index * sb->s_inode_size``.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) Inode Timestamps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) ~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) Four timestamps are recorded in the lower 128 bytes of the inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) structure -- inode change time (ctime), access time (atime), data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) modification time (mtime), and deletion time (dtime). The four fields
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) are 32-bit signed integers that represent seconds since the Unix epoch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) (1970-01-01 00:00:00 GMT), which means that the fields will overflow in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) January 2038. For inodes that are not linked from any directory but are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) still open (orphan inodes), the dtime field is overloaded for use with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) the orphan list. The superblock field ``s_last_orphan`` points to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) first inode in the orphan list; dtime is then the number of the next
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) orphaned inode, or zero if there are no more orphans.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) If the inode structure size ``sb->s_inode_size`` is larger than 128
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) bytes and the ``i_inode_extra`` field is large enough to encompass the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) respective ``i_[cma]time_extra`` field, the ctime, atime, and mtime
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) inode fields are widened to 64 bits. Within this “extra” 32-bit field,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) the lower two bits are used to extend the 32-bit seconds field to be 34
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) bit wide; the upper 30 bits are used to provide nanosecond timestamp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) accuracy. Therefore, timestamps should not overflow until May 2446.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) dtime was not widened. There is also a fifth timestamp to record inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) creation time (crtime); this field is 64-bits wide and decoded in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) same manner as 64-bit [cma]time. Neither crtime nor dtime are accessible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) through the regular stat() interface, though debugfs will report them.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) We use the 32-bit signed time value plus (2^32 \* (extra epoch bits)).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) In other words:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) .. list-table::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523)    :widths: 20 20 20 20 20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524)    :header-rows: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526)    * - Extra epoch bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527)      - MSB of 32-bit time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528)      - Adjustment for signed 32-bit to 64-bit tv\_sec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529)      - Decoded 64-bit tv\_sec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530)      - valid time range
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531)    * - 0 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532)      - 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533)      - 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534)      - ``-0x80000000 - -0x00000001``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535)      - 1901-12-13 to 1969-12-31
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536)    * - 0 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537)      - 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538)      - 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539)      - ``0x000000000 - 0x07fffffff``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540)      - 1970-01-01 to 2038-01-19
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541)    * - 0 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542)      - 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543)      - 0x100000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544)      - ``0x080000000 - 0x0ffffffff``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545)      - 2038-01-19 to 2106-02-07
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546)    * - 0 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547)      - 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548)      - 0x100000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549)      - ``0x100000000 - 0x17fffffff``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550)      - 2106-02-07 to 2174-02-25
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551)    * - 1 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552)      - 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553)      - 0x200000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554)      - ``0x180000000 - 0x1ffffffff``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555)      - 2174-02-25 to 2242-03-16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556)    * - 1 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557)      - 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558)      - 0x200000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559)      - ``0x200000000 - 0x27fffffff``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560)      - 2242-03-16 to 2310-04-04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561)    * - 1 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562)      - 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563)      - 0x300000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564)      - ``0x280000000 - 0x2ffffffff``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565)      - 2310-04-04 to 2378-04-22
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566)    * - 1 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567)      - 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568)      - 0x300000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569)      - ``0x300000000 - 0x37fffffff``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570)      - 2378-04-22 to 2446-05-10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) This is a somewhat odd encoding since there are effectively seven times
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) as many positive values as negative values. There have also been
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) long-standing bugs decoding and encoding dates beyond 2038, which don't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) seem to be fixed as of kernel 3.12 and e2fsprogs 1.42.8. 64-bit kernels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) incorrectly use the extra epoch bits 1,1 for dates between 1901 and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) 1970. At some point the kernel will be fixed and e2fsck will fix this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) situation, assuming that it is run before 2310.