diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2013-10-14 12:59:45 +0800 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-01-28 13:19:22 -0800 |
commit | c46effa601f869f3d20a7386a745d9c002838eb8 (patch) | |
tree | 7aa114c1a78e1834950a34524c8ada82569af50b /fs/btrfs/delayed-ref.h | |
parent | e20d6c5ba38d066c7dc0f7d3b68da14b9ae7fe37 (diff) | |
download | op-kernel-dev-c46effa601f869f3d20a7386a745d9c002838eb8.zip op-kernel-dev-c46effa601f869f3d20a7386a745d9c002838eb8.tar.gz |
Btrfs: introduce a head ref rbtree
The way how we process delayed refs is
1) get a bunch of head refs,
2) pick up one head ref,
3) go one node back for any delayed ref updates.
The head ref is also linked in the same rbtree as the delayed ref is,
so in 1) stage, we have to walk one by one including not only head refs, but
delayed refs.
When we have a great number of delayed refs pending to process,
this'll cost time a lot.
Here we introduce a head ref specific rbtree, it only has head refs, so troubles
go away.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/delayed-ref.h')
-rw-r--r-- | fs/btrfs/delayed-ref.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/delayed-ref.h b/fs/btrfs/delayed-ref.h index 70b962c..a54c9d47 100644 --- a/fs/btrfs/delayed-ref.h +++ b/fs/btrfs/delayed-ref.h @@ -83,6 +83,8 @@ struct btrfs_delayed_ref_head { struct list_head cluster; + struct rb_node href_node; + struct btrfs_delayed_extent_op *extent_op; /* * when a new extent is allocated, it is just reserved in memory @@ -118,6 +120,9 @@ struct btrfs_delayed_data_ref { struct btrfs_delayed_ref_root { struct rb_root root; + /* head ref rbtree */ + struct rb_root href_root; + /* this spin lock protects the rbtree and the entries inside */ spinlock_t lock; |