요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
Bigalloc
--------
At the moment, the default size of a block is 4KiB, which is a commonly
supported page size on most MMU-capable hardware. This is fortunate, as
ext4 code is not prepared to handle the case where the block size
exceeds the page size. However, for a filesystem of mostly huge files,
it is desirable to be able to allocate disk blocks in units of multiple
blocks to reduce both fragmentation and metadata overhead. The
bigalloc feature provides exactly this ability.
The bigalloc feature (EXT4_FEATURE_RO_COMPAT_BIGALLOC) changes ext4 to
use clustered allocation, so that each bit in the ext4 block allocation
bitmap addresses a power of two number of blocks. For example, if the
file system is mainly going to be storing large files in the 4-32
megabyte range, it might make sense to set a cluster size of 1 megabyte.
This means that each bit in the block allocation bitmap now addresses
256 4k blocks. This shrinks the total size of the block allocation
bitmaps for a 2T file system from 64 megabytes to 256 kilobytes. It also
means that a block group addresses 32 gigabytes instead of 128 megabytes,
also shrinking the amount of file system overhead for metadata.
The administrator can set a block cluster size at mkfs time (which is
stored in the s_log_cluster_size field in the superblock); from then
on, the block bitmaps track clusters, not individual blocks. This means
that block groups can be several gigabytes in size (instead of just
128MiB); however, the minimum allocation unit becomes a cluster, not a
block, even for directories. TaoBao had a patchset to extend the “use
units of clusters instead of blocks” to the extent tree, though it is
not clear where those patches went-- they eventually morphed into
“extent tree v2” but that code has not landed as of May 2015.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
cluster allocation의 목적과 효과
1-23기본 block size는 현재 4KiB이며 대부분의 MMU-capable hardware가 지원하는 일반적인 page size입니다. ext4 code는 block size가 page size보다 큰 경우를 처리하도록 만들어지지 않았기 때문에 이 일치는 중요합니다.
대부분이 매우 큰 파일인 filesystem에서는 여러 block을 하나의 단위로 할당하면 fragmentation과 metadata overhead를 모두 줄일 수 있습니다. bigalloc feature가 바로 이 기능을 제공합니다.
`EXT4_FEATURE_RO_COMPAT_BIGALLOC`은 ext4를 clustered allocation 방식으로 바꿔 block allocation bitmap의 bit 하나가 2의 거듭제곱 개 block을 나타내게 합니다.
주로 4~32MB 파일을 저장한다면 cluster size를 1MB로 둘 수 있습니다. 그러면 bitmap bit 하나가 4KiB block 256개를 나타냅니다.
2TB filesystem에서 block allocation bitmap 총 크기는 64MB에서 256KB로 줄고, block group이 나타내는 범위는 128MB에서 32GB로 늘어 filesystem metadata overhead도 감소합니다.
1MB cluster가 bitmap과 block group 범위를 바꾸는 효과입니다.
.. SPDX-License-Identifier: GPL-2.0
Bigalloc
--------
At the moment, the default size of a block is 4KiB, which is a commonly
supported page size on most MMU-capable hardware. This is fortunate, as
ext4 code is not prepared to handle the case where the block size
exceeds the page size. However, for a filesystem of mostly huge files,
it is desirable to be able to allocate disk blocks in units of multiple
blocks to reduce both fragmentation and metadata overhead. The
bigalloc feature provides exactly this ability.
The bigalloc feature (EXT4_FEATURE_RO_COMPAT_BIGALLOC) changes ext4 to
use clustered allocation, so that each bit in the ext4 block allocation
bitmap addresses a power of two number of blocks. For example, if the
file system is mainly going to be storing large files in the 4-32
megabyte range, it might make sense to set a cluster size of 1 megabyte.
This means that each bit in the block allocation bitmap now addresses
256 4k blocks. This shrinks the total size of the block allocation
bitmaps for a 2T file system from 64 megabytes to 256 kilobytes. It also
means that a block group addresses 32 gigabytes instead of 128 megabytes,
also shrinking the amount of file system overhead for metadata.
mkfs 설정과 최소 할당 단위
24-34administrator는 `mkfs` 시점에 block cluster size를 설정하며 이 값은 superblock의 `s_log_cluster_size` field에 저장됩니다. 그 뒤부터 block bitmap은 개별 block이 아니라 cluster를 추적합니다.
따라서 block group은 128MiB가 아니라 수 GB 크기가 될 수 있습니다. 하지만 directory를 포함한 모든 allocation의 최소 단위도 block이 아니라 cluster가 됩니다.
TaoBao는 extent tree도 block 대신 cluster 단위를 사용하도록 확장하는 patchset을 만들었습니다. 이후 `extent tree v2`로 발전했지만 2015년 5월 시점에는 해당 code가 mainline에 들어오지 않았습니다.
생성 시 설정이 runtime allocation 단위로 이어지는 흐름입니다.
The administrator can set a block cluster size at mkfs time (which is
stored in the s_log_cluster_size field in the superblock); from then
on, the block bitmaps track clusters, not individual blocks. This means
that block groups can be several gigabytes in size (instead of just
128MiB); however, the minimum allocation unit becomes a cluster, not a
block, even for directories. TaoBao had a patchset to extend the “use
units of clusters instead of blocks” to the extent tree, though it is
not clear where those patches went-- they eventually morphed into
“extent tree v2” but that code has not landed as of May 2015.
요약·해설
bigalloc.rst:1-34bigalloc은 bitmap bit 하나가 여러 block으로 이루어진 cluster를 나타내게 해 large-file filesystem의 fragmentation과 metadata overhead를 줄입니다. 대신 directory를 포함한 최소 allocation unit도 cluster가 되므로 작은 객체의 공간 비용을 고려해야 합니다.
bitmap 축소와 allocation granularity 확대를 함께 보여 줍니다.