# obd デバイスモデル
## 定義
obd デバイスモデルは、ファイルシステムを構成する多様なコンポーネントを単一のデバイス抽象として統一的に登録・接続・解体し、対称ではない import/export の対でクライアント・サーバ関係を表現する設計パターンである。Lustre では obdclass サブシステムがこれを実装しており、MGC・MDC・OSC・LOV・LMV・MDT・OST といった機能の異なるコンポーネントを `obd_device` という単一の構造体で表現し、呼び出し側は `obd_ops`/`md_ops` の関数ポインタ経由で具体的な型を意識せずに汎用操作(attach・setup・cleanup・process_config 等)を適用できる。デバイスは `class_attach()` → `class_setup()` → `class_precleanup()`/`class_cleanup()` → `class_detach()` という単方向のライフサイクルを、`obd_device` 構造体のビットフラグ(`obd_attached`, `obd_set_up`, `obd_starting`, `obd_stopping`)で管理しながら進む。2 つの obd デバイスが通信するには import と export の対が必要で、クライアント側デバイスは self export と import を、サーバ側デバイスは export と reverse import を持つという非対称な接続モデルにより、通常のリクエスト送信と低頻度なサーバ→クライアントのコールバックの両方を同じ抽象の上に表現する。(Source: [[@2021__ORNL__Understanding Lustre Internals - Chapter 5 OBDCLASS]])
## 横断的知見
- [[@2021__ORNL__Understanding Lustre Internals - Chapter 4 MGC|第 4 章 MGC]]は obd デバイスモデルの最初の具体例であり、MGC のライフサイクル関数(`mgc_setup()`, `mgc_precleanup()`, `mgc_cleanup()`)はいずれも本 concept が定義する汎用ライフサイクル関数(`class_setup()` 等)から `OBP` マクロによる間接呼び出しで起動される。MGC 章で観察された「setup と cleanup がほぼ逆順の処理になる」という構造は、第 5 章が示す `class_setup()`/`class_cleanup()` の対称的な設計そのものの反映であり、単一デバイスの観察が一般パターンの具体例であったことが 2 章の突き合わせで裏付けられる。(Source: [[@2021__ORNL__Understanding Lustre Internals - Chapter 4 MGC]], [[@2021__ORNL__Understanding Lustre Internals - Chapter 5 OBDCLASS]])
- [[@2025__TOS__Lustre Unveiled - Chapter 3 Architectural Details of Lustre|Lustre Unveiled 第 3 章]]はクライアントの I/O 要求が `llite → LMV/LOV → MDC/OSC → PtlRPC → LNet` という層状スタックを経て、サーバ側では LDLM・MDD/OFD・OSD 層へ処理が渡ると説明しており、MDC・OSC・OFD をアーキテクチャ上の「層」として描く。これに対し `Understanding Lustre Internals` 第 5 章は同じ MDC・OSC・OFD を obd デバイスという単一の実装抽象のインスタンスとして描いており、両者は同じコンポーネント群を異なる粒度(アーキテクチャ上の層 対 実装上のデバイス抽象)で説明していることが分かる。Lustre Unveiled はこの層をアーキテクチャ図として提示するにとどまり、`class_attach()`/`class_setup()` のようなライフサイクル実装や import/export の非対称性には踏み込んでいない。(Source: [[@2025__TOS__Lustre Unveiled - Chapter 3 Architectural Details of Lustre]], [[@2021__ORNL__Understanding Lustre Internals - Chapter 5 OBDCLASS]])
## 未解決の問い
- obd デバイスモデルは Lustre 固有の設計か、他の分散ファイルシステム(Ceph の OSD、GlusterFS の translator 等)にも類似のデバイス抽象・import/export 相当の接続モデルが存在するか。他システムとの比較 source が蓄積されたら追記する。
- `class_setup()` の `obd_starting` フラグと `class_cleanup()` の `obd_stopping` フラグは排他的に扱われるのか、それとも一時的に両立しうる状態遷移があるのか(第 6 章 LIBCFS や第 7 章での参照があれば確認する)。
## 関連
- 実体: [[Lustre]] / [[Understanding Lustre Internals]] / [[Lustre Unveiled]]
- source: [[@2021__ORNL__Understanding Lustre Internals - Chapter 4 MGC]] / [[@2021__ORNL__Understanding Lustre Internals - Chapter 5 OBDCLASS]] / [[@2025__TOS__Lustre Unveiled - Chapter 3 Architectural Details of Lustre]]
## 出典
- Anjus George, Rick Mohr, *Understanding Lustre Internals, Second Edition*, Oak Ridge National Laboratory, ORNL/TM-2021/2131, 2021, Chapter 5.