[0/3] Factor out common ordered extent flushing code
mbox series

Message ID 20190422074653.13075-1-nborisov@suse.com
Headers show
Series
  • Factor out common ordered extent flushing code
Related show

Message

Nikolay Borisov April 22, 2019, 7:46 a.m. UTC
There are a couple of places in the code which need to ensure that a particular 
range is locked and doesn't have pending ordered extents. Currently this logic is
open-coded in said places. This patchset refactors the code such that we now 
have btrfs_lock_and_flush_ordered_range which encompasses this logic. 

Patch 1 introduces a new function which contains the duplicated logic. 

Patch 2 replaces occurences of given code pattern in callers 

Patch 3 Introduces a micro-op so that unlocks in the function can happen without
looking up in the ordered tree. This change is careful to not leak extra 
extent_state references. 

Patches have undergone multiple successful xfstest runs. 


Nikolay Borisov (3):
  btrfs: Implement btrfs_lock_and_flush_ordered_range
  btrfs: Use newly introduced btrfs_lock_and_flush_ordered_range
  btrfs: Always use a cached extent_state in
    btrfs_lock_and_flush_ordered_range

 fs/btrfs/extent_io.c    | 27 +++----------------------
 fs/btrfs/file.c         | 14 ++-----------
 fs/btrfs/inode.c        | 17 ++--------------
 fs/btrfs/ordered-data.c | 44 +++++++++++++++++++++++++++++++++++++++++
 fs/btrfs/ordered-data.h |  3 +++
 5 files changed, 54 insertions(+), 51 deletions(-)