btrfs: rename the functions to get inode and fs_info from an extent io tree
authorFilipe Manana <fdmanana@suse.com>
Fri, 4 Apr 2025 10:09:07 +0000 (11:09 +0100)
committerDavid Sterba <dsterba@suse.com>
Thu, 15 May 2025 12:30:44 +0000 (14:30 +0200)
These functions are exported so they should have a 'btrfs_' prefix by
convention, to make it clear they are btrfs specific and to avoid
collisions with functions from elsewhere in the kernel.

So add a 'btrfs_' prefix to their name to make it clear they are from
btrfs. Also remove the 'const' suffix from extent_io_tree_to_inode_const()
since there's no non-const variant anymore and makes the naming consistent
with extent_io_tree_to_fs_info() (no 'const' suffix and returns a const
pointer).

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-io-tree.c
fs/btrfs/extent-io-tree.h
include/trace/events/btrfs.h

index 245b78c65edd474a9dab60e9f864957a12e2ac2b..abf0f83a15cb7023152925a0ba0aa0213c9da843 100644 (file)
@@ -65,7 +65,7 @@ static inline void __btrfs_debug_check_extent_io_range(const char *caller,
        if (tree->owner != IO_TREE_INODE_IO)
                return;
 
-       inode = extent_io_tree_to_inode_const(tree);
+       inode = btrfs_extent_io_tree_to_inode(tree);
        isize = i_size_read(&inode->vfs_inode);
        if (end >= PAGE_SIZE && (end % 2) == 0 && end != isize - 1) {
                btrfs_debug_rl(inode->root->fs_info,
@@ -81,7 +81,7 @@ static inline void __btrfs_debug_check_extent_io_range(const char *caller,
 #endif
 
 /* Read-only access to the inode. */
-const struct btrfs_inode *extent_io_tree_to_inode_const(const struct extent_io_tree *tree)
+const struct btrfs_inode *btrfs_extent_io_tree_to_inode(const struct extent_io_tree *tree)
 {
        if (tree->owner == IO_TREE_INODE_IO)
                return tree->inode;
@@ -89,7 +89,7 @@ const struct btrfs_inode *extent_io_tree_to_inode_const(const struct extent_io_t
 }
 
 /* For read-only access to fs_info. */
-const struct btrfs_fs_info *extent_io_tree_to_fs_info(const struct extent_io_tree *tree)
+const struct btrfs_fs_info *btrfs_extent_io_tree_to_fs_info(const struct extent_io_tree *tree)
 {
        if (tree->owner == IO_TREE_INODE_IO)
                return tree->inode->root->fs_info;
@@ -334,7 +334,7 @@ static void __cold extent_io_tree_panic(const struct extent_io_tree *tree,
                                        const char *opname,
                                        int err)
 {
-       btrfs_panic(extent_io_tree_to_fs_info(tree), err,
+       btrfs_panic(btrfs_extent_io_tree_to_fs_info(tree), err,
                    "extent io tree error on %s state start %llu end %llu",
                    opname, state->start, state->end);
 }
@@ -936,7 +936,7 @@ int btrfs_find_contiguous_extent_bit(struct extent_io_tree *tree, u64 start,
        struct extent_state *state;
        int ret = 1;
 
-       ASSERT(!btrfs_fs_incompat(extent_io_tree_to_fs_info(tree), NO_HOLES));
+       ASSERT(!btrfs_fs_incompat(btrfs_extent_io_tree_to_fs_info(tree), NO_HOLES));
 
        spin_lock(&tree->lock);
        state = find_first_extent_bit_state(tree, start, bits);
index 60fedf1b855e0ca89abe22b85543643cf354947c..361d27c6b294f25e871f71122c5e496e8d721a93 100644 (file)
@@ -134,8 +134,8 @@ struct extent_state {
 #endif
 };
 
-const struct btrfs_inode *extent_io_tree_to_inode_const(const struct extent_io_tree *tree);
-const struct btrfs_fs_info *extent_io_tree_to_fs_info(const struct extent_io_tree *tree);
+const struct btrfs_inode *btrfs_extent_io_tree_to_inode(const struct extent_io_tree *tree);
+const struct btrfs_fs_info *btrfs_extent_io_tree_to_fs_info(const struct extent_io_tree *tree);
 
 void extent_io_tree_init(struct btrfs_fs_info *fs_info,
                         struct extent_io_tree *tree, unsigned int owner);
index 60f9a6ca54f89b4acdb7f01b1dbf97aa7a1f6875..8edbc0379a01ac5fd213d290e145331e2a3da1fe 100644 (file)
@@ -2069,8 +2069,8 @@ TRACE_EVENT(btrfs_set_extent_bit,
                __field(        unsigned,       set_bits)
        ),
 
-       TP_fast_assign_btrfs(extent_io_tree_to_fs_info(tree),
-               const struct btrfs_inode *inode = extent_io_tree_to_inode_const(tree);
+       TP_fast_assign_btrfs(btrfs_extent_io_tree_to_fs_info(tree),
+               const struct btrfs_inode *inode = btrfs_extent_io_tree_to_inode(tree);
 
                __entry->owner          = tree->owner;
                __entry->ino            = inode ? btrfs_ino(inode) : 0;
@@ -2102,8 +2102,8 @@ TRACE_EVENT(btrfs_clear_extent_bit,
                __field(        unsigned,       clear_bits)
        ),
 
-       TP_fast_assign_btrfs(extent_io_tree_to_fs_info(tree),
-               const struct btrfs_inode *inode = extent_io_tree_to_inode_const(tree);
+       TP_fast_assign_btrfs(btrfs_extent_io_tree_to_fs_info(tree),
+               const struct btrfs_inode *inode = btrfs_extent_io_tree_to_inode(tree);
 
                __entry->owner          = tree->owner;
                __entry->ino            = inode ? btrfs_ino(inode) : 0;
@@ -2136,8 +2136,8 @@ TRACE_EVENT(btrfs_convert_extent_bit,
                __field(        unsigned,       clear_bits)
        ),
 
-       TP_fast_assign_btrfs(extent_io_tree_to_fs_info(tree),
-               const struct btrfs_inode *inode = extent_io_tree_to_inode_const(tree);
+       TP_fast_assign_btrfs(btrfs_extent_io_tree_to_fs_info(tree),
+               const struct btrfs_inode *inode = btrfs_extent_io_tree_to_inode(tree);
 
                __entry->owner          = tree->owner;
                __entry->ino            = inode ? btrfs_ino(inode) : 0;