요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
Inline Data
-----------
The inline data feature was designed to handle the case that a file's
data is so tiny that it readily fits inside the inode, which
(theoretically) reduces disk block consumption and reduces seeks. If the
file is smaller than 60 bytes, then the data are stored inline in
``inode.i_block``. If the rest of the file would fit inside the extended
attribute space, then it might be found as an extended attribute
“system.data” within the inode body (“ibody EA”). This of course
constrains the amount of extended attributes one can attach to an inode.
If the data size increases beyond i_block + ibody EA, a regular block
is allocated and the contents moved to that block.
Pending a change to compact the extended attribute key used to store
inline data, one ought to be able to store 160 bytes of data in a
256-byte inode (as of June 2015, when i_extra_isize is 28). Prior to
that, the limit was 156 bytes due to inefficient use of inode space.
The inline data feature requires the presence of an extended attribute
for “system.data”, even if the attribute value is zero length.
Inline Directories
~~~~~~~~~~~~~~~~~~
The first four bytes of i_block are the inode number of the parent
directory. Following that is a 56-byte space for an array of directory
entries; see ``struct ext4_dir_entry``. If there is a “system.data”
attribute in the inode body, the EA value is an array of
``struct ext4_dir_entry`` as well. Note that for inline directories, the
i_block and EA space are treated as separate dirent blocks; directory
entries cannot span the two.
Inline directory entries are not checksummed, as the inode checksum
should protect all inline data contents.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
파일의 inline data
1-23inline data 기능은 파일 데이터가 inode 안에 들어갈 만큼 매우 작은 경우를 처리하도록 설계되었습니다. 이론적으로 별도 disk block 소비와 seek 횟수를 줄입니다.
파일이 60바이트보다 작으면 데이터를 `inode.i_block`에 직접 저장합니다. 나머지 데이터도 extended attribute 공간에 들어가면 inode body의 `system.data` 확장 속성, 즉 ibody EA에 둘 수 있습니다. 그만큼 inode에 연결할 수 있는 다른 확장 속성 공간은 줄어듭니다.
데이터 크기가 `i_block + ibody EA` 용량을 넘으면 일반 block을 할당하고 내용을 그 block으로 옮깁니다.
inline data 저장에 쓰는 확장 속성 key를 압축하기 전 기준으로, `i_extra_isize`가 28이었던 2015년 6월 당시 256바이트 inode에는 160바이트의 데이터를 저장할 수 있어야 합니다. 그 전의 한도는 inode 공간을 비효율적으로 사용해 156바이트였습니다.
inline data 기능은 값의 길이가 0이더라도 `system.data` 확장 속성이 존재해야 합니다.
작은 파일이 커질 때 데이터 위치가 바뀌는 순서입니다.
.. SPDX-License-Identifier: GPL-2.0
Inline Data
-----------
The inline data feature was designed to handle the case that a file's
data is so tiny that it readily fits inside the inode, which
(theoretically) reduces disk block consumption and reduces seeks. If the
file is smaller than 60 bytes, then the data are stored inline in
``inode.i_block``. If the rest of the file would fit inside the extended
attribute space, then it might be found as an extended attribute
“system.data” within the inode body (“ibody EA”). This of course
constrains the amount of extended attributes one can attach to an inode.
If the data size increases beyond i_block + ibody EA, a regular block
is allocated and the contents moved to that block.
Pending a change to compact the extended attribute key used to store
inline data, one ought to be able to store 160 bytes of data in a
256-byte inode (as of June 2015, when i_extra_isize is 28). Prior to
that, the limit was 156 bytes due to inefficient use of inode space.
The inline data feature requires the presence of an extended attribute
for “system.data”, even if the attribute value is zero length.
inline directory
24-37inline directory에서 `i_block`의 처음 4바이트는 parent directory의 inode number입니다. 그 뒤 56바이트는 `struct ext4_dir_entry` 배열을 저장합니다.
inode body에 `system.data` 속성이 있으면 그 EA value도 `struct ext4_dir_entry` 배열입니다. inline directory에서는 `i_block`과 EA 공간을 서로 별개의 dirent block으로 취급하므로 directory entry가 두 영역에 걸쳐 저장될 수 없습니다.
inode checksum이 모든 inline data 내용을 보호하므로 inline directory entry에는 별도 checksum을 두지 않습니다.
`i_block`과 ibody EA를 독립된 directory entry 영역으로 사용합니다.
Inline Directories
~~~~~~~~~~~~~~~~~~
The first four bytes of i_block are the inode number of the parent
directory. Following that is a 56-byte space for an array of directory
entries; see ``struct ext4_dir_entry``. If there is a “system.data”
attribute in the inode body, the EA value is an array of
``struct ext4_dir_entry`` as well. Note that for inline directories, the
i_block and EA space are treated as separate dirent blocks; directory
entries cannot span the two.
Inline directory entries are not checksummed, as the inode checksum
should protect all inline data contents.
요약·해설
inlinedata.rst:1-37작은 파일은 `i_block`과 ibody EA의 `system.data`에 저장할 수 있고, 용량을 넘으면 일반 data block으로 이동합니다.
inline directory는 parent inode 4바이트 뒤의 56바이트와 ibody EA를 서로 독립된 dirent 영역으로 사용합니다.
문서의 주요 관계를 짧게 정리합니다.