162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci
362306a36Sopenharmony_ciInline Data
462306a36Sopenharmony_ci-----------
562306a36Sopenharmony_ci
662306a36Sopenharmony_ciThe inline data feature was designed to handle the case that a file's
762306a36Sopenharmony_cidata is so tiny that it readily fits inside the inode, which
862306a36Sopenharmony_ci(theoretically) reduces disk block consumption and reduces seeks. If the
962306a36Sopenharmony_cifile is smaller than 60 bytes, then the data are stored inline in
1062306a36Sopenharmony_ci``inode.i_block``. If the rest of the file would fit inside the extended
1162306a36Sopenharmony_ciattribute space, then it might be found as an extended attribute
1262306a36Sopenharmony_cisystem.data” within the inode body (“ibody EA”). This of course
1362306a36Sopenharmony_ciconstrains the amount of extended attributes one can attach to an inode.
1462306a36Sopenharmony_ciIf the data size increases beyond i_block + ibody EA, a regular block
1562306a36Sopenharmony_ciis allocated and the contents moved to that block.
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ciPending a change to compact the extended attribute key used to store
1862306a36Sopenharmony_ciinline data, one ought to be able to store 160 bytes of data in a
1962306a36Sopenharmony_ci256-byte inode (as of June 2015, when i_extra_isize is 28). Prior to
2062306a36Sopenharmony_cithat, the limit was 156 bytes due to inefficient use of inode space.
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ciThe inline data feature requires the presence of an extended attribute
2362306a36Sopenharmony_cifor “system.data”, even if the attribute value is zero length.
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ciInline Directories
2662306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciThe first four bytes of i_block are the inode number of the parent
2962306a36Sopenharmony_cidirectory. Following that is a 56-byte space for an array of directory
3062306a36Sopenharmony_cientries; see ``struct ext4_dir_entry``. If there is a “system.data3162306a36Sopenharmony_ciattribute in the inode body, the EA value is an array of
3262306a36Sopenharmony_ci``struct ext4_dir_entry`` as well. Note that for inline directories, the
3362306a36Sopenharmony_cii_block and EA space are treated as separate dirent blocks; directory
3462306a36Sopenharmony_cientries cannot span the two.
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ciInline directory entries are not checksummed, as the inode checksum
3762306a36Sopenharmony_cishould protect all inline data contents.
38