579 lines
17 KiB
ReStructuredText
Raw Normal View History

2022-04-02 18:12:00 +05:00
.. SPDX-License-Identifier: GPL-2.0
Index Nodes
-----------
In a regular UNIX filesystem, the inode stores all the metadata
pertaining to the file (time stamps, block maps, extended attributes,
etc), not the directory entry. To find the information associated with a
file, one must traverse the directory files to find the directory entry
associated with a file, then load the inode to find the metadata for
that file. ext4 appears to cheat (for performance reasons) a little bit
by storing a copy of the file type (normally stored in the inode) in the
directory entry. (Compare all this to FAT, which stores all the file
information directly in the directory entry, but does not support hard
links and is in general more seek-happy than ext4 due to its simpler
block allocator and extensive use of linked lists.)
The inode table is a linear array of ``struct ext4_inode``. The table is
sized to have enough blocks to store at least
``sb.s_inode_size * sb.s_inodes_per_group`` bytes. The number of the
block group containing an inode can be calculated as
``(inode_number - 1) / sb.s_inodes_per_group``, and the offset into the
group's table is ``(inode_number - 1) % sb.s_inodes_per_group``. There
is no inode 0.
The inode checksum is calculated against the FS UUID, the inode number,
and the inode structure itself.
The inode table entry is laid out in ``struct ext4_inode``.
.. list-table::
:widths: 8 8 24 40
:header-rows: 1
:class: longtable
* - Offset
- Size
- Name
- Description
* - 0x0
2022-09-13 23:14:27 +05:00
- __le16
- i_mode
2022-04-02 18:12:00 +05:00
- File mode. See the table i_mode_ below.
* - 0x2
2022-09-13 23:14:27 +05:00
- __le16
- i_uid
2022-04-02 18:12:00 +05:00
- Lower 16-bits of Owner UID.
* - 0x4
2022-09-13 23:14:27 +05:00
- __le32
- i_size_lo
2022-04-02 18:12:00 +05:00
- Lower 32-bits of size in bytes.
* - 0x8
2022-09-13 23:14:27 +05:00
- __le32
- i_atime
- Last access time, in seconds since the epoch. However, if the EA_INODE
2022-04-02 18:12:00 +05:00
inode flag is set, this inode stores an extended attribute value and
this field contains the checksum of the value.
* - 0xC
2022-09-13 23:14:27 +05:00
- __le32
- i_ctime
2022-04-02 18:12:00 +05:00
- Last inode change time, in seconds since the epoch. However, if the
2022-09-13 23:14:27 +05:00
EA_INODE inode flag is set, this inode stores an extended attribute
2022-04-02 18:12:00 +05:00
value and this field contains the lower 32 bits of the attribute value's
reference count.
* - 0x10
2022-09-13 23:14:27 +05:00
- __le32
- i_mtime
2022-04-02 18:12:00 +05:00
- Last data modification time, in seconds since the epoch. However, if the
2022-09-13 23:14:27 +05:00
EA_INODE inode flag is set, this inode stores an extended attribute
2022-04-02 18:12:00 +05:00
value and this field contains the number of the inode that owns the
extended attribute.
* - 0x14
2022-09-13 23:14:27 +05:00
- __le32
- i_dtime
2022-04-02 18:12:00 +05:00
- Deletion Time, in seconds since the epoch.
* - 0x18
2022-09-13 23:14:27 +05:00
- __le16
- i_gid
2022-04-02 18:12:00 +05:00
- Lower 16-bits of GID.
* - 0x1A
2022-09-13 23:14:27 +05:00
- __le16
- i_links_count
2022-04-02 18:12:00 +05:00
- Hard link count. Normally, ext4 does not permit an inode to have more
than 65,000 hard links. This applies to files as well as directories,
which means that there cannot be more than 64,998 subdirectories in a
directory (each subdirectory's '..' entry counts as a hard link, as does
2022-09-13 23:14:27 +05:00
the '.' entry in the directory itself). With the DIR_NLINK feature
2022-04-02 18:12:00 +05:00
enabled, ext4 supports more than 64,998 subdirectories by setting this
field to 1 to indicate that the number of hard links is not known.
* - 0x1C
2022-09-13 23:14:27 +05:00
- __le32
- i_blocks_lo
- Lower 32-bits of “block” count. If the huge_file feature flag is not
2022-04-02 18:12:00 +05:00
set on the filesystem, the file consumes ``i_blocks_lo`` 512-byte blocks
2022-09-13 23:14:27 +05:00
on disk. If huge_file is set and EXT4_HUGE_FILE_FL is NOT set in
2022-04-02 18:12:00 +05:00
``inode.i_flags``, then the file consumes ``i_blocks_lo + (i_blocks_hi
2022-09-13 23:14:27 +05:00
<< 32)`` 512-byte blocks on disk. If huge_file is set and
EXT4_HUGE_FILE_FL IS set in ``inode.i_flags``, then this file
2022-04-02 18:12:00 +05:00
consumes (``i_blocks_lo + i_blocks_hi`` << 32) filesystem blocks on
disk.
* - 0x20
2022-09-13 23:14:27 +05:00
- __le32
- i_flags
2022-04-02 18:12:00 +05:00
- Inode flags. See the table i_flags_ below.
* - 0x24
- 4 bytes
2022-09-13 23:14:27 +05:00
- i_osd1
2022-04-02 18:12:00 +05:00
- See the table i_osd1_ for more details.
* - 0x28
- 60 bytes
2022-09-13 23:14:27 +05:00
- i_block[EXT4_N_BLOCKS=15]
- Block map or extent tree. See the section “The Contents of inode.i_block”.
2022-04-02 18:12:00 +05:00
* - 0x64
2022-09-13 23:14:27 +05:00
- __le32
- i_generation
2022-04-02 18:12:00 +05:00
- File version (for NFS).
* - 0x68
2022-09-13 23:14:27 +05:00
- __le32
- i_file_acl_lo
2022-04-02 18:12:00 +05:00
- Lower 32-bits of extended attribute block. ACLs are of course one of
many possible extended attributes; I think the name of this field is a
result of the first use of extended attributes being for ACLs.
* - 0x6C
2022-09-13 23:14:27 +05:00
- __le32
- i_size_high / i_dir_acl
2022-04-02 18:12:00 +05:00
- Upper 32-bits of file/directory size. In ext2/3 this field was named
2022-09-13 23:14:27 +05:00
i_dir_acl, though it was usually set to zero and never used.
2022-04-02 18:12:00 +05:00
* - 0x70
2022-09-13 23:14:27 +05:00
- __le32
- i_obso_faddr
2022-04-02 18:12:00 +05:00
- (Obsolete) fragment address.
* - 0x74
- 12 bytes
2022-09-13 23:14:27 +05:00
- i_osd2
2022-04-02 18:12:00 +05:00
- See the table i_osd2_ for more details.
* - 0x80
2022-09-13 23:14:27 +05:00
- __le16
- i_extra_isize
2022-04-02 18:12:00 +05:00
- Size of this inode - 128. Alternately, the size of the extended inode
fields beyond the original ext2 inode, including this field.
* - 0x82
2022-09-13 23:14:27 +05:00
- __le16
- i_checksum_hi
2022-04-02 18:12:00 +05:00
- Upper 16-bits of the inode checksum.
* - 0x84
2022-09-13 23:14:27 +05:00
- __le32
- i_ctime_extra
2022-04-02 18:12:00 +05:00
- Extra change time bits. This provides sub-second precision. See Inode
Timestamps section.
* - 0x88
2022-09-13 23:14:27 +05:00
- __le32
- i_mtime_extra
2022-04-02 18:12:00 +05:00
- Extra modification time bits. This provides sub-second precision.
* - 0x8C
2022-09-13 23:14:27 +05:00
- __le32
- i_atime_extra
2022-04-02 18:12:00 +05:00
- Extra access time bits. This provides sub-second precision.
* - 0x90
2022-09-13 23:14:27 +05:00
- __le32
- i_crtime
2022-04-02 18:12:00 +05:00
- File creation time, in seconds since the epoch.
* - 0x94
2022-09-13 23:14:27 +05:00
- __le32
- i_crtime_extra
2022-04-02 18:12:00 +05:00
- Extra file creation time bits. This provides sub-second precision.
* - 0x98
2022-09-13 23:14:27 +05:00
- __le32
- i_version_hi
2022-04-02 18:12:00 +05:00
- Upper 32-bits for version number.
* - 0x9C
2022-09-13 23:14:27 +05:00
- __le32
- i_projid
2022-04-02 18:12:00 +05:00
- Project ID.
.. _i_mode:
The ``i_mode`` value is a combination of the following flags:
.. list-table::
:widths: 16 64
:header-rows: 1
* - Value
- Description
* - 0x1
2022-09-13 23:14:27 +05:00
- S_IXOTH (Others may execute)
2022-04-02 18:12:00 +05:00
* - 0x2
2022-09-13 23:14:27 +05:00
- S_IWOTH (Others may write)
2022-04-02 18:12:00 +05:00
* - 0x4
2022-09-13 23:14:27 +05:00
- S_IROTH (Others may read)
2022-04-02 18:12:00 +05:00
* - 0x8
2022-09-13 23:14:27 +05:00
- S_IXGRP (Group members may execute)
2022-04-02 18:12:00 +05:00
* - 0x10
2022-09-13 23:14:27 +05:00
- S_IWGRP (Group members may write)
2022-04-02 18:12:00 +05:00
* - 0x20
2022-09-13 23:14:27 +05:00
- S_IRGRP (Group members may read)
2022-04-02 18:12:00 +05:00
* - 0x40
2022-09-13 23:14:27 +05:00
- S_IXUSR (Owner may execute)
2022-04-02 18:12:00 +05:00
* - 0x80
2022-09-13 23:14:27 +05:00
- S_IWUSR (Owner may write)
2022-04-02 18:12:00 +05:00
* - 0x100
2022-09-13 23:14:27 +05:00
- S_IRUSR (Owner may read)
2022-04-02 18:12:00 +05:00
* - 0x200
2022-09-13 23:14:27 +05:00
- S_ISVTX (Sticky bit)
2022-04-02 18:12:00 +05:00
* - 0x400
2022-09-13 23:14:27 +05:00
- S_ISGID (Set GID)
2022-04-02 18:12:00 +05:00
* - 0x800
2022-09-13 23:14:27 +05:00
- S_ISUID (Set UID)
2022-04-02 18:12:00 +05:00
* -
- These are mutually-exclusive file types:
* - 0x1000
2022-09-13 23:14:27 +05:00
- S_IFIFO (FIFO)
2022-04-02 18:12:00 +05:00
* - 0x2000
2022-09-13 23:14:27 +05:00
- S_IFCHR (Character device)
2022-04-02 18:12:00 +05:00
* - 0x4000
2022-09-13 23:14:27 +05:00
- S_IFDIR (Directory)
2022-04-02 18:12:00 +05:00
* - 0x6000
2022-09-13 23:14:27 +05:00
- S_IFBLK (Block device)
2022-04-02 18:12:00 +05:00
* - 0x8000
2022-09-13 23:14:27 +05:00
- S_IFREG (Regular file)
2022-04-02 18:12:00 +05:00
* - 0xA000
2022-09-13 23:14:27 +05:00
- S_IFLNK (Symbolic link)
2022-04-02 18:12:00 +05:00
* - 0xC000
2022-09-13 23:14:27 +05:00
- S_IFSOCK (Socket)
2022-04-02 18:12:00 +05:00
.. _i_flags:
The ``i_flags`` field is a combination of these values:
.. list-table::
:widths: 16 64
:header-rows: 1
* - Value
- Description
* - 0x1
2022-09-13 23:14:27 +05:00
- This file requires secure deletion (EXT4_SECRM_FL). (not implemented)
2022-04-02 18:12:00 +05:00
* - 0x2
- This file should be preserved, should undeletion be desired
2022-09-13 23:14:27 +05:00
(EXT4_UNRM_FL). (not implemented)
2022-04-02 18:12:00 +05:00
* - 0x4
2022-09-13 23:14:27 +05:00
- File is compressed (EXT4_COMPR_FL). (not really implemented)
2022-04-02 18:12:00 +05:00
* - 0x8
2022-09-13 23:14:27 +05:00
- All writes to the file must be synchronous (EXT4_SYNC_FL).
2022-04-02 18:12:00 +05:00
* - 0x10
2022-09-13 23:14:27 +05:00
- File is immutable (EXT4_IMMUTABLE_FL).
2022-04-02 18:12:00 +05:00
* - 0x20
2022-09-13 23:14:27 +05:00
- File can only be appended (EXT4_APPEND_FL).
2022-04-02 18:12:00 +05:00
* - 0x40
2022-09-13 23:14:27 +05:00
- The dump(1) utility should not dump this file (EXT4_NODUMP_FL).
2022-04-02 18:12:00 +05:00
* - 0x80
2022-09-13 23:14:27 +05:00
- Do not update access time (EXT4_NOATIME_FL).
2022-04-02 18:12:00 +05:00
* - 0x100
2022-09-13 23:14:27 +05:00
- Dirty compressed file (EXT4_DIRTY_FL). (not used)
2022-04-02 18:12:00 +05:00
* - 0x200
2022-09-13 23:14:27 +05:00
- File has one or more compressed clusters (EXT4_COMPRBLK_FL). (not used)
2022-04-02 18:12:00 +05:00
* - 0x400
2022-09-13 23:14:27 +05:00
- Do not compress file (EXT4_NOCOMPR_FL). (not used)
2022-04-02 18:12:00 +05:00
* - 0x800
2022-09-13 23:14:27 +05:00
- Encrypted inode (EXT4_ENCRYPT_FL). This bit value previously was
EXT4_ECOMPR_FL (compression error), which was never used.
2022-04-02 18:12:00 +05:00
* - 0x1000
2022-09-13 23:14:27 +05:00
- Directory has hashed indexes (EXT4_INDEX_FL).
2022-04-02 18:12:00 +05:00
* - 0x2000
2022-09-13 23:14:27 +05:00
- AFS magic directory (EXT4_IMAGIC_FL).
2022-04-02 18:12:00 +05:00
* - 0x4000
- File data must always be written through the journal
2022-09-13 23:14:27 +05:00
(EXT4_JOURNAL_DATA_FL).
2022-04-02 18:12:00 +05:00
* - 0x8000
2022-09-13 23:14:27 +05:00
- File tail should not be merged (EXT4_NOTAIL_FL). (not used by ext4)
2022-04-02 18:12:00 +05:00
* - 0x10000
- All directory entry data should be written synchronously (see
2022-09-13 23:14:27 +05:00
``dirsync``) (EXT4_DIRSYNC_FL).
2022-04-02 18:12:00 +05:00
* - 0x20000
2022-09-13 23:14:27 +05:00
- Top of directory hierarchy (EXT4_TOPDIR_FL).
2022-04-02 18:12:00 +05:00
* - 0x40000
2022-09-13 23:14:27 +05:00
- This is a huge file (EXT4_HUGE_FILE_FL).
2022-04-02 18:12:00 +05:00
* - 0x80000
2022-09-13 23:14:27 +05:00
- Inode uses extents (EXT4_EXTENTS_FL).
2022-04-02 18:12:00 +05:00
* - 0x100000
2022-09-13 23:14:27 +05:00
- Verity protected file (EXT4_VERITY_FL).
2022-04-02 18:12:00 +05:00
* - 0x200000
- Inode stores a large extended attribute value in its data blocks
2022-09-13 23:14:27 +05:00
(EXT4_EA_INODE_FL).
2022-04-02 18:12:00 +05:00
* - 0x400000
2022-09-13 23:14:27 +05:00
- This file has blocks allocated past EOF (EXT4_EOFBLOCKS_FL).
2022-04-02 18:12:00 +05:00
(deprecated)
* - 0x01000000
- Inode is a snapshot (``EXT4_SNAPFILE_FL``). (not in mainline)
* - 0x04000000
- Snapshot is being deleted (``EXT4_SNAPFILE_DELETED_FL``). (not in
mainline)
* - 0x08000000
- Snapshot shrink has completed (``EXT4_SNAPFILE_SHRUNK_FL``). (not in
mainline)
* - 0x10000000
2022-09-13 23:14:27 +05:00
- Inode has inline data (EXT4_INLINE_DATA_FL).
2022-04-02 18:12:00 +05:00
* - 0x20000000
2022-09-13 23:14:27 +05:00
- Create children with the same project ID (EXT4_PROJINHERIT_FL).
2022-04-02 18:12:00 +05:00
* - 0x80000000
2022-09-13 23:14:27 +05:00
- Reserved for ext4 library (EXT4_RESERVED_FL).
2022-04-02 18:12:00 +05:00
* -
- Aggregate flags:
* - 0x705BDFFF
- User-visible flags.
* - 0x604BC0FF
2022-09-13 23:14:27 +05:00
- User-modifiable flags. Note that while EXT4_JOURNAL_DATA_FL and
EXT4_EXTENTS_FL can be set with setattr, they are not in the kernel's
EXT4_FL_USER_MODIFIABLE mask, since it needs to handle the setting of
2022-04-02 18:12:00 +05:00
these flags in a special manner and they are masked out of the set of
2022-09-13 23:14:27 +05:00
flags that are saved directly to i_flags.
2022-04-02 18:12:00 +05:00
.. _i_osd1:
The ``osd1`` field has multiple meanings depending on the creator:
Linux:
.. list-table::
:widths: 8 8 24 40
:header-rows: 1
* - Offset
- Size
- Name
- Description
* - 0x0
2022-09-13 23:14:27 +05:00
- __le32
- l_i_version
- Inode version. However, if the EA_INODE inode flag is set, this inode
2022-04-02 18:12:00 +05:00
stores an extended attribute value and this field contains the upper 32
bits of the attribute value's reference count.
Hurd:
.. list-table::
:widths: 8 8 24 40
:header-rows: 1
* - Offset
- Size
- Name
- Description
* - 0x0
2022-09-13 23:14:27 +05:00
- __le32
- h_i_translator
2022-04-02 18:12:00 +05:00
- ??
Masix:
.. list-table::
:widths: 8 8 24 40
:header-rows: 1
* - Offset
- Size
- Name
- Description
* - 0x0
2022-09-13 23:14:27 +05:00
- __le32
- m_i_reserved
2022-04-02 18:12:00 +05:00
- ??
.. _i_osd2:
The ``osd2`` field has multiple meanings depending on the filesystem creator:
Linux:
.. list-table::
:widths: 8 8 24 40
:header-rows: 1
* - Offset
- Size
- Name
- Description
* - 0x0
2022-09-13 23:14:27 +05:00
- __le16
- l_i_blocks_high
2022-04-02 18:12:00 +05:00
- Upper 16-bits of the block count. Please see the note attached to
2022-09-13 23:14:27 +05:00
i_blocks_lo.
2022-04-02 18:12:00 +05:00
* - 0x2
2022-09-13 23:14:27 +05:00
- __le16
- l_i_file_acl_high
2022-04-02 18:12:00 +05:00
- Upper 16-bits of the extended attribute block (historically, the file
ACL location). See the Extended Attributes section below.
* - 0x4
2022-09-13 23:14:27 +05:00
- __le16
- l_i_uid_high
2022-04-02 18:12:00 +05:00
- Upper 16-bits of the Owner UID.
* - 0x6
2022-09-13 23:14:27 +05:00
- __le16
- l_i_gid_high
2022-04-02 18:12:00 +05:00
- Upper 16-bits of the GID.
* - 0x8
2022-09-13 23:14:27 +05:00
- __le16
- l_i_checksum_lo
2022-04-02 18:12:00 +05:00
- Lower 16-bits of the inode checksum.
* - 0xA
2022-09-13 23:14:27 +05:00
- __le16
- l_i_reserved
2022-04-02 18:12:00 +05:00
- Unused.
Hurd:
.. list-table::
:widths: 8 8 24 40
:header-rows: 1
* - Offset
- Size
- Name
- Description
* - 0x0
2022-09-13 23:14:27 +05:00
- __le16
- h_i_reserved1
2022-04-02 18:12:00 +05:00
- ??
* - 0x2
2022-09-13 23:14:27 +05:00
- __u16
- h_i_mode_high
2022-04-02 18:12:00 +05:00
- Upper 16-bits of the file mode.
* - 0x4
2022-09-13 23:14:27 +05:00
- __le16
- h_i_uid_high
2022-04-02 18:12:00 +05:00
- Upper 16-bits of the Owner UID.
* - 0x6
2022-09-13 23:14:27 +05:00
- __le16
- h_i_gid_high
2022-04-02 18:12:00 +05:00
- Upper 16-bits of the GID.
* - 0x8
2022-09-13 23:14:27 +05:00
- __u32
- h_i_author
2022-04-02 18:12:00 +05:00
- Author code?
Masix:
.. list-table::
:widths: 8 8 24 40
:header-rows: 1
* - Offset
- Size
- Name
- Description
* - 0x0
2022-09-13 23:14:27 +05:00
- __le16
- h_i_reserved1
2022-04-02 18:12:00 +05:00
- ??
* - 0x2
2022-09-13 23:14:27 +05:00
- __u16
- m_i_file_acl_high
2022-04-02 18:12:00 +05:00
- Upper 16-bits of the extended attribute block (historically, the file
ACL location).
* - 0x4
2022-09-13 23:14:27 +05:00
- __u32
- m_i_reserved2[2]
2022-04-02 18:12:00 +05:00
- ??
Inode Size
~~~~~~~~~~
In ext2 and ext3, the inode structure size was fixed at 128 bytes
(``EXT2_GOOD_OLD_INODE_SIZE``) and each inode had a disk record size of
128 bytes. Starting with ext4, it is possible to allocate a larger
on-disk inode at format time for all inodes in the filesystem to provide
space beyond the end of the original ext2 inode. The on-disk inode
record size is recorded in the superblock as ``s_inode_size``. The
2022-09-13 23:14:27 +05:00
number of bytes actually used by struct ext4_inode beyond the original
2022-04-02 18:12:00 +05:00
128-byte ext2 inode is recorded in the ``i_extra_isize`` field for each
2022-09-13 23:14:27 +05:00
inode, which allows struct ext4_inode to grow for a new kernel without
2022-04-02 18:12:00 +05:00
having to upgrade all of the on-disk inodes. Access to fields beyond
2022-09-13 23:14:27 +05:00
EXT2_GOOD_OLD_INODE_SIZE should be verified to be within
2022-04-02 18:12:00 +05:00
``i_extra_isize``. By default, ext4 inode records are 256 bytes, and (as
of August 2019) the inode structure is 160 bytes
(``i_extra_isize = 32``). The extra space between the end of the inode
structure and the end of the inode record can be used to store extended
attributes. Each inode record can be as large as the filesystem block
size, though this is not terribly efficient.
Finding an Inode
~~~~~~~~~~~~~~~~
Each block group contains ``sb->s_inodes_per_group`` inodes. Because
inode 0 is defined not to exist, this formula can be used to find the
block group that an inode lives in:
``bg = (inode_num - 1) / sb->s_inodes_per_group``. The particular inode
can be found within the block group's inode table at
``index = (inode_num - 1) % sb->s_inodes_per_group``. To get the byte
address within the inode table, use
``offset = index * sb->s_inode_size``.
Inode Timestamps
~~~~~~~~~~~~~~~~
Four timestamps are recorded in the lower 128 bytes of the inode
structure -- inode change time (ctime), access time (atime), data
modification time (mtime), and deletion time (dtime). The four fields
are 32-bit signed integers that represent seconds since the Unix epoch
(1970-01-01 00:00:00 GMT), which means that the fields will overflow in
January 2038. If the filesystem does not have orphan_file feature, inodes
that are not linked from any directory but are still open (orphan inodes) have
the dtime field overloaded for use with the orphan list. The superblock field
``s_last_orphan`` points to the first inode in the orphan list; dtime is then
the number of the next orphaned inode, or zero if there are no more orphans.
If the inode structure size ``sb->s_inode_size`` is larger than 128
bytes and the ``i_inode_extra`` field is large enough to encompass the
respective ``i_[cma]time_extra`` field, the ctime, atime, and mtime
inode fields are widened to 64 bits. Within this “extra” 32-bit field,
the lower two bits are used to extend the 32-bit seconds field to be 34
bit wide; the upper 30 bits are used to provide nanosecond timestamp
accuracy. Therefore, timestamps should not overflow until May 2446.
dtime was not widened. There is also a fifth timestamp to record inode
creation time (crtime); this field is 64-bits wide and decoded in the
same manner as 64-bit [cma]time. Neither crtime nor dtime are accessible
through the regular stat() interface, though debugfs will report them.
2022-09-13 23:14:27 +05:00
We use the 32-bit signed time value plus (2^32 * (extra epoch bits)).
2022-04-02 18:12:00 +05:00
In other words:
.. list-table::
:widths: 20 20 20 20 20
:header-rows: 1
* - Extra epoch bits
- MSB of 32-bit time
2022-09-13 23:14:27 +05:00
- Adjustment for signed 32-bit to 64-bit tv_sec
- Decoded 64-bit tv_sec
2022-04-02 18:12:00 +05:00
- valid time range
* - 0 0
- 1
- 0
- ``-0x80000000 - -0x00000001``
- 1901-12-13 to 1969-12-31
* - 0 0
- 0
- 0
- ``0x000000000 - 0x07fffffff``
- 1970-01-01 to 2038-01-19
* - 0 1
- 1
- 0x100000000
- ``0x080000000 - 0x0ffffffff``
- 2038-01-19 to 2106-02-07
* - 0 1
- 0
- 0x100000000
- ``0x100000000 - 0x17fffffff``
- 2106-02-07 to 2174-02-25
* - 1 0
- 1
- 0x200000000
- ``0x180000000 - 0x1ffffffff``
- 2174-02-25 to 2242-03-16
* - 1 0
- 0
- 0x200000000
- ``0x200000000 - 0x27fffffff``
- 2242-03-16 to 2310-04-04
* - 1 1
- 1
- 0x300000000
- ``0x280000000 - 0x2ffffffff``
- 2310-04-04 to 2378-04-22
* - 1 1
- 0
- 0x300000000
- ``0x300000000 - 0x37fffffff``
- 2378-04-22 to 2446-05-10
This is a somewhat odd encoding since there are effectively seven times
as many positive values as negative values. There have also been
long-standing bugs decoding and encoding dates beyond 2038, which don't
seem to be fixed as of kernel 3.12 and e2fsprogs 1.42.8. 64-bit kernels
incorrectly use the extra epoch bits 1,1 for dates between 1901 and
1970. At some point the kernel will be fixed and e2fsck will fix this
situation, assuming that it is run before 2310.