btrfs: add separate helper for unlock_extent_cached with GFP_ATOMIC
authorDavid Sterba <dsterba@suse.com>
Thu, 7 Dec 2017 17:52:54 +0000 (18:52 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 22 Jan 2018 15:08:19 +0000 (16:08 +0100)
There's only one instance where we pass different gfp mask to
unlock_extent_cached. Add a separate helper for that and then we can
drop the gfp parameter from unlock_extent_cached.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h

index c40591486f237ef0b58e883cf545612a4fc99800..87809458b3ac12002523cdfe0db8aff0a276461f 100644 (file)
@@ -2493,7 +2493,7 @@ endio_readpage_release_extent(struct extent_io_tree *tree, u64 start, u64 len,
 
        if (uptodate && tree->track_uptodate)
                set_extent_uptodate(tree, start, end, &cached, GFP_ATOMIC);
-       unlock_extent_cached(tree, start, end, &cached, GFP_ATOMIC);
+       unlock_extent_cached_atomic(tree, start, end, &cached);
 }
 
 /*
index db2558b0cad490aa373b25ed87265554065bd58e..978351e8e8dc4365e0bfec24e676dc1bf0bdbf47 100644 (file)
@@ -318,6 +318,13 @@ static inline int unlock_extent_cached(struct extent_io_tree *tree, u64 start,
                                mask, NULL);
 }
 
+static inline int unlock_extent_cached_atomic(struct extent_io_tree *tree,
+               u64 start, u64 end, struct extent_state **cached)
+{
+       return __clear_extent_bit(tree, start, end, EXTENT_LOCKED, 1, 0, cached,
+                               GFP_ATOMIC, NULL);
+}
+
 static inline int clear_extent_bits(struct extent_io_tree *tree, u64 start,
                u64 end, unsigned bits)
 {