18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciInline Data
48c2ecf20Sopenharmony_ci-----------
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ciThe inline data feature was designed to handle the case that a file's
78c2ecf20Sopenharmony_cidata is so tiny that it readily fits inside the inode, which
88c2ecf20Sopenharmony_ci(theoretically) reduces disk block consumption and reduces seeks. If the
98c2ecf20Sopenharmony_cifile is smaller than 60 bytes, then the data are stored inline in
108c2ecf20Sopenharmony_ci``inode.i_block``. If the rest of the file would fit inside the extended
118c2ecf20Sopenharmony_ciattribute space, then it might be found as an extended attribute
128c2ecf20Sopenharmony_cisystem.data” within the inode body (“ibody EA”). This of course
138c2ecf20Sopenharmony_ciconstrains the amount of extended attributes one can attach to an inode.
148c2ecf20Sopenharmony_ciIf the data size increases beyond i\_block + ibody EA, a regular block
158c2ecf20Sopenharmony_ciis allocated and the contents moved to that block.
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciPending a change to compact the extended attribute key used to store
188c2ecf20Sopenharmony_ciinline data, one ought to be able to store 160 bytes of data in a
198c2ecf20Sopenharmony_ci256-byte inode (as of June 2015, when i\_extra\_isize is 28). Prior to
208c2ecf20Sopenharmony_cithat, the limit was 156 bytes due to inefficient use of inode space.
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciThe inline data feature requires the presence of an extended attribute
238c2ecf20Sopenharmony_cifor “system.data”, even if the attribute value is zero length.
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciInline Directories
268c2ecf20Sopenharmony_ci~~~~~~~~~~~~~~~~~~
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciThe first four bytes of i\_block are the inode number of the parent
298c2ecf20Sopenharmony_cidirectory. Following that is a 56-byte space for an array of directory
308c2ecf20Sopenharmony_cientries; see ``struct ext4_dir_entry``. If there is a “system.data318c2ecf20Sopenharmony_ciattribute in the inode body, the EA value is an array of
328c2ecf20Sopenharmony_ci``struct ext4_dir_entry`` as well. Note that for inline directories, the
338c2ecf20Sopenharmony_cii\_block and EA space are treated as separate dirent blocks; directory
348c2ecf20Sopenharmony_cientries cannot span the two.
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciInline directory entries are not checksummed, as the inode checksum
378c2ecf20Sopenharmony_cishould protect all inline data contents.
38