歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux 文件系統Btrfs 的Kconfig分析

Linux 文件系統Btrfs 的Kconfig分析

日期:2017/2/28 15:29:45   编辑:Linux教程

這是我從網上下載的最新版的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和內存。

Copyright © Linux教程網 All Rights Reserved