요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
Message, status와 workflow
era.rst:30-93Checkpoint·metadata snapshot과 vendor rollback 절차를 정리합니다.
Memory와 crash resilience
era.rst:94-116Bitset 비용, metadata-first write ordering과 userspace 도구를 설명합니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
======
dm-era
======
Introduction
============
dm-era is a target that behaves similar to the linear target. In
addition it keeps track of which blocks were written within a user
defined period of time called an 'era'. Each era target instance
maintains the current era as a monotonically increasing 32-bit
counter.
Use cases include tracking changed blocks for backup software, and
partially invalidating the contents of a cache to restore cache
coherency after rolling back a vendor snapshot.
Constructor
===========
era <metadata dev> <origin dev> <block size>
================ ======================================================
metadata dev fast device holding the persistent metadata
origin dev device holding data blocks that may change
block size block size of origin data device, granularity that is
tracked by the target
================ ======================================================
Messages
========
None of the dm messages take any arguments.
checkpoint
----------
Possibly move to a new era. You shouldn't assume the era has
incremented. After sending this message, you should check the
current era via the status line.
take_metadata_snap
------------------
Create a clone of the metadata, to allow a userland process to read it.
drop_metadata_snap
------------------
Drop the metadata snapshot.
Status
======
<metadata block size> <#used metadata blocks>/<#total metadata blocks>
<current era> <held metadata root | '-'>
========================= ==============================================
metadata block size Fixed block size for each metadata block in
sectors
#used metadata blocks Number of metadata blocks used
#total metadata blocks Total number of metadata blocks
current era The current era
held metadata root The location, in blocks, of the metadata root
that has been 'held' for userspace read
access. '-' indicates there is no held root
========================= ==============================================
Detailed use case
=================
The scenario of invalidating a cache when rolling back a vendor
snapshot was the primary use case when developing this target:
Taking a vendor snapshot
------------------------
- Send a checkpoint message to the era target
- Make a note of the current era in its status line
- Take vendor snapshot (the era and snapshot should be forever
associated now).
Rolling back to an vendor snapshot
----------------------------------
- Cache enters passthrough mode (see: dm-cache's docs in cache.txt)
- Rollback vendor storage
- Take metadata snapshot
- Ascertain which blocks have been written since the snapshot was taken
by checking each block's era
- Invalidate those blocks in the caching software
- Cache returns to writeback/writethrough mode
Memory usage
============
The target uses a bitset to record writes in the current era. It also
has a spare bitset ready for switching over to a new era. Other than
that it uses a few 4k blocks for updating metadata::
(4 * nr_blocks) bytes + buffers
Resilience
==========
Metadata is updated on disk before a write to a previously unwritten
block is performed. As such dm-era should not be effected by a hard
crash such as power failure.
Userland tools
==============
Userland tools are found in the increasingly poorly named
thin-provisioning-tools project:
https://github.com/jthornber/thin-provisioning-tools
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
시간 구간별 changed-block 추적
1-17`dm-era`는 linear target과 비슷하게 동작하면서 사용자가 정의한 `era`라는 기간 안에 어떤 block이 write됐는지 추적합니다. 각 target instance는 현재 era를 단조 증가하는 32-bit counter로 유지합니다.
Checkpoint 사이의 write를 하나의 시대 번호와 연결합니다.
주요 용도는 backup software가 변경 block을 추적하는 것과, vendor snapshot을 rollback한 뒤 cache 일관성을 복구하기 위해 cache 내용 일부를 invalidate하는 것입니다.
Block별 마지막 write era를 이용하는 두 작업입니다.
Metadata·origin device와 추적 granularity
18-29Constructor 형식은 metadata device, origin data device와 추적 block size를 차례로 지정합니다.
era <metadata dev> <origin dev> <block size>
Persistent metadata 위치와 changed-block 추적 단위를 정의합니다.
================ ======================================================
metadata dev fast device holding the persistent metadata
origin dev device holding data blocks that may change
block size block size of origin data device, granularity that is
tracked by the target
================ ======================================================
Checkpoint와 metadata snapshot message
30-51모든 dm message는 인자를 받지 않습니다.
Era 전환과 userspace metadata 읽기용 snapshot을 제어합니다.
Message 성공과 era 증가 여부를 분리해 status로 최종 확인합니다.
Metadata 사용량, current era와 held root
52-68Status는 metadata block size와 사용량, current era, userspace read를 위해 hold한 metadata root 위치를 반환합니다.
<metadata block size> <#used metadata blocks>/<#total metadata blocks>
<current era> <held metadata root | '-'>
Metadata 공간과 snapshot-access 상태를 보여 줍니다.
========================= ==============================================
metadata block size Fixed block size for each metadata block in
sectors
#used metadata blocks Number of metadata blocks used
#total metadata blocks Total number of metadata blocks
current era The current era
held metadata root The location, in blocks, of the metadata root
that has been 'held' for userspace read
access. '-' indicates there is no held root
========================= ==============================================
Vendor snapshot 생성과 rollback cache 복구
69-93Vendor snapshot rollback 뒤 cache를 invalidate하는 시나리오가 target 개발의 주된 use case였습니다.
Snapshot과 당시 era 번호를 영구적으로 연결합니다.
Snapshot 이후 write된 block만 골라 cache coherency를 복구합니다.
Passthrough mode는 dm-cache 문서를 참고합니다. Rollback 중에는 stale cache data를 사용하지 않고, era metadata snapshot으로 필요한 invalidation 범위를 확정합니다.
두 bitset의 memory 비용과 crash ordering
94-108Target은 현재 era write를 기록하는 bitset과 새 era로 전환할 때 즉시 사용할 spare bitset을 유지합니다. 그 밖에는 metadata update를 위한 몇 개의 4 KiB buffer를 사용합니다.
(4 * nr_blocks) bytes + buffers
Block 수에 비례하는 두 bitset과 소수 metadata buffer로 구성됩니다.
이전에 write되지 않은 block에 실제 data write를 수행하기 전에 on-disk metadata를 먼저 갱신합니다. 따라서 power failure 같은 hard crash가 발생해도 `dm-era` 추적 정보가 write보다 뒤처지지 않습니다.
Changed-block metadata를 data보다 먼저 durable하게 만들어 누락을 방지합니다.
thin-provisioning-tools의 userspace 도구
109-116Userspace 도구는 이름과 달리 범위가 넓어진 `thin-provisioning-tools` project에 있습니다.
https://github.com/jthornber/thin-provisioning-tools
Metadata를 읽고 era 정보를 활용하는 도구의 upstream 위치입니다.
Era 추적 모델
era.rst:1-29Changed-block counter, use case와 constructor granularity를 설명합니다.