Skip to content

btrfs: delayed refs cleanups

Josef Bacik linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest19 patches 19 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19btrfs: add a helper to get the delayed ref node from the data/tree reffs/btrfs/delayed-ref.c fs/btrfs/delayed-ref.h+31 -91 reply
2/19btrfs: embed data_ref and tree_ref in btrfs_delayed_ref_nodefs/btrfs/delayed-ref.c fs/btrfs/delayed-ref.h+40 -551 reply
3/19btrfs: do not use a function to initialize btrfs_reffs/btrfs/delayed-ref.c fs/btrfs/delayed-ref.h fs/btrfs/extent-tree.c +4 more+131 -961 reply
4/19btrfs: move ref_root into btrfs_reffs/btrfs/delayed-ref.c fs/btrfs/delayed-ref.h fs/btrfs/extent-tree.c +5 more+73 -881 reply
5/19btrfs: pass btrfs_ref to init_delayed_ref_commonfs/btrfs/delayed-ref.c fs/btrfs/delayed-ref.h+27 -211 reply
6/19btrfs: initialize btrfs_delayed_ref_head with btrfs_reffs/btrfs/delayed-ref.c+25 -281 reply
7/19btrfs: move ref specific initialization into init_delayed_ref_commonfs/btrfs/delayed-ref.c+11 -141 reply
8/19btrfs: simplify delayed ref tracepointsfs/btrfs/delayed-ref.c fs/btrfs/extent-tree.c include/trace/events/btrfs.h+25 -471 reply
9/19btrfs: unify the btrfs_add_delayed_*_ref helpers into one helperfs/btrfs/delayed-ref.c+28 -781 reply
10/19btrfs: rename ->len to ->num_bytes in btrfs_reffs/btrfs/delayed-ref.c fs/btrfs/delayed-ref.h fs/btrfs/extent-tree.c +5 more+27 -271 reply
11/19btrfs: move ->parent and ->ref_root into btrfs_delayed_ref_nodefs/btrfs/backref.c fs/btrfs/delayed-ref.c fs/btrfs/delayed-ref.h +2 more+52 -811 reply
12/19btrfs: rename btrfs_data_ref->ino to ->objectidfs/btrfs/delayed-ref.c fs/btrfs/delayed-ref.h fs/btrfs/ref-verify.c+4 -41 reply
13/19btrfs: make __btrfs_inc_extent_ref take a btrfs_delayed_ref_nodefs/btrfs/delayed-ref.h fs/btrfs/extent-tree.c+25 -321 reply
14/19btrfs: drop unnecessary arguments from __btrfs_free_extentfs/btrfs/extent-tree.c+8 -151 reply
15/19btrfs: make the insert backref helpers take a btrfs_delayed_ref_nodefs/btrfs/extent-tree.c+21 -251 reply
16/19btrfs: stop referencing btrfs_delayed_data_ref directlyfs/btrfs/backref.c fs/btrfs/extent-tree.c include/trace/events/btrfs.h+13 -151 reply
17/19btrfs: stop referencing btrfs_delayed_tree_ref directlyfs/btrfs/backref.c fs/btrfs/extent-tree.c include/trace/events/btrfs.h+16 -161 reply
18/19btrfs: remove the btrfs_delayed_ref_node container helpersfs/btrfs/delayed-ref.h+0 -271 reply
19/19btrfs: replace btrfs_delayed_*_ref with btrfs_*_reffs/btrfs/delayed-ref.c fs/btrfs/delayed-ref.h+28 -391 reply

Reviews trailers per patch

All 19 patches have a Reviewed-by or Acked-by.

PatchFilipe Manana
1/19R-b
2/19R-b
3/19R-b
4/19R-b
5/19R-b
6/19R-b
7/19R-b
8/19R-b
9/19R-b
10/19R-b
11/19R-b
12/19R-b
13/19R-b
14/19R-b
15/19R-b
16/19R-b
17/19R-b
18/19R-b
19/19R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/19] btrfs: delayed refs cleanups

Hello,

While I was fixing the snapshot deletion corruption I noticed a lot of silly duplication when it comes to delayed refs. We have two things to refer to references, and use different names for the same thing, anybody who doesn't know what this code does would understandably be confused.

I reworked all of this to consolidate everything into btrfs_delayed_ref_node, and got rid of the type specific wrapper structs. I made the initialization of the btrfs_ref for the actions clearer instead of a 6 argument initialization function. I used this simplification to reduce the duplicated code around adding new delayed refs. The result is a net removal of 130 lines of code, and makes several of the call chains clearer as we just pass the btrfs_delayed_ref_node around where we can.

I want to cleanup how we lookup delayed ref heads and how we handle those cases, but I'm much more cautious around that code because there's some guarantees about parallel modifications that are maintained by the current status quo, and I'm afraid cleaning that code up will result in subtle bugs.

These cleanups should be relatively safe as they have no behavior changes. I've run it through fstests to validate nothing broke. Thanks,

Josef

Josef Bacik (19):
btrfs: add a helper to get the delayed ref node from the data/tree ref
btrfs: embed data_ref and tree_ref in btrfs_delayed_ref_node
btrfs: do not use a function to initialize btrfs_ref
btrfs: move ref_root into btrfs_ref
btrfs: pass btrfs_ref to init_delayed_ref_common
btrfs: initialize btrfs_delayed_ref_head with btrfs_ref
btrfs: move ref specific initialization into init_delayed_ref_common
btrfs: simplify delayed ref tracepoints
btrfs: unify the btrfs_add_delayed_*_ref helpers into one helper
btrfs: rename ->len to ->num_bytes in btrfs_ref
btrfs: move ->parent and ->ref_root into btrfs_delayed_ref_node
btrfs: rename btrfs_data_ref->ino to ->objectid
btrfs: make __btrfs_inc_extent_ref take a btrfs_delayed_ref_node
btrfs: drop unnecessary arguments from __btrfs_free_extent
btrfs: make the insert backref helpers take a btrfs_delayed_ref_node
btrfs: stop referencing btrfs_delayed_data_ref directly
btrfs: stop referencing btrfs_delayed_tree_ref directly
btrfs: remove the btrfs_delayed_ref_node container helpers
btrfs: replace btrfs_delayed_*_ref with btrfs_*_ref

 fs/btrfs/backref.c           |  40 ++--
 fs/btrfs/delayed-ref.c       | 369 +++++++++++------------------------
 fs/btrfs/delayed-ref.h       | 148 +++++++-------
 fs/btrfs/extent-tree.c       | 273 ++++++++++++--------------
 fs/btrfs/file.c              |  79 ++++----
 fs/btrfs/inode-item.c        |  16 +-
 fs/btrfs/ref-verify.c        |   8 +-
 fs/btrfs/relocation.c        |  84 +++++---
 fs/btrfs/tree-log.c          |  17 +-
 include/trace/events/btrfs.h |  56 ++----
 10 files changed, 479 insertions(+), 611 deletions(-)
Signature · 1 line
2.43.0