__btrfs_mod_ref's process_func function pointer calls btrfs_free_extent
 and btrfs_inc_extent_ref, which now both return only 0. This patches
 makes them return void and eliminates the error condition in
 __btrfs_mod_ref.

Signed-off-by: Jeff Mahoney <je...@suse.com>
---
 fs/btrfs/ctree.h       |   16 ++++++++--------
 fs/btrfs/extent-tree.c |   39 ++++++++++++++-------------------------
 2 files changed, 22 insertions(+), 33 deletions(-)

--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2191,10 +2191,10 @@ int btrfs_set_disk_extent_flags(struct b
                                struct btrfs_root *root,
                                u64 bytenr, u64 num_bytes, u64 flags,
                                int is_data);
-int btrfs_free_extent(struct btrfs_trans_handle *trans,
-                     struct btrfs_root *root,
-                     u64 bytenr, u64 num_bytes, u64 parent,
-                     u64 root_objectid, u64 owner, u64 offset);
+void btrfs_free_extent(struct btrfs_trans_handle *trans,
+                      struct btrfs_root *root,
+                      u64 bytenr, u64 num_bytes, u64 parent,
+                      u64 root_objectid, u64 owner, u64 offset);
 
 int btrfs_free_reserved_extent(struct btrfs_root *root, u64 start, u64 len);
 int btrfs_update_reserved_bytes(struct btrfs_block_group_cache *cache,
@@ -2203,10 +2203,10 @@ void btrfs_prepare_extent_commit(struct
                                 struct btrfs_root *root);
 int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans,
                               struct btrfs_root *root);
-int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
-                        struct btrfs_root *root,
-                        u64 bytenr, u64 num_bytes, u64 parent,
-                        u64 root_objectid, u64 owner, u64 offset);
+void btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
+                         struct btrfs_root *root,
+                         u64 bytenr, u64 num_bytes, u64 parent,
+                         u64 root_objectid, u64 owner, u64 offset);
 
 int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans,
                                    struct btrfs_root *root);
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1816,10 +1816,10 @@ static int btrfs_discard_extent(struct b
        return ret;
 }
 
-int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
-                        struct btrfs_root *root,
-                        u64 bytenr, u64 num_bytes, u64 parent,
-                        u64 root_objectid, u64 owner, u64 offset)
+void btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
+                         struct btrfs_root *root,
+                         u64 bytenr, u64 num_bytes, u64 parent,
+                         u64 root_objectid, u64 owner, u64 offset)
 {
        BUG_ON(owner < BTRFS_FIRST_FREE_OBJECTID &&
               root_objectid == BTRFS_TREE_LOG_OBJECTID);
@@ -1833,7 +1833,6 @@ int btrfs_inc_extent_ref(struct btrfs_tr
                                           root_objectid, owner, offset,
                                           BTRFS_ADD_DELAYED_REF, NULL);
        }
-       return 0;
 }
 
 static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
@@ -2550,9 +2549,8 @@ static int __btrfs_mod_ref(struct btrfs_
        struct btrfs_file_extent_item *fi;
        int i;
        int level;
-       int ret = 0;
-       int (*process_func)(struct btrfs_trans_handle *, struct btrfs_root *,
-                           u64, u64, u64, u64, u64, u64);
+       void (*process_func)(struct btrfs_trans_handle *, struct btrfs_root *,
+                            u64, u64, u64, u64, u64, u64);
 
        ref_root = btrfs_header_owner(buf);
        nritems = btrfs_header_nritems(buf);
@@ -2587,24 +2585,16 @@ static int __btrfs_mod_ref(struct btrfs_
 
                        num_bytes = btrfs_file_extent_disk_num_bytes(buf, fi);
                        key.offset -= btrfs_file_extent_offset(buf, fi);
-                       ret = process_func(trans, root, bytenr, num_bytes,
-                                          parent, ref_root, key.objectid,
-                                          key.offset);
-                       if (ret)
-                               goto fail;
+                       process_func(trans, root, bytenr, num_bytes, parent,
+                                    ref_root, key.objectid, key.offset);
                } else {
                        bytenr = btrfs_node_blockptr(buf, i);
                        num_bytes = btrfs_level_size(root, level - 1);
-                       ret = process_func(trans, root, bytenr, num_bytes,
-                                          parent, ref_root, level - 1, 0);
-                       if (ret)
-                               goto fail;
+                       process_func(trans, root, bytenr, num_bytes, parent,
+                                    ref_root, level - 1, 0);
                }
        }
        return 0;
-fail:
-       BUG();
-       return ret;
 }
 
 int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
@@ -4760,10 +4750,10 @@ out:
        btrfs_put_block_group(cache);
 }
 
-int btrfs_free_extent(struct btrfs_trans_handle *trans,
-                     struct btrfs_root *root,
-                     u64 bytenr, u64 num_bytes, u64 parent,
-                     u64 root_objectid, u64 owner, u64 offset)
+void btrfs_free_extent(struct btrfs_trans_handle *trans,
+                      struct btrfs_root *root,
+                      u64 bytenr, u64 num_bytes, u64 parent,
+                      u64 root_objectid, u64 owner, u64 offset)
 {
        /*
         * tree log blocks never actually go into the extent allocation
@@ -4786,7 +4776,6 @@ int btrfs_free_extent(struct btrfs_trans
                btrfs_add_delayed_data_ref(trans, bytenr, num_bytes, parent,
                                           root_objectid, owner, offset,
                                           BTRFS_DROP_DELAYED_REF, NULL);
-       return 0;
 }
 
 static u64 stripe_align(struct btrfs_root *root, u64 val)



--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to