btrfs: Factor out loop processing all refs of a head
authorNikolay Borisov <nborisov@suse.com>
Wed, 15 Aug 2018 07:39:55 +0000 (10:39 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 15 Oct 2018 15:23:35 +0000 (17:23 +0200)
commite726138676f896146a55a98305665e81d34d038c
tree2d6b061c0b7d45ba69527bc68dd874a4f3502646
parentb1cdbcb53a6edd84d50b72117d49a350575bbe6a
btrfs: Factor out loop processing all refs of a head

This patch introduces a new helper encompassing the implicit inner loop
in __btrfs_run_delayed_refs which processes all the refs for a given
head. The code is mostly copy/paste, the only difference is that if we
detect a newer reference then -EAGAIN is returned so that callers can
react correctly.

Also, at the end of the loop the head is relocked and
btrfs_merge_delayed_refs is run again to retain the pre-refactoring
semantics.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c