요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
================================
Optimized MPEG Filesystem (OMFS)
================================
Overview
========
OMFS is a filesystem created by SonicBlue for use in the ReplayTV DVR
and Rio Karma MP3 player. The filesystem is extent-based, utilizing
block sizes from 2k to 8k, with hash-based directories. This
filesystem driver may be used to read and write disks from these
devices.
Note, it is not recommended that this FS be used in place of a general
filesystem for your own streaming media device. Native Linux filesystems
will likely perform better.
More information is available at:
http://linux-karma.sf.net/
Various utilities, including mkomfs and omfsck, are included with
omfsprogs, available at:
https://bobcopeland.com/karma/
Instructions are included in its README.
Options
=======
OMFS supports the following mount-time options:
============ ========================================
uid=n make all files owned by specified user
gid=n make all files owned by specified group
umask=xxx set permission umask to xxx
fmask=xxx set umask to xxx for files
dmask=xxx set umask to xxx for directories
============ ========================================
Disk format
===========
OMFS discriminates between "sysblocks" and normal data blocks. The sysblock
group consists of super block information, file metadata, directory structures,
and extents. Each sysblock has a header containing CRCs of the entire
sysblock, and may be mirrored in successive blocks on the disk. A sysblock may
have a smaller size than a data block, but since they are both addressed by the
same 64-bit block number, any remaining space in the smaller sysblock is
unused.
Sysblock header information::
struct omfs_header {
__be64 h_self; /* FS block where this is located */
__be32 h_body_size; /* size of useful data after header */
__be16 h_crc; /* crc-ccitt of body_size bytes */
char h_fill1[2];
u8 h_version; /* version, always 1 */
char h_type; /* OMFS_INODE_X */
u8 h_magic; /* OMFS_IMAGIC */
u8 h_check_xor; /* XOR of header bytes before this */
__be32 h_fill2;
};
Files and directories are both represented by omfs_inode::
struct omfs_inode {
struct omfs_header i_head; /* header */
__be64 i_parent; /* parent containing this inode */
__be64 i_sibling; /* next inode in hash bucket */
__be64 i_ctime; /* ctime, in milliseconds */
char i_fill1[35];
char i_type; /* OMFS_[DIR,FILE] */
__be32 i_fill2;
char i_fill3[64];
char i_name[OMFS_NAMELEN]; /* filename */
__be64 i_size; /* size of file, in bytes */
};
Directories in OMFS are implemented as a large hash table. Filenames are
hashed then prepended into the bucket list beginning at OMFS_DIR_START.
Lookup requires hashing the filename, then seeking across i_sibling pointers
until a match is found on i_name. Empty buckets are represented by block
pointers with all-1s (~0).
A file is an omfs_inode structure followed by an extent table beginning at
OMFS_EXTENT_START::
struct omfs_extent_entry {
__be64 e_cluster; /* start location of a set of blocks */
__be64 e_blocks; /* number of blocks after e_cluster */
};
struct omfs_extent {
__be64 e_next; /* next extent table location */
__be32 e_extent_count; /* total # extents in this table */
__be32 e_fill;
struct omfs_extent_entry e_entry; /* start of extent entries */
};
Each extent holds the block offset followed by number of blocks allocated to
the extent. The final extent in each table is a terminator with e_cluster
being ~0 and e_blocks being ones'-complement of the total number of blocks
in the table.
If this table overflows, a continuation inode is written and pointed to by
e_next. These have a header but lack the rest of the inode structure.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
OMFS 용도와 마운트 옵션
1-43OMFS(Optimized MPEG Filesystem)는 SonicBlue가 ReplayTV DVR과 Rio Karma MP3 플레이어에서 사용하기 위해 만든 파일시스템입니다. extent 기반이며 2 KiB부터 8 KiB까지의 블록 크기와 해시 기반 디렉터리를 사용합니다. Linux OMFS 드라이버로 해당 장치의 디스크를 읽고 쓸 수 있습니다.
일반적인 스트리밍 미디어 장치의 범용 파일시스템으로 OMFS를 새로 선택하는 것은 권장하지 않습니다. 네이티브 Linux 파일시스템이 더 나은 성능을 낼 가능성이 큽니다. 원문은 추가 정보 사이트와 `mkomfs`, `omfsck`를 포함하는 `omfsprogs` 배포 위치를 안내하며 사용법은 그 패키지의 README에 있습니다.
마운트 옵션 `uid=n`과 `gid=n`은 모든 파일의 소유 사용자와 그룹을 지정합니다. `umask=xxx`는 공통 권한 umask, `fmask=xxx`는 파일 전용 umask, `dmask=xxx`는 디렉터리 전용 umask를 설정합니다.
모든 파일의 소유권과 파일·디렉터리 권한 마스크를 설정합니다.
.. SPDX-License-Identifier: GPL-2.0
================================
Optimized MPEG Filesystem (OMFS)
================================
Overview
========
OMFS is a filesystem created by SonicBlue for use in the ReplayTV DVR
and Rio Karma MP3 player. The filesystem is extent-based, utilizing
block sizes from 2k to 8k, with hash-based directories. This
filesystem driver may be used to read and write disks from these
devices.
Note, it is not recommended that this FS be used in place of a general
filesystem for your own streaming media device. Native Linux filesystems
will likely perform better.
More information is available at:
http://linux-karma.sf.net/
Various utilities, including mkomfs and omfsck, are included with
omfsprogs, available at:
https://bobcopeland.com/karma/
Instructions are included in its README.
Options
=======
OMFS supports the following mount-time options:
============ ========================================
uid=n make all files owned by specified user
gid=n make all files owned by specified group
umask=xxx set permission umask to xxx
fmask=xxx set umask to xxx for files
dmask=xxx set umask to xxx for directories
============ ========================================
sysblock과 공통 헤더 형식
44-68OMFS는 `sysblock`과 일반 데이터 블록을 구분합니다. sysblock 그룹에는 super block 정보, 파일 메타데이터, 디렉터리 구조, extent가 들어갑니다. 각 sysblock은 전체 sysblock을 대상으로 하는 CRC 정보를 헤더에 가지며 디스크의 연속 블록에 미러링될 수 있습니다.
sysblock 크기는 데이터 블록보다 작을 수 있지만 두 종류 모두 같은 64비트 블록 번호로 주소를 지정합니다. 따라서 더 작은 sysblock 뒤에 남는 공간은 사용하지 않습니다.
`struct omfs_header`의 `h_self`는 현재 FS 블록, `h_body_size`는 헤더 뒤 유효 데이터 크기, `h_crc`는 `body_size` 바이트의 CRC-CCITT입니다. `h_version`은 항상 1이며 `h_type`은 `OMFS_INODE_X`, `h_magic`은 `OMFS_IMAGIC`를 담습니다. `h_check_xor`는 그 필드 앞에 있는 헤더 바이트의 XOR 값입니다. `h_fill1`과 `h_fill2`는 채움 필드입니다.
sysblock의 위치, 길이, 무결성, 종류를 표현하는 공통 헤더입니다.
Disk format
===========
OMFS discriminates between "sysblocks" and normal data blocks. The sysblock
group consists of super block information, file metadata, directory structures,
and extents. Each sysblock has a header containing CRCs of the entire
sysblock, and may be mirrored in successive blocks on the disk. A sysblock may
have a smaller size than a data block, but since they are both addressed by the
same 64-bit block number, any remaining space in the smaller sysblock is
unused.
Sysblock header information::
struct omfs_header {
__be64 h_self; /* FS block where this is located */
__be32 h_body_size; /* size of useful data after header */
__be16 h_crc; /* crc-ccitt of body_size bytes */
char h_fill1[2];
u8 h_version; /* version, always 1 */
char h_type; /* OMFS_INODE_X */
u8 h_magic; /* OMFS_IMAGIC */
u8 h_check_xor; /* XOR of header bytes before this */
__be32 h_fill2;
};
inode 형식과 해시 디렉터리
69-89파일과 디렉터리는 모두 `struct omfs_inode`로 표현됩니다. 첫 필드 `i_head`는 공통 `omfs_header`이고, `i_parent`는 이 inode를 포함하는 부모, `i_sibling`은 같은 해시 버킷의 다음 inode를 가리킵니다. `i_ctime`은 밀리초 단위 생성·변경 시각이며 `i_type`은 `OMFS_DIR` 또는 `OMFS_FILE`입니다. `i_name[OMFS_NAMELEN]`은 이름, `i_size`는 바이트 단위 파일 크기입니다.
OMFS 디렉터리는 큰 해시 테이블로 구현됩니다. 파일 이름을 해시한 뒤 `OMFS_DIR_START`에서 시작하는 버킷 목록의 앞에 inode를 붙입니다. 조회할 때도 이름을 해시하고 `i_sibling` 포인터를 따라가며 `i_name`이 일치하는 항목을 찾습니다. 빈 버킷은 모든 비트가 1인 블록 포인터 `~0`으로 나타냅니다.
파일과 디렉터리가 공유하는 inode 레이아웃입니다.
해시 버킷에서 sibling 연결을 따라 이름을 비교합니다.
Files and directories are both represented by omfs_inode::
struct omfs_inode {
struct omfs_header i_head; /* header */
__be64 i_parent; /* parent containing this inode */
__be64 i_sibling; /* next inode in hash bucket */
__be64 i_ctime; /* ctime, in milliseconds */
char i_fill1[35];
char i_type; /* OMFS_[DIR,FILE] */
__be32 i_fill2;
char i_fill3[64];
char i_name[OMFS_NAMELEN]; /* filename */
__be64 i_size; /* size of file, in bytes */
};
Directories in OMFS are implemented as a large hash table. Filenames are
hashed then prepended into the bucket list beginning at OMFS_DIR_START.
Lookup requires hashing the filename, then seeking across i_sibling pointers
until a match is found on i_name. Empty buckets are represented by block
pointers with all-1s (~0).
extent 테이블과 연속 inode
90-112파일은 `omfs_inode` 뒤에 `OMFS_EXTENT_START`에서 시작하는 extent 테이블을 둡니다. `struct omfs_extent_entry`의 `e_cluster`는 연속 블록 집합의 시작 위치이고 `e_blocks`는 `e_cluster` 뒤에 이어지는 블록 수입니다.
`struct omfs_extent`의 `e_next`는 다음 extent 테이블 위치, `e_extent_count`는 이 테이블의 전체 extent 수이며 `e_entry`에서 extent 항목 배열이 시작됩니다. 각 extent는 블록 오프셋과 그 extent에 할당된 블록 수를 차례로 저장합니다.
각 테이블의 마지막 extent는 종료 표식입니다. 이 항목의 `e_cluster`는 `~0`, `e_blocks`는 테이블의 전체 블록 수에 대한 1의 보수입니다. 테이블 공간이 부족하면 연속 inode를 기록하고 `e_next`가 이를 가리킵니다. 연속 inode에는 헤더가 있지만 나머지 `omfs_inode` 구조는 없습니다.
inode 뒤의 extent 테이블이 넘치면 `e_next`로 연속 inode를 연결합니다.
extent 항목과 테이블 연결에 쓰는 on-disk 필드입니다.
A file is an omfs_inode structure followed by an extent table beginning at
OMFS_EXTENT_START::
struct omfs_extent_entry {
__be64 e_cluster; /* start location of a set of blocks */
__be64 e_blocks; /* number of blocks after e_cluster */
};
struct omfs_extent {
__be64 e_next; /* next extent table location */
__be32 e_extent_count; /* total # extents in this table */
__be32 e_fill;
struct omfs_extent_entry e_entry; /* start of extent entries */
};
Each extent holds the block offset followed by number of blocks allocated to
the extent. The final extent in each table is a terminator with e_cluster
being ~0 and e_blocks being ones'-complement of the total number of blocks
in the table.
If this table overflows, a continuation inode is written and pointed to by
e_next. These have a header but lack the rest of the inode structure.
요약·해설
omfs.rst:1-112OMFS는 ReplayTV DVR과 Rio Karma MP3 플레이어용으로 설계된 extent 기반 파일시스템입니다. sysblock에는 공통 `omfs_header`와 메타데이터가 들어가고, 파일과 디렉터리는 `omfs_inode`로 표현됩니다.
디렉터리는 파일 이름 해시와 `i_sibling` 연결 목록으로 조회합니다. 파일 데이터는 `OMFS_EXTENT_START`의 extent 테이블로 배치하며, 테이블이 넘치면 `e_next`로 헤더만 가진 연속 inode를 연결합니다.
공통 헤더에서 inode, 디렉터리 해시, extent 연결로 이어지는 구조입니다.