← Documents Documentation/filesystems/fuse/fuse-io.rst GitHub 원문 ↗

Linux 6.18.37 · Filesystems

FUSE I/O Modes

FUSE direct-io, cached I/O, write-through와 writeback-cache의 page cache·mmap·부분 페이지 의미를 설명하는 전문 번역입니다.

Source pathDocumentation/filesystems/fuse/fuse-io.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

fuse-io.rst:1-45

FUSE direct-io는 page cache와 read-ahead를 우회하고 shared mmap을 별도 flag로만 허용합니다. cached mode는 page cache·read-ahead·모든 mmap mode를 지원하며 write-through 또는 writeback-cache로 쓰기 시점을 선택합니다.

writeback-cache는 syscall 지연을 줄이지만 모든 변경이 FUSE kernel module을 통과한다는 전제가 필요하고, 부분 page write를 보존하기 위해 `O_WRONLY` 파일에도 `READ` request를 만들 수 있습니다.

FUSE I/O mode 선택
page cache 우회가 필요하면 direct-ioshared mmap이 필요하면 ALLOW_MMAP flag 또는 cached modecached write를 즉시 daemon에 보내려면 write-through빠른 write syscall과 지연 writeback이 필요하면 writeback-cachekernel 밖 변경이 가능한 network filesystem이면 writeback-cache 전제 재검토

workload와 일관성 전제에 따른 선택 흐름입니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 ==============
4 FUSE I/O Modes
5 ==============
6
7 Fuse supports the following I/O modes:
8
9 - direct-io
10 - cached
11 + write-through
12 + writeback-cache
13
14 The direct-io mode can be selected with the FOPEN_DIRECT_IO flag in the
15 FUSE_OPEN reply.
16
17 In direct-io mode the page cache is completely bypassed for reads and writes.
18 No read-ahead takes place. Shared mmap is disabled by default. To allow shared
19 mmap, the FUSE_DIRECT_IO_ALLOW_MMAP flag may be enabled in the FUSE_INIT reply.
20
21 In cached mode reads may be satisfied from the page cache, and data may be
22 read-ahead by the kernel to fill the cache. The cache is always kept consistent
23 after any writes to the file. All mmap modes are supported.
24
25 The cached mode has two sub modes controlling how writes are handled. The
26 write-through mode is the default and is supported on all kernels. The
27 writeback-cache mode may be selected by the FUSE_WRITEBACK_CACHE flag in the
28 FUSE_INIT reply.
29
30 In write-through mode each write is immediately sent to userspace as one or more
31 WRITE requests, as well as updating any cached pages (and caching previously
32 uncached, but fully written pages). No READ requests are ever sent for writes,
33 so when an uncached page is partially written, the page is discarded.
34
35 In writeback-cache mode (enabled by the FUSE_WRITEBACK_CACHE flag) writes go to
36 the cache only, which means that the write(2) syscall can often complete very
37 fast. Dirty pages are written back implicitly (background writeback or page
38 reclaim on memory pressure) or explicitly (invoked by close(2), fsync(2) and
39 when the last ref to the file is being released on munmap(2)). This mode
40 assumes that all changes to the filesystem go through the FUSE kernel module
41 (size and atime/ctime/mtime attributes are kept up-to-date by the kernel), so
42 it's generally not suitable for network filesystems. If a partial page is
43 written, then the page needs to be first read from userspace. This means, that
44 even for files opened for O_WRONLY it is possible that READ requests will be
45 generated by the kernel.
46

3. 한국어 전문 번역

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

Direct I/O와 cached I/O

1-21

FUSE는 direct-io와 cached라는 두 상위 I/O mode를 지원합니다. cached mode의 쓰기 정책은 다시 write-through와 writeback-cache로 나뉩니다.

direct-io는 FUSE_OPEN reply에서 `FOPEN_DIRECT_IO` flag를 설정해 선택합니다.

direct-io mode에서는 read와 write 모두 page cache를 완전히 우회합니다. kernel read-ahead도 수행하지 않습니다.

shared mmap은 direct-io에서 기본적으로 비활성화됩니다. 허용하려면 FUSE_INIT reply에서 `FUSE_DIRECT_IO_ALLOW_MMAP` flag를 활성화해야 합니다.

cached mode에서는 page cache가 read를 충족할 수 있고 kernel이 cache를 채우기 위해 read-ahead를 수행할 수 있습니다. 파일에 write한 뒤에는 cache가 항상 일관된 상태로 유지됩니다.

cached mode는 모든 mmap mode를 지원합니다. 따라서 page cache를 통한 반복 읽기와 memory mapping이 필요한 workload는 cached mode의 특성을 활용할 수 있습니다.

FUSE 상위 I/O mode 비교
특성direct-iocached
선택 flag`FOPEN_DIRECT_IO`기본 cached 경로
page cacheread·write 모두 우회read 충족·write 일관성 유지
read-ahead없음kernel이 수행 가능
shared mmap기본 비활성, `FUSE_DIRECT_IO_ALLOW_MMAP` 필요지원
기타 mmap modedirect I/O 제약 적용모두 지원

page cache, read-ahead, mmap 지원의 차이입니다.

.. SPDX-License-Identifier: GPL-2.0

==============
FUSE I/O Modes
==============

Fuse supports the following I/O modes:

- direct-io
- cached
  + write-through
  + writeback-cache

The direct-io mode can be selected with the FOPEN_DIRECT_IO flag in the
FUSE_OPEN reply.

In direct-io mode the page cache is completely bypassed for reads and writes.
No read-ahead takes place. Shared mmap is disabled by default. To allow shared
mmap, the FUSE_DIRECT_IO_ALLOW_MMAP flag may be enabled in the FUSE_INIT reply.

In cached mode reads may be satisfied from the page cache, and data may be

Write-through와 writeback-cache

22-45

cached mode에는 write 처리 방식을 결정하는 두 submode가 있습니다. write-through는 기본값이며 모든 kernel에서 지원합니다. writeback-cache는 FUSE_INIT reply의 `FUSE_WRITEBACK_CACHE` flag로 선택합니다.

write-through에서는 각 write를 즉시 하나 이상의 FUSE `WRITE` request로 사용자 공간에 전달하고 cache된 page도 갱신합니다. 이전에 cache되지 않았지만 전체가 write된 page는 새로 cache합니다.

write-through는 write 처리를 위해 `READ` request를 보내지 않습니다. 따라서 cache에 없는 page의 일부만 write하면 나머지 내용을 채우기 위해 읽지 않고 그 page를 버립니다.

writeback-cache에서는 write가 cache에만 반영되므로 `write(2)` syscall이 매우 빠르게 끝날 수 있습니다. dirty page의 실제 writeback은 background writeback이나 memory pressure의 page reclaim으로 암묵적으로, 또는 `close(2)`, `fsync(2)`, `munmap(2)`에서 파일의 마지막 reference가 해제될 때 명시적으로 일어납니다.

이 mode는 filesystem의 모든 변경이 FUSE kernel module을 통과한다고 가정합니다. kernel이 size와 atime·ctime·mtime attribute를 최신 상태로 유지하기 때문입니다. 서버 측이나 다른 client가 kernel 밖에서 변경할 수 있는 network filesystem에는 일반적으로 적합하지 않습니다.

writeback-cache에서 page의 일부만 write하려면 보존할 나머지 byte가 필요하므로 먼저 사용자 공간에서 page를 읽어야 합니다. 그 결과 파일을 `O_WRONLY`로 열었더라도 kernel이 FUSE `READ` request를 만들 수 있습니다.

Cached write submode 비교
특성write-throughwriteback-cache
선택기본, 모든 kernel`FUSE_WRITEBACK_CACHE`
write 전달즉시 하나 이상의 `WRITE` request우선 cache만 갱신
dirty writebackwrite 호출 중background·reclaim·close·fsync·마지막 munmap
부분 uncached page`READ` 없이 page 폐기기존 page를 먼저 `READ`
`O_WRONLY`에서 READ생성하지 않음부분 page write에서 생성 가능
network filesystem변경 전달이 즉시 보임kernel 밖 변경 때문에 일반적으로 부적합

write syscall 완료와 사용자 공간 request 생성 시점을 비교합니다.

Writeback-cache의 부분 페이지 쓰기
애플리케이션이 cache에 없는 page 일부를 write나머지 byte를 보존하려면 기존 page 내용 필요kernel이 FUSE daemon에 `READ` request 생성읽은 page에 부분 write를 병합하고 dirty 표시`write(2)`는 cache 반영 뒤 빠르게 반환이후 writeback 조건에서 `WRITE` request 전송

O_WRONLY에서도 READ가 생길 수 있는 이유입니다.

read-ahead by the kernel to fill the cache.  The cache is always kept consistent
after any writes to the file.  All mmap modes are supported.

The cached mode has two sub modes controlling how writes are handled.  The
write-through mode is the default and is supported on all kernels.  The
writeback-cache mode may be selected by the FUSE_WRITEBACK_CACHE flag in the
FUSE_INIT reply.

In write-through mode each write is immediately sent to userspace as one or more
WRITE requests, as well as updating any cached pages (and caching previously
uncached, but fully written pages).  No READ requests are ever sent for writes,
so when an uncached page is partially written, the page is discarded.

In writeback-cache mode (enabled by the FUSE_WRITEBACK_CACHE flag) writes go to
the cache only, which means that the write(2) syscall can often complete very
fast.  Dirty pages are written back implicitly (background writeback or page
reclaim on memory pressure) or explicitly (invoked by close(2), fsync(2) and
when the last ref to the file is being released on munmap(2)).  This mode
assumes that all changes to the filesystem go through the FUSE kernel module
(size and atime/ctime/mtime attributes are kept up-to-date by the kernel), so
it's generally not suitable for network filesystems.  If a partial page is
written, then the page needs to be first read from userspace.  This means, that
even for files opened for O_WRONLY it is possible that READ requests will be
generated by the kernel.