]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
btrfs: move extent-tree helpers into their own header file
authorJosef Bacik <josef@toxicpanda.com>
Mon, 24 Oct 2022 18:46:57 +0000 (14:46 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 5 Dec 2022 17:00:44 +0000 (18:00 +0100)
Move all the extent tree related prototypes to extent-tree.h out of
ctree.h, and then go include it everywhere needed so everything
compiles.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
17 files changed:
fs/btrfs/backref.c
fs/btrfs/block-group.c
fs/btrfs/ctree.c
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/extent-tree.c
fs/btrfs/extent-tree.h [new file with mode: 0644]
fs/btrfs/file.c
fs/btrfs/free-space-tree.c
fs/btrfs/inode-item.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/qgroup.c
fs/btrfs/relocation.c
fs/btrfs/space-info.c
fs/btrfs/transaction.c
fs/btrfs/tree-log.c

index f556566b9c79641ac5b8314c30421c5c7ffafaf8..173df40da9849f933f174ca66f30ef134e52dc70 100644 (file)
@@ -17,6 +17,7 @@
 #include "tree-mod-log.h"
 #include "fs.h"
 #include "accessors.h"
+#include "extent-tree.h"
 
 /* Just arbitrary numbers so we can be sure one of these happened. */
 #define BACKREF_FOUND_SHARED     6
index d1f8d792b1842264514600650110efcf1decb53a..5a743c4d4e97bc7375466633d9149bbad4679007 100644 (file)
@@ -19,6 +19,7 @@
 #include "zoned.h"
 #include "fs.h"
 #include "accessors.h"
+#include "extent-tree.h"
 
 #ifdef CONFIG_BTRFS_DEBUG
 int btrfs_should_fragment_free_space(struct btrfs_block_group *block_group)
index 1283ca46c5bc9aa13c279e8cc967a83aa8817fd5..f0ddb44704eed203a4216def2a90f26660623e3c 100644 (file)
@@ -20,6 +20,7 @@
 #include "tree-checker.h"
 #include "fs.h"
 #include "accessors.h"
+#include "extent-tree.h"
 
 static struct kmem_cache *btrfs_path_cachep;
 
index 07f876961da1d771286863b8ac93eb829a22b8e6..8ca67227dec079a0707380d40de9ac8eef4c6b94 100644 (file)
@@ -495,78 +495,6 @@ static inline gfp_t btrfs_alloc_write_mask(struct address_space *mapping)
        return mapping_gfp_constraint(mapping, ~__GFP_FS);
 }
 
-/* extent-tree.c */
-
-enum btrfs_inline_ref_type {
-       BTRFS_REF_TYPE_INVALID,
-       BTRFS_REF_TYPE_BLOCK,
-       BTRFS_REF_TYPE_DATA,
-       BTRFS_REF_TYPE_ANY,
-};
-
-int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb,
-                                    struct btrfs_extent_inline_ref *iref,
-                                    enum btrfs_inline_ref_type is_data);
-u64 hash_extent_data_ref(u64 root_objectid, u64 owner, u64 offset);
-
-
-int btrfs_add_excluded_extent(struct btrfs_fs_info *fs_info,
-                             u64 start, u64 num_bytes);
-void btrfs_free_excluded_extents(struct btrfs_block_group *cache);
-int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
-                          unsigned long count);
-void btrfs_cleanup_ref_head_accounting(struct btrfs_fs_info *fs_info,
-                                 struct btrfs_delayed_ref_root *delayed_refs,
-                                 struct btrfs_delayed_ref_head *head);
-int btrfs_lookup_data_extent(struct btrfs_fs_info *fs_info, u64 start, u64 len);
-int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
-                            struct btrfs_fs_info *fs_info, u64 bytenr,
-                            u64 offset, int metadata, u64 *refs, u64 *flags);
-int btrfs_pin_extent(struct btrfs_trans_handle *trans, u64 bytenr, u64 num,
-                    int reserved);
-int btrfs_pin_extent_for_log_replay(struct btrfs_trans_handle *trans,
-                                   u64 bytenr, u64 num_bytes);
-int btrfs_exclude_logged_extents(struct extent_buffer *eb);
-int btrfs_cross_ref_exist(struct btrfs_root *root,
-                         u64 objectid, u64 offset, u64 bytenr, bool strict,
-                         struct btrfs_path *path);
-struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans,
-                                            struct btrfs_root *root,
-                                            u64 parent, u64 root_objectid,
-                                            const struct btrfs_disk_key *key,
-                                            int level, u64 hint,
-                                            u64 empty_size,
-                                            enum btrfs_lock_nesting nest);
-void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
-                          u64 root_id,
-                          struct extent_buffer *buf,
-                          u64 parent, int last_ref);
-int btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
-                                    struct btrfs_root *root, u64 owner,
-                                    u64 offset, u64 ram_bytes,
-                                    struct btrfs_key *ins);
-int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans,
-                                  u64 root_objectid, u64 owner, u64 offset,
-                                  struct btrfs_key *ins);
-int btrfs_reserve_extent(struct btrfs_root *root, u64 ram_bytes, u64 num_bytes,
-                        u64 min_alloc_size, u64 empty_size, u64 hint_byte,
-                        struct btrfs_key *ins, int is_data, int delalloc);
-int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
-                 struct extent_buffer *buf, int full_backref);
-int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
-                 struct extent_buffer *buf, int full_backref);
-int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
-                               struct extent_buffer *eb, u64 flags, int level);
-int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_ref *ref);
-
-int btrfs_free_reserved_extent(struct btrfs_fs_info *fs_info,
-                              u64 start, u64 len, int delalloc);
-int btrfs_pin_reserved_extent(struct btrfs_trans_handle *trans, u64 start,
-                             u64 len);
-int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans);
-int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
-                        struct btrfs_ref *generic_ref);
-
 int btrfs_subvolume_reserve_metadata(struct btrfs_root *root,
                                     struct btrfs_block_rsv *rsv,
                                     int nitems, bool use_global_rsv);
index 75475a213972edad94e102bf277bcbe28117f4ac..005da95c9c17b293c6f727a6464b113d10cfcbc2 100644 (file)
@@ -45,6 +45,7 @@
 #include "subpage.h"
 #include "fs.h"
 #include "accessors.h"
+#include "extent-tree.h"
 
 #define BTRFS_SUPER_FLAG_SUPP  (BTRFS_HEADER_FLAG_WRITTEN |\
                                 BTRFS_HEADER_FLAG_RELOC |\
index b97c99a8dd4cae0e0f05bf4fed72acd604dfde1c..d2d5de9462428b39db87bb895a0ae5d46c011a99 100644 (file)
@@ -38,6 +38,7 @@
 #include "dev-replace.h"
 #include "fs.h"
 #include "accessors.h"
+#include "extent-tree.h"
 
 #undef SCRAMBLE_DELAYED_REFS
 
diff --git a/fs/btrfs/extent-tree.h b/fs/btrfs/extent-tree.h
new file mode 100644 (file)
index 0000000..b3674b0
--- /dev/null
@@ -0,0 +1,72 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef BTRFS_EXTENT_TREE_H
+#define BTRFS_EXTENT_TREE_H
+
+enum btrfs_inline_ref_type {
+       BTRFS_REF_TYPE_INVALID,
+       BTRFS_REF_TYPE_BLOCK,
+       BTRFS_REF_TYPE_DATA,
+       BTRFS_REF_TYPE_ANY,
+};
+
+int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb,
+                                    struct btrfs_extent_inline_ref *iref,
+                                    enum btrfs_inline_ref_type is_data);
+u64 hash_extent_data_ref(u64 root_objectid, u64 owner, u64 offset);
+
+int btrfs_add_excluded_extent(struct btrfs_fs_info *fs_info,
+                             u64 start, u64 num_bytes);
+void btrfs_free_excluded_extents(struct btrfs_block_group *cache);
+int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, unsigned long count);
+void btrfs_cleanup_ref_head_accounting(struct btrfs_fs_info *fs_info,
+                                 struct btrfs_delayed_ref_root *delayed_refs,
+                                 struct btrfs_delayed_ref_head *head);
+int btrfs_lookup_data_extent(struct btrfs_fs_info *fs_info, u64 start, u64 len);
+int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
+                            struct btrfs_fs_info *fs_info, u64 bytenr,
+                            u64 offset, int metadata, u64 *refs, u64 *flags);
+int btrfs_pin_extent(struct btrfs_trans_handle *trans, u64 bytenr, u64 num,
+                    int reserved);
+int btrfs_pin_extent_for_log_replay(struct btrfs_trans_handle *trans,
+                                   u64 bytenr, u64 num_bytes);
+int btrfs_exclude_logged_extents(struct extent_buffer *eb);
+int btrfs_cross_ref_exist(struct btrfs_root *root,
+                         u64 objectid, u64 offset, u64 bytenr, bool strict,
+                         struct btrfs_path *path);
+struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans,
+                                            struct btrfs_root *root,
+                                            u64 parent, u64 root_objectid,
+                                            const struct btrfs_disk_key *key,
+                                            int level, u64 hint,
+                                            u64 empty_size,
+                                            enum btrfs_lock_nesting nest);
+void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
+                          u64 root_id,
+                          struct extent_buffer *buf,
+                          u64 parent, int last_ref);
+int btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans,
+                                    struct btrfs_root *root, u64 owner,
+                                    u64 offset, u64 ram_bytes,
+                                    struct btrfs_key *ins);
+int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans,
+                                  u64 root_objectid, u64 owner, u64 offset,
+                                  struct btrfs_key *ins);
+int btrfs_reserve_extent(struct btrfs_root *root, u64 ram_bytes, u64 num_bytes,
+                        u64 min_alloc_size, u64 empty_size, u64 hint_byte,
+                        struct btrfs_key *ins, int is_data, int delalloc);
+int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
+                 struct extent_buffer *buf, int full_backref);
+int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
+                 struct extent_buffer *buf, int full_backref);
+int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
+                               struct extent_buffer *eb, u64 flags, int level);
+int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_ref *ref);
+
+int btrfs_free_reserved_extent(struct btrfs_fs_info *fs_info,
+                              u64 start, u64 len, int delalloc);
+int btrfs_pin_reserved_extent(struct btrfs_trans_handle *trans, u64 start, u64 len);
+int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans);
+int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, struct btrfs_ref *generic_ref);
+
+#endif
index 62360a55442035ff14bcbb2ec81b9b788e313239..bad676d2e23fb291e61cda9f4d9ff0d5207a930d 100644 (file)
@@ -32,6 +32,7 @@
 #include "subpage.h"
 #include "fs.h"
 #include "accessors.h"
+#include "extent-tree.h"
 
 static struct kmem_cache *btrfs_inode_defrag_cachep;
 /*
index fc79d21e7b4f05d12cb92fe7bc69ffa3b00af049..a652e5dc465b013280e089a8e6eeb35fa1f77948 100644 (file)
@@ -14,6 +14,7 @@
 #include "block-group.h"
 #include "fs.h"
 #include "accessors.h"
+#include "extent-tree.h"
 
 static int __add_block_group_free_space(struct btrfs_trans_handle *trans,
                                        struct btrfs_block_group *block_group,
index d66bdbae5585a121ef15aaddb6f28d62fd6dd8ec..724507ce7a7d03b5a0d903f5735ee9a7fdcece9a 100644 (file)
@@ -12,6 +12,7 @@
 #include "print-tree.h"
 #include "space-info.h"
 #include "accessors.h"
+#include "extent-tree.h"
 
 struct btrfs_inode_ref *btrfs_find_name_in_backref(struct extent_buffer *leaf,
                                                   int slot,
index 78867a0844286881546b7ab3a96ba09f7a3e95b4..cb2a35b19c758f991ca2a2e2e3b58a755e2a2465 100644 (file)
@@ -57,6 +57,7 @@
 #include "inode-item.h"
 #include "fs.h"
 #include "accessors.h"
+#include "extent-tree.h"
 
 struct btrfs_iget_args {
        u64 ino;
index 2132e3e1598615b84c730fa540c4ae3e9c812a48..1d4bdb22881c058437605bdd6f0b8018ece22796 100644 (file)
@@ -52,6 +52,7 @@
 #include "subpage.h"
 #include "fs.h"
 #include "accessors.h"
+#include "extent-tree.h"
 
 #ifdef CONFIG_64BIT
 /* If we have a 32-bit userspace and 64-bit kernel, then the UAPI
index 4786b59035a82d0ccd8e9d02ffdef7f5f8be924c..88b248b228104a4955c6812d91bf9bbe95bb7d70 100644 (file)
@@ -26,6 +26,7 @@
 #include "tree-mod-log.h"
 #include "fs.h"
 #include "accessors.h"
+#include "extent-tree.h"
 
 /*
  * Helpers to access qgroup reservation
index 77d03dce25214e7dfb036946f94804c527f9ee36..946190f131388338b365c6e0678c5b420a4963d7 100644 (file)
@@ -30,6 +30,7 @@
 #include "space-info.h"
 #include "fs.h"
 #include "accessors.h"
+#include "extent-tree.h"
 
 /*
  * Relocation overview
index 45404798ee8c2c8857b5fa5ad4e4118bd822e2e4..e5f9f43ffa4c3f4d762d750333d6406ec356087c 100644 (file)
@@ -12,6 +12,7 @@
 #include "zoned.h"
 #include "fs.h"
 #include "accessors.h"
+#include "extent-tree.h"
 
 /*
  * HOW DOES SPACE RESERVATION WORK
index 0d44d50dc3bee90907efc15cbf796e75fc27316e..a04c2a9708e2632bbdf2a1431e5b7feec332a5b1 100644 (file)
@@ -26,6 +26,7 @@
 #include "zoned.h"
 #include "fs.h"
 #include "accessors.h"
+#include "extent-tree.h"
 
 static struct kmem_cache *btrfs_trans_handle_cachep;
 
index a5e56a678af28862233ba4e0888089d3a9050408..bd9a5eda9def27c890d04124020155ee345fdae5 100644 (file)
@@ -23,6 +23,7 @@
 #include "inode-item.h"
 #include "fs.h"
 #include "accessors.h"
+#include "extent-tree.h"
 
 #define MAX_CONFLICT_INODES 10