红联Linux门户
Linux帮助

Linux文件系统Btrfs的Kconfig分析

发布时间:2014-08-08 15:30:03来源:linux网站作者:stephenkung

这是我从网上下载的最新版的linux3.7-rc2版的内核,所谓rc版,就是修复(rescovery)版的意思。因为之前参加linux内核开发者大会的时候,讲btrfs文件系统的人不少,说这是新一代文件系统,支持很多相当先进的功能,有望取代EXT4文件系统,所以就down下来看看。以下是btrfs的Kconfig文件。我给注释一下,也是为了方便自己以后的学习。毕竟我对内核懂的也是不多,但是多发博文有助于自己的思考。


以下英文是Kconfig全文,中文是注释:


config BTRFS_FS
/*表示此条目与BTRFS_FS选项对应,该选项在Makefile中会出现。我们知道Kconfig就是Makefile的图片版,所以Kconfig中的选项是否选中,直接关系Makefile如何执行。Makefile中对应语句为:obj-$(CONFIG_BTRFS_FS) := btrfs.o,意思是如果BTRFS_FS配置为Y(即CONFIG_BTRFS_FS为1),则btrfs被编译进内核 。*/

tristate "Btrfs filesystem (EXPERIMENTAL) Unstable disk format"
/*该选项的名称为Btrfs filesystem (EXPERIMENTAL) Unstable disk format,可以选Y,N或者M,即可以编译进内核,或者不编译,或者编译成模块*/

depends on EXPERIMENTAL
/*该选项依赖于EXPERIMENTAL,只有EXPERIMENTAL被选为Y,BTRFS_FS选项才可能被选为Y;否则BTRFS_FS选项根本就不会出现*/

select LIBCRC32C
select ZLIB_INFLATE
select ZLIB_DEFLATE
select LZO_COMPRESS
select LZO_DECOMPRESS
/*select表示反向依赖,即一旦BTRFS_FS被选为Y,则select后面的这些都被选上了,这个过程刚好与depends on相反。*/

help
Btrfs is a new filesystem with extents, writable snapshotting,
support for multiple devices and many more features.
Btrfs is highly experimental, and THE DISK FORMAT IS NOT YET
FINALIZED. You should say N here unless you are interested in
testing Btrfs with non-critical data.
To compile this file system support as a module, choose M here. The
module will be called btrfs.

If unsure, say N.
/*help提示,btrfs具有可写的快照功能,但是目前只是实验性的,你可以在没有重要数据的硬盘上尝试这个文件系统*/

config BTRFS_FS_POSIX_ACL
/*另一个配置选项,与Makefile关联: btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o ,即如果BTRFS_FS_POSIX_ACL配置为Y,则多编译一个acl.o文件*/

bool "Btrfs POSIX Access Control Lists" //该配置选项是布尔型的,只有选中和不选中两种。depends on BTRFS_FS //该配置选项依赖于BTRFS_FS的结果,再现depends on。

select FS_POSIX_ACL //再现select。

help
POSIX Access Control Lists (ACLs) support permissions for users and
groups beyond the owner/group/world scheme.
To learn more about Access Control Lists, visit the POSIX ACLs for
Linux website <http://acl.bestbits.at/>.
If you don't know what Access Control Lists are, say N

config BTRFS_FS_CHECK_INTEGRITY
/*第三个配置选项,在Makefile中关联的句子是:btrfs-$(CONFIG_BTRFS_FS_CHECK_INTEGRITY) += check-integrity.o ,即如果该选项选Y,那么check-integrity.o文件将被编译进内核。*/

bool "Btrfs with integrity check tool compiled in (DANGEROUS)"
//该配置选项是布尔型的,名字叫Btrfs with integrity check tool compiled in (DANGEROUS),只有选中和不选中两种结果。

depends on BTRFS_FS
help
Adds code that examines all block write requests (including
writes of the super block). The goal is to verify that the
state of the filesystem on disk is always consistent, i.e.,
after a power-loss or kernel panic event the filesystem is
in a consistent state.

If the integrity check tool is included and activated in
the mount options, plenty of kernel memory is used, and
plenty of additional CPU cycles are spent. Enabling this
functionality is not intended for normal use.

In most cases, unless you are a btrfs developer who needs
to verify the integrity of (super)-block write requests
during the run of a regression test, say N
//help指明该配置选项是供开发者来检验文件系统一致性的, 会消耗CPU和内存。