]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: lookup for block group only if needed when freeing a tree block
authorFilipe Manana <fdmanana@suse.com>
Tue, 6 Jan 2015 20:18:45 +0000 (20:18 +0000)
committerChris Mason <clm@fb.com>
Thu, 22 Jan 2015 02:02:04 +0000 (18:02 -0800)
commit9af0763851c8f98fcd10b5e2171115b57212be7a
tree4129c11c168f2ed78e945d72f9017ee6a3d81e32
parentd862ebdcaba80b46ed345f87e50202b387f02575
Btrfs: lookup for block group only if needed when freeing a tree block

Very often our extent buffer's header generation doesn't match the current
transaction's id or it is also referenced by other trees (snapshots), so
we don't need the corresponding block group cache object. Therefore only
search for it if we are going to use it, so we avoid an unnecessary search
in the block groups rbtree (and acquiring and releasing its spinlock).

Freeing a tree block is performed when COWing or deleting a node/leaf,
which implies we are holding the node/leaf's parent node lock, therefore
reducing the amount of time spent when freeing a tree block helps reducing
the amount of time we are holding the parent node's lock.

For example, for a run of xfstests/generic/083, the block group cache
object was needed only 682 times for a total of 226691 calls to free
a tree block.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/extent-tree.c