OSDN Git Service

btrfs: sink the failed_start parameter to set_extent_bit
authorQu Wenruo <wqu@suse.com>
Wed, 21 Oct 2020 06:24:51 +0000 (14:24 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 8 Dec 2020 14:53:54 +0000 (15:53 +0100)
The @failed_start parameter is only paired with @exclusive_bits, and
those parameters are only used for EXTENT_LOCKED bit, which have their
own wrappers lock_extent_bits().

Thus for regular set_extent_bit() calls, the failed_start makes no
sense, just sink the parameter.

Also, since @failed_start and @exclusive_bits are used in pairs, add
an assert to make it obvious.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-io-tree.h
fs/btrfs/extent_io.c
fs/btrfs/inode.c

index 9800a83..cab4273 100644 (file)
@@ -154,15 +154,14 @@ static inline int clear_extent_bits(struct extent_io_tree *tree, u64 start,
 int set_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
                           unsigned bits, struct extent_changeset *changeset);
 int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
-                  unsigned bits, u64 *failed_start,
-                  struct extent_state **cached_state, gfp_t mask);
+                  unsigned bits, struct extent_state **cached_state, gfp_t mask);
 int set_extent_bits_nowait(struct extent_io_tree *tree, u64 start, u64 end,
                           unsigned bits);
 
 static inline int set_extent_bits(struct extent_io_tree *tree, u64 start,
                u64 end, unsigned bits)
 {
-       return set_extent_bit(tree, start, end, bits, NULL, NULL, GFP_NOFS);
+       return set_extent_bit(tree, start, end, bits, NULL, GFP_NOFS);
 }
 
 static inline int clear_extent_uptodate(struct extent_io_tree *tree, u64 start,
@@ -175,8 +174,7 @@ static inline int clear_extent_uptodate(struct extent_io_tree *tree, u64 start,
 static inline int set_extent_dirty(struct extent_io_tree *tree, u64 start,
                u64 end, gfp_t mask)
 {
-       return set_extent_bit(tree, start, end, EXTENT_DIRTY, NULL,
-                             NULL, mask);
+       return set_extent_bit(tree, start, end, EXTENT_DIRTY, NULL, mask);
 }
 
 static inline int clear_extent_dirty(struct extent_io_tree *tree, u64 start,
@@ -197,7 +195,7 @@ static inline int set_extent_delalloc(struct extent_io_tree *tree, u64 start,
 {
        return set_extent_bit(tree, start, end,
                              EXTENT_DELALLOC | EXTENT_UPTODATE | extra_bits,
-                             NULL, cached_state, GFP_NOFS);
+                             cached_state, GFP_NOFS);
 }
 
 static inline int set_extent_defrag(struct extent_io_tree *tree, u64 start,
@@ -205,20 +203,19 @@ static inline int set_extent_defrag(struct extent_io_tree *tree, u64 start,
 {
        return set_extent_bit(tree, start, end,
                              EXTENT_DELALLOC | EXTENT_UPTODATE | EXTENT_DEFRAG,
-                             NULL, cached_state, GFP_NOFS);
+                             cached_state, GFP_NOFS);
 }
 
 static inline int set_extent_new(struct extent_io_tree *tree, u64 start,
                u64 end)
 {
-       return set_extent_bit(tree, start, end, EXTENT_NEW, NULL, NULL,
-                       GFP_NOFS);
+       return set_extent_bit(tree, start, end, EXTENT_NEW, NULL, GFP_NOFS);
 }
 
 static inline int set_extent_uptodate(struct extent_io_tree *tree, u64 start,
                u64 end, struct extent_state **cached_state, gfp_t mask)
 {
-       return set_extent_bit(tree, start, end, EXTENT_UPTODATE, NULL,
+       return set_extent_bit(tree, start, end, EXTENT_UPTODATE,
                              cached_state, mask);
 }
 
index 539dab3..de675c7 100644 (file)
@@ -980,6 +980,10 @@ __set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
        btrfs_debug_check_extent_io_range(tree, start, end);
        trace_btrfs_set_extent_bit(tree, start, end - start + 1, bits);
 
+       if (exclusive_bits)
+               ASSERT(failed_start);
+       else
+               ASSERT(failed_start == NULL);
 again:
        if (!prealloc && gfpflags_allow_blocking(mask)) {
                /*
@@ -1180,11 +1184,10 @@ out:
 }
 
 int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
-                  unsigned bits, u64 * failed_start,
-                  struct extent_state **cached_state, gfp_t mask)
+                  unsigned bits, struct extent_state **cached_state, gfp_t mask)
 {
-       return __set_extent_bit(tree, start, end, bits, 0, failed_start,
-                               cached_state, mask, NULL);
+       return __set_extent_bit(tree, start, end, bits, 0, NULL, cached_state,
+                               mask, NULL);
 }
 
 
index 2c97169..ad72f68 100644 (file)
@@ -4717,8 +4717,7 @@ again:
 
        if (only_release_metadata)
                set_extent_bit(&BTRFS_I(inode)->io_tree, block_start,
-                               block_end, EXTENT_NORESERVE, NULL, NULL,
-                               GFP_NOFS);
+                              block_end, EXTENT_NORESERVE, NULL, GFP_NOFS);
 
 out_unlock:
        if (ret) {