
18th February 2012, 11:05 PM
|
|
Guest
|
|
Posts: n/a

|
|
|
Btrfs: introduce extent buffer cache for each i-node
Quote:
[RFC][PATCH] Btrfs: introduce extent buffer cache for each i-node
Miao Xie
Thu, 16 Feb 2012 01:47:08 -0800
This patch introduce extent buffer cache for every i-node. By this
way, we needn't search the item from the root of b+ tree, and can
save the search time. Besides that we can also reduce the lock contention
of the root.
Implementation:
- add two pointers of extent buffer into btrfs_inode struct, one for
nodes/leaves of fs/file tree, the other for nodes/leaves of the log tree.
- add a BTRFS_HEADER_FLAG_COWED flag, which is used to mark the cowed
nodes/leaves
- When we want to search fs/file trees or the relative log trees, we must
try to search the cached extent buffer at first, if we can not find the
item, we will do the common search. At some condition, we will jump to
the common search directly:
I. a new transaction starts.
II. the cached extent buffer was cowed.
III. the cached extent buffer's level is below the level we must lock.
and so on.
And beside that, if we can not find the item, and the slot points to the
first the item or the last item in the leaf, we must jump out the cached
extent buffer search, and do the common search.
- After the common search (use btrfs_search_slot), we will cache the leaf
or the level-1 node into the btrfs i-node object.
I have do small file write performance (inline file) by sysbench for the patch,
and found it can make btrfs 5%~10% faster.
Surely, I will do function test(such as xfstests) and run more performance test
next to validate this patch. And there is some redundant code in this patch. I
will cleanup it in the next version.
|
Read More Here
|