Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Btrfsの構造
Search
naota
October 19, 2013
Programming
5
2.7k
Btrfsの構造
naota
October 19, 2013
Tweet
Share
More Decks by naota
See All by naota
btrfs領域管理一代記
naota
2
1k
ファイルシステムの歴史: ジャーナリング編
naota
2
960
DockerでGentooのテスト
naota
3
1.7k
Btrfsのころしかた(だったもの)
naota
0
1k
Other Decks in Programming
See All in Programming
Modern Functional Fluent CFML REST by Luis Majano
ortus24
0
140
ML-прайсинг_на_Lamoda__вошли_и_вышли__приключение_на_20_минут__Слава_Цыганков.pdf
lamodatech
0
240
ポケモンで考えるコミュニケーション / Communication Lessons from Pokémon
mackey0225
4
180
"Swarming" をコンセプトに掲げるアジャイルチームのベストプラクティス
boykush
2
260
Unlocking Python's Core Magic
leew
0
130
型付きで行うVSCode拡張機能開発 / VSCode Meetup #31
mazrean
0
240
複数プロダクトの技術改善・クラウド移行に向き合うチームのフレキシブルなペア・モブプログラミングの実践 / Flexible Pair Programming And Mob Programming
honyanya
0
230
Subclassing, Composition, Python, and You
hynek
3
180
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
720
コードレビューと私の過去と未来
jxmtst
0
290
Jakarta EE as Seen Trough the Lens of the ASF
ivargrimstad
0
350
Micro Frontends for Java Microservices - dev2next 2024
mraible
PRO
0
210
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Learning to Love Humans: Emotional Interface Design
aarron
272
40k
The Pragmatic Product Professional
lauravandoore
31
6.2k
Done Done
chrislema
181
16k
Designing Experiences People Love
moore
138
23k
The Invisible Customer
myddelton
119
13k
Making Projects Easy
brettharned
115
5.9k
Automating Front-end Workflow
addyosmani
1365
200k
Web Components: a chance to create the future
zenorocha
310
42k
Building an army of robots
kneath
302
42k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.8k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
355
29k
Transcript
Btrfs ͷػೳɾಛ BtrfsͬͯͲΜͳϑΝΠϧγεςϜ? 2013-06-14 1 / 51
Btrfs ͷػೳɾಛ 2013-06-14 2 / 51
Btrfs ͷػೳɾಛ . . Copy On Write 2013-06-14 3 /
51
Btrfs ͷػೳɾಛ . . Journal 2013-06-14 4 / 51
Btrfs ͷػೳɾಛ 2013-06-14 5 / 51
Btrfs ͷػೳɾಛ 2013-06-14 6 / 51
Btrfs ͷػೳɾಛ . . Journal ͷऑ ʮδϟʔφϧʯͱʮຊମʯͱೋճॻ͔ͳ͚Ε͍͚ͳ͍ σʔλδϟʔφϧԽ͢Δͷޮ͕ѱ͍ ϝλσʔλͳΒ͍͚Δ 2013-06-14
7 / 51
Btrfs ͷػೳɾಛ 2013-06-14 8 / 51
Btrfs ͷػೳɾಛ . . Copy On Write Ұճ͔͠ॻ͔ͳ͍͍ͯ͘ σʔλɾϝλσʔλ྆ํͷ߹ੑΛอͭͷʹ͑Δ 2013-06-14
9 / 51
Btrfs ͷػೳɾಛ . . εφοϓγϣ οτ 2013-06-14 10 / 51
Btrfs ͷػೳɾಛ . . σϑϥά 2013-06-14 11 / 51
Btrfs ͷػೳɾಛ . . Quota QGroup ͱݺΕΔಛघͳ quota εφοϓγϣ οτ͕͋ΔͷͰʮڞ༗σʔλʯ͕ଘࡏ͢Δ
ʮશମͷαΠζʯͱʮڞ༗͞Ε͍ͯͳ͍αΠζʯʹΑΔ੍ݶ͕Ͱ͖Δ ڈͷ Software Design10 ݄߸ʹࡌͬͯ·͢ 2013-06-14 12 / 51
Btrfs ͷػೳɾಛ . . Ext2/3 ͔Βͷ convert ext2/3 ͷσʔλ͕ͦͷ··มͰ͖·͢ ؾʹ͍Βͳ͚Εݩʹͤ·͢
2013-06-14 13 / 51
Btrfs ͷػೳɾಛ . . ͦͷଞ 16EiB ·Ͱ͑Δ (XFS ͷ 2
ഒ!) checksum ͕͋Δ͔ΒϒϩοΫͷ߹ੑνΣ οΫ OK! ಁաతѹॖͰ༰ྔઅ! RAID Ͱ৴པੑ্! send/receive ͰޮతͳόοΫΞοϓ! Hot add/remove ͰΒ͘Β͘σΟεΫަ! dedup Ͱॏෳഉআ! SSD ༻࠷దԽ͋ΔΑ! 2013-06-14 14 / 51
Btrfs ͷػೳɾಛ . . কདྷతʹ ॻ͖͜Έͱಉ࣌ʹࣗಈ dedup hot data tracking
ͰΑ͘ΞΫηε͢ΔϑΝΠϧΛ SSD ʹΩϟ ογϡ! fsck? 2013-06-14 15 / 51
Btrfs ͷػೳɾಛ . . ͍ͨ͘ͳ͖ͬͯͨͰ͠ΐ? 2013-06-14 16 / 51
B . . B Btrfs ͷ΄ͱΜͲ͍ͨΔͱ͜ΖͰΘΕΔσʔλߏ ͜Ε͕Θ͔Βͳ͍ͱ Btrfs
͕Θ͔Βͳ͍ ͳΜͱ͍ͬͯ “BtrFS” = “B-Tree File System” Ͱ͔͢Βͳ! 2013-06-14 17 / 51
B . . ೋ୳ࡧ 2013-06-14 18 / 51
B . . B 2013-06-14 19 / 51
B . . B ͷૠೖ 2013-06-14 20 / 51
B . . ׂ 2013-06-14 21 / 51
B . . CoW ૠೖ 2013-06-14 22 / 51
B 2013-06-14 23 / 51
B 2013-06-14 24 / 51
B 2013-06-14 25 / 51
B 2013-06-14 26 / 51
B 2013-06-14 27 / 51
B 2013-06-14 28 / 51
Btrfs ͷ . . Btrfs ͷ B Key ΦϒδΣΫτ
ID λΠϓ Φϑηοτ ϊʔυͱϦʔϑ Ұ൪Լ͕ϦʔϑɺΓ͕Λϊʔυ ϦʔϑʹΩʔʹରԠ͢Δσʔλ͕อ͞ΕΔ 2013-06-14 29 / 51
Btrfs ͷ 2013-06-14 30 / 51
Btrfs ͷ . . ༷ʑͳ Root tree FS tree extent
tree chunk tree device tree CSum tree 2013-06-14 31 / 51
Btrfs ͷ . . Root Tree جຊͷ! ଞͷͷ root Λอ࣋
αϒϘϦϡʔϜߏͷऔಘ 2013-06-14 32 / 51
Btrfs ͷ . . FS Tree αϒϘϦϡʔϜɾεφοϓγϣ οτ͝ͱʹ FS tree
ͷ root ͕͋Δ σΟϨΫτϦߏ i-node ใ ϑΝΠϧσʔλҐஔ (extent address) 2013-06-14 33 / 51
Btrfs ͷ . . chunk ͱ extent 2013-06-14 34 /
51
Btrfs ͷ . . device treeɾCSum tree device tree Btrfs
ʹొ͞Ε͍ͯΔσόΠεͷཧ CSum tree 4KB ͝ͱͷ checksum 2013-06-14 35 / 51
Btrfs ͷ . . ୳ͯ͠ΈΑ͏ 2013-06-14 36 / 51
bootstrap Btrfs ͷ tree ϑΝΠϧશͯ extent address(ཧΞυϨε) ͰΞΫ ηε Root
tree extent address ͰΞΫηε͞ΕΔ chunk tree ࣗ Ͳ͏ͬͯ࠷ॳͷ extent address ΛཧΞυϨεʹϚοϐϯά͢ Δͷ? 2013-06-14 37 / 51
bootstrap . . superblock btrfs Ͱ།ҰཧతʹΞυϨε͕ܾ·͍ͬͯΔ ύʔςΟγϣϯ ઌ಄͔Β 6410KiB, 6410MiB,
25610GiB, 1PiB root ͷ extent address root tree chunk tree system chunk ͷ chunk ใ chunk tree ͷϊʔυ, Ϧʔϑ system chunk ͔ΒׂΓͯΒΕΔ 2013-06-14 38 / 51
bootstrap . . system chunk 2013-06-14 39 / 51
bootstrap 2013-06-14 40 / 51
࠷ۙͷ͜ͱ ࠷ޙʹ͜ͷ 1 ݄͙Β͍;Έ·ͬͯ͘Δ assert ʹ͍ͭͯ͠·͢ 2013-06-14 41 / 51
࠷ۙͷ͜ͱ . . dump [42604.796633] BTRFS assertion failed: !memcmp_extent_buffer( b,
&disk_key, offsetof(struct btrfs_leaf, items[0].key), sizeof(disk_key)), file: fs/btrfs/ctree.c, line: 2444 2013-06-14 42 / 51
࠷ۙͷ͜ͱ . . Ωʔ୳ࡧͷ࠷దԽ 2013-06-14 43 / 51
࠷ۙͷ͜ͱ . . snapshot aware defrag 2013-06-14 44 / 51
࠷ۙͷ͜ͱ 2013-06-14 45 / 51
࠷ۙͷ͜ͱ . . tree mod log B-tree ͷมߋ࣌ʹมߋલʹͲ͏͍͏͕ೖ͍͔ͬͯͨΛه transaction ͝ͱʹϦηοτ͞ΕΔ
ϝϞϦ্͚ͩͰσΟεΫʹॻ͔Εͳ͍ ͜ΕͰʮੲͷ B-treeʯΛͱΓ͕ͩͦ͢Ε͕όάͬͯΔ? 2013-06-14 46 / 51
࠷ۙͷ͜ͱ . . ݪҼʜͳΜͰͩΖ͏? 2013-06-14 47 / 51
࠷ۙͷ͜ͱ ·͋ͱΓ͋͑ͣʮࣗಈσϑϥάʯ͓͚ͬͯ (σϑΥϧτ:Φϑ) ͍͍ͱ ࢥ͏Α? 2013-06-14 48 / 51
࠷ۙͷ͜ͱ . . ͓͠·͍ 2013-06-14 49 / 51
ϦϯΫ . . ࢀߟจݙ https://btrfs.wiki.kernel.org/ https://events.linuxfoundation.org/sites/events/files/ slides/LinuxCon_2013_NA_Eckermann_Filesystems_btrfs.pdf http://people.redhat.com/lczerner/files/btrfs_lczerner.pdf https://www.usenix.org/legacy/event/lsf07/tech/rodeh.pdf 2013-06-14
50 / 51
ϦϯΫ . . ը૾ http://www.flickr.com/photos/artofphotography-ramsner/9592744354 http://www.flickr.com/photos/surferbill/2506950772/ http://www.flickr.com/photos/rore/1304728223/ http://ja.wikipedia.org/wiki/ %E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB: Binary_search_tree.svg
http://www.flickr.com/photos/protohiro/85504626/ http://www.flickr.com/photos/rubyji/74176893/ http://www.flickr.com/photos/rore/1304728223/ http://www.flickr.com/photos/dolfiedream/5060030894/ 2013-06-14 51 / 51