← Documents Documentation/filesystems/ext4/inlinedata.rst GitHub 원문 ↗

Linux 6.18.37 · Filesystems

Inline Data

작은 파일과 디렉터리 데이터를 inode 내부에 저장하는 ext4 inline data 형식의 전문 번역입니다.

Source pathDocumentation/filesystems/ext4/inlinedata.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

inlinedata.rst:1-37

작은 파일은 `i_block`과 ibody EA의 `system.data`에 저장할 수 있고, 용량을 넘으면 일반 data block으로 이동합니다.

inline directory는 parent inode 4바이트 뒤의 56바이트와 ibody EA를 서로 독립된 dirent 영역으로 사용합니다.

핵심 흐름
`i_block` 60바이트 사용나머지를 `system.data` EA에 저장용량 초과 시 일반 block으로 이동inode checksum으로 inline 내용 보호

문서의 주요 관계를 짧게 정리합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 Inline Data
4 -----------
5
6 The inline data feature was designed to handle the case that a file's
7 data is so tiny that it readily fits inside the inode, which
8 (theoretically) reduces disk block consumption and reduces seeks. If the
9 file is smaller than 60 bytes, then the data are stored inline in
10 ``inode.i_block``. If the rest of the file would fit inside the extended
11 attribute space, then it might be found as an extended attribute
12 “system.data” within the inode body (“ibody EA”). This of course
13 constrains the amount of extended attributes one can attach to an inode.
14 If the data size increases beyond i_block + ibody EA, a regular block
15 is allocated and the contents moved to that block.
16
17 Pending a change to compact the extended attribute key used to store
18 inline data, one ought to be able to store 160 bytes of data in a
19 256-byte inode (as of June 2015, when i_extra_isize is 28). Prior to
20 that, the limit was 156 bytes due to inefficient use of inode space.
21
22 The inline data feature requires the presence of an extended attribute
23 for “system.data”, even if the attribute value is zero length.
24
25 Inline Directories
26 ~~~~~~~~~~~~~~~~~~
27
28 The first four bytes of i_block are the inode number of the parent
29 directory. Following that is a 56-byte space for an array of directory
30 entries; see ``struct ext4_dir_entry``. If there is a “system.data”
31 attribute in the inode body, the EA value is an array of
32 ``struct ext4_dir_entry`` as well. Note that for inline directories, the
33 i_block and EA space are treated as separate dirent blocks; directory
34 entries cannot span the two.
35
36 Inline directory entries are not checksummed, as the inode checksum
37 should protect all inline data contents.
38

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

파일의 inline data

1-23

inline 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` 확장 속성이 존재해야 합니다.

inline file data 저장 단계
파일 데이터 < 60 bytes: `inode.i_block`나머지가 ibody EA에 들어감: `system.data``i_block + ibody EA` 용량 초과일반 data block 할당기존 inline 내용을 새 block으로 이동

작은 파일이 커질 때 데이터 위치가 바뀌는 순서입니다.

.. 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-37

inline 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을 두지 않습니다.

inline directory 배치
영역크기·형식내용
`i_block[0..3]`4 bytesparent directory inode number
`i_block[4..59]`56 bytes`struct ext4_dir_entry` 배열
ibody EA `system.data`EA value 길이별도의 `struct ext4_dir_entry` 배열
checksum별도 dirent checksum 없음inode checksum이 전체 inline data 보호

`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.