btrfs: add an inode-item.h
authorJosef Bacik <josef@toxicpanda.com>
Fri, 3 Dec 2021 22:18:03 +0000 (17:18 -0500)
committerDavid Sterba <dsterba@suse.com>
Fri, 7 Jan 2022 13:18:23 +0000 (14:18 +0100)
We have a few helpers in inode-item.c, and I'm going to make a few
changes to how we do truncate in the future, so break out these
definitions into their own header file to trim down ctree.h some and
make it easier to do the work on truncate in the future.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/delayed-inode.c
fs/btrfs/free-space-cache.c
fs/btrfs/inode-item.c
fs/btrfs/inode-item.h [new file with mode: 0644]
fs/btrfs/inode.c
fs/btrfs/relocation.c
fs/btrfs/tree-log.c

index 4ea7157ca03c58ffa0d81708b489956af6eee3fc..04e4807404386a31f45f522c69f55874365ba085 100644 (file)
@@ -3131,36 +3131,6 @@ int btrfs_del_orphan_item(struct btrfs_trans_handle *trans,
                          struct btrfs_root *root, u64 offset);
 int btrfs_find_orphan_item(struct btrfs_root *root, u64 offset);
 
-/* inode-item.c */
-int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
-                          struct btrfs_root *root,
-                          const char *name, int name_len,
-                          u64 inode_objectid, u64 ref_objectid, u64 index);
-int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
-                          struct btrfs_root *root,
-                          const char *name, int name_len,
-                          u64 inode_objectid, u64 ref_objectid, u64 *index);
-int btrfs_insert_empty_inode(struct btrfs_trans_handle *trans,
-                            struct btrfs_root *root,
-                            struct btrfs_path *path, u64 objectid);
-int btrfs_lookup_inode(struct btrfs_trans_handle *trans, struct btrfs_root
-                      *root, struct btrfs_path *path,
-                      struct btrfs_key *location, int mod);
-
-struct btrfs_inode_extref *
-btrfs_lookup_inode_extref(struct btrfs_trans_handle *trans,
-                         struct btrfs_root *root,
-                         struct btrfs_path *path,
-                         const char *name, int name_len,
-                         u64 inode_objectid, u64 ref_objectid, int ins_len,
-                         int cow);
-
-struct btrfs_inode_ref *btrfs_find_name_in_backref(struct extent_buffer *leaf,
-                                                  int slot, const char *name,
-                                                  int name_len);
-struct btrfs_inode_extref *btrfs_find_name_in_ext_backref(
-               struct extent_buffer *leaf, int slot, u64 ref_objectid,
-               const char *name, int name_len);
 /* file-item.c */
 struct btrfs_dio_private;
 int btrfs_del_csums(struct btrfs_trans_handle *trans,
index 6f134f2c5e68424c19c649e47748294b86267144..748bf6b0d8600fcd380e38b91a973c0255c17c76 100644 (file)
@@ -13,6 +13,7 @@
 #include "ctree.h"
 #include "qgroup.h"
 #include "locking.h"
+#include "inode-item.h"
 
 #define BTRFS_DELAYED_WRITEBACK                512
 #define BTRFS_DELAYED_BACKGROUND       128
index 132209ff2262e0435c913a0dee507738aae210cd..55e1be703a39508185123321fa6b12ca85eb2ea5 100644 (file)
@@ -23,6 +23,7 @@
 #include "block-group.h"
 #include "discard.h"
 #include "subpage.h"
+#include "inode-item.h"
 
 #define BITS_PER_BITMAP                (PAGE_SIZE * 8UL)
 #define MAX_CACHE_BYTES_PER_GIG        SZ_64K
index 56755ce9a9075aa9b79e85a775bae8ac8ad1f517..72593a93c43c202246ced56cdeb15a8452bd7b73 100644 (file)
@@ -4,6 +4,7 @@
  */
 
 #include "ctree.h"
+#include "inode-item.h"
 #include "disk-io.h"
 #include "transaction.h"
 #include "print-tree.h"
diff --git a/fs/btrfs/inode-item.h b/fs/btrfs/inode-item.h
new file mode 100644 (file)
index 0000000..30476bc
--- /dev/null
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef BTRFS_INODE_ITEM_H
+#define BTRFS_INODE_ITEM_H
+
+#include <linux/types.h>
+
+struct btrfs_trans_handle;
+struct btrfs_root;
+struct btrfs_path;
+struct btrfs_key;
+struct btrfs_inode_extref;
+struct extent_buffer;
+
+int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
+                          struct btrfs_root *root,
+                          const char *name, int name_len,
+                          u64 inode_objectid, u64 ref_objectid, u64 index);
+int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
+                          struct btrfs_root *root,
+                          const char *name, int name_len,
+                          u64 inode_objectid, u64 ref_objectid, u64 *index);
+int btrfs_insert_empty_inode(struct btrfs_trans_handle *trans,
+                            struct btrfs_root *root,
+                            struct btrfs_path *path, u64 objectid);
+int btrfs_lookup_inode(struct btrfs_trans_handle *trans, struct btrfs_root
+                      *root, struct btrfs_path *path,
+                      struct btrfs_key *location, int mod);
+
+struct btrfs_inode_extref *btrfs_lookup_inode_extref(
+                         struct btrfs_trans_handle *trans,
+                         struct btrfs_root *root,
+                         struct btrfs_path *path,
+                         const char *name, int name_len,
+                         u64 inode_objectid, u64 ref_objectid, int ins_len,
+                         int cow);
+
+struct btrfs_inode_ref *btrfs_find_name_in_backref(struct extent_buffer *leaf,
+                                                  int slot, const char *name,
+                                                  int name_len);
+struct btrfs_inode_extref *btrfs_find_name_in_ext_backref(
+               struct extent_buffer *leaf, int slot, u64 ref_objectid,
+               const char *name, int name_len);
+
+#endif
index 504cf090fc889d4e1f4e7736d454dc75a5dff2ca..6ccdcf76b02f73d54a48924d15eb89b8af6135fa 100644 (file)
@@ -54,6 +54,7 @@
 #include "space-info.h"
 #include "zoned.h"
 #include "subpage.h"
+#include "inode-item.h"
 
 struct btrfs_iget_args {
        u64 ino;
index 775aff5a2c26e3eaaaf1a962c0add83c01c1d0b8..f5465197996dec608ffc9c33576f2538b4b68726 100644 (file)
@@ -26,6 +26,7 @@
 #include "misc.h"
 #include "subpage.h"
 #include "zoned.h"
+#include "inode-item.h"
 
 /*
  * Relocation overview
index 7c4634ac511e866f249f3ca9f929a9603bb70c8c..64b42f4b11f253a207ee7b33af8e71243d599b8e 100644 (file)
@@ -20,6 +20,7 @@
 #include "block-group.h"
 #include "space-info.h"
 #include "zoned.h"
+#include "inode-item.h"
 
 /* magic values for the inode_only field in btrfs_log_inode:
  *