Rewriting the Buffer Layer
http://kerneltrap.org/node/8434
ファイルシステムのsuper blockやinodeなどのメタデータの管理に使われているbufferレイヤ*1を書き直すという話.
bufferはブロックデバイスの論理ブロックに対応し,kernel 2.4ではファイルシステムとブロックデバイス間のデータ受け渡しの際に用いられていた(submit_bh()など).2.6では,受け渡しに関しては複数ページ(キャッシュ)を扱えるBIOに取って代わられた(submit_bio()など)が,メタデータの管理に関してはbufferが用いられている*2.
bufferの何が問題か?
"Why rewrite the buffer layer? (中略) Because the code is old and crufty, and buffer_head is an awful name. It must be among the oldest code in the core fs/vm, and the main reason is because of the inertia of so many and such complex filesystems."
どう変更するのか? (抜粋)
- buffer_headをfsblockと書き直す.
The name is fsblock because it basically ties the fs layer to the block layer.
- buffer_headに対しfsblock構造体サイズを縮小する
- buffer_head群がリンクリストで管理されているのに対し,fsblockは連続領域に確保する
- fsblockとfsblock_meta構造体により,データとメタデータを別に管理する(?)
- ロックに際し,buffer_headの持つinode毎のロックではなく,pagecacheのロックを用いる
等々
*1:"the buffer layer is a layer between the pagecache and the block device for block based filesystems. It keeps a translation between logical offset and physical block number, as well as meta information such as locks, dirtyness, and IO status of each block. This information is tracked via the buffer_head structure."
*2:Buffer - Linuxカーネルメモ ,http://hira.main.jp/wiki/pukiwiki.php?page_buffers%28%29%2Flinux2.6