文章是去年中旬lwn发表的,算是入门btrfs的小文。()
对于有过fs开发经验的童鞋來說,,看懂這篇文章并不難。尤其是看到作者深入讲述了btrfs的诸多优点后,脑海里的文件系统的数据布局比较,很容易理解他的优势。 比如inode,file,directory-entry,BITMAP等等,BTRFS完全用BTREE来组织,节省了查找的时间。先简单看下面两张图:
Btrfs, instead, creates a disk layout which looks more like:
In both diagrams, red blocks denote wasted disk space and red arrows denote seeks
第二张图片,打眼一看就知道与上面图片中所代表的谁好谁差了。明显下面的同一个object的数据是聚合在一起。
这里有两个概念:抽象数据与原生数据。 BTRFS ON-DISK DATAS ONLY CONTAINS 三种类型,disk-key/header/item。但是许多抽象的树也放在磁盘里,这些抽象出来的数据是有上面三种原生数据构成的。
还有,原生数据本身也是抽象数据的一部分。
比如下面这段话:
We should take a quick look at the structure of the btree nodes and leaves themselves. Each node and leaf is an extent in the btree - nodes are extents full of
pairs, and leaves contain items. Large file data is stored outside of the btree leaves, with the item describing the extent kept in the leaf itself.
btrfs extent Back references 先弄清楚这个概念。
Back references give btrfs a major advantage over every other file system in its class
“The result is beautifully generic and elegant: Everything on disk is a btree containing reference counted, checksummed extents of items, organized by
keys.”
有点像cgroup里的css_set。
Back references have three main goals:
- Differentiate between all holders of references to an extent so that when a reference is dropped we can make sure it was a valid reference before freeing the extent.
- Provide enough information to quickly find the holders of an extent if we notice a given block is corrupted or bad.
- Make it easy to migrate blocks for FS shrinking or storage pool maintenance. This is actually the same as #2, but with a slightly different use case.
File Extent Backrefs
Btree Extent Backrefs
阅读(1003) | 评论(0) | 转发(0) |