btrfs: rename __lock_extent() and __try_lock_extent()
authorFilipe Manana <fdmanana@suse.com>
Mon, 31 Mar 2025 14:29:21 +0000 (15:29 +0100)
committerDavid Sterba <dsterba@suse.com>
Thu, 15 May 2025 12:30:43 +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. Their double
underscore prefix is also discouraged.

So remove their double underscore prefix, add a 'btrfs_' prefix to their
name to make it clear they are from btrfs and a '_bits' suffix to avoid
collision with btrfs_lock_extent() and btrfs_try_lock_extent().

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
fs/btrfs/inode.c

index 59448d3028d3ca40723c0846a4224e416d6e23fa..dad092a1f81c7eb5aad8fc622d042d5fde4be9bb 100644 (file)
@@ -1831,8 +1831,8 @@ int clear_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
        return __clear_extent_bit(tree, start, end, bits, NULL, changeset);
 }
 
-bool __try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end, u32 bits,
-                      struct extent_state **cached)
+bool btrfs_try_lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
+                               u32 bits, struct extent_state **cached)
 {
        int err;
        u64 failed_start;
@@ -1851,8 +1851,8 @@ bool __try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end, u32 bits
  * Either insert or lock state struct between start and end use mask to tell
  * us if waiting is desired.
  */
-int __lock_extent(struct extent_io_tree *tree, u64 start, u64 end, u32 bits,
-                 struct extent_state **cached_state)
+int btrfs_lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, u32 bits,
+                          struct extent_state **cached_state)
 {
        struct extent_state *failed_state = NULL;
        int err;
index 83e9c2e0134b3fa5a8a75b757a39e52b5b491cf6..518caf666bb08db1954c83cade8d0c450a2361c2 100644 (file)
@@ -140,21 +140,21 @@ const struct btrfs_fs_info *extent_io_tree_to_fs_info(const struct extent_io_tre
 void extent_io_tree_init(struct btrfs_fs_info *fs_info,
                         struct extent_io_tree *tree, unsigned int owner);
 void extent_io_tree_release(struct extent_io_tree *tree);
-int __lock_extent(struct extent_io_tree *tree, u64 start, u64 end, u32 bits,
-                 struct extent_state **cached);
-bool __try_lock_extent(struct extent_io_tree *tree, u64 start, u64 end, u32 bits,
-                      struct extent_state **cached);
+int btrfs_lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, u32 bits,
+                          struct extent_state **cached);
+bool btrfs_try_lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
+                               u32 bits, struct extent_state **cached);
 
 static inline int btrfs_lock_extent(struct extent_io_tree *tree, u64 start, u64 end,
                                    struct extent_state **cached)
 {
-       return __lock_extent(tree, start, end, EXTENT_LOCKED, cached);
+       return btrfs_lock_extent_bits(tree, start, end, EXTENT_LOCKED, cached);
 }
 
 static inline bool btrfs_try_lock_extent(struct extent_io_tree *tree, u64 start,
                                         u64 end, struct extent_state **cached)
 {
-       return __try_lock_extent(tree, start, end, EXTENT_LOCKED, cached);
+       return btrfs_try_lock_extent_bits(tree, start, end, EXTENT_LOCKED, cached);
 }
 
 int __init extent_state_init_cachep(void);
@@ -226,13 +226,13 @@ bool btrfs_find_delalloc_range(struct extent_io_tree *tree, u64 *start,
 static inline int btrfs_lock_dio_extent(struct extent_io_tree *tree, u64 start,
                                        u64 end, struct extent_state **cached)
 {
-       return __lock_extent(tree, start, end, EXTENT_DIO_LOCKED, cached);
+       return btrfs_lock_extent_bits(tree, start, end, EXTENT_DIO_LOCKED, cached);
 }
 
 static inline bool btrfs_try_lock_dio_extent(struct extent_io_tree *tree, u64 start,
                                             u64 end, struct extent_state **cached)
 {
-       return __try_lock_extent(tree, start, end, EXTENT_DIO_LOCKED, cached);
+       return btrfs_try_lock_extent_bits(tree, start, end, EXTENT_DIO_LOCKED, cached);
 }
 
 static inline int btrfs_unlock_dio_extent(struct extent_io_tree *tree, u64 start,
index 6b173fa2c325e699e8360f25fb08377e1b1acae7..d5f2aaff58a75c996bc827355afc62a9bd88629e 100644 (file)
@@ -3127,9 +3127,9 @@ int btrfs_finish_one_ordered(struct btrfs_ordered_extent *ordered_extent)
         */
        if (!test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags)) {
                clear_bits |= EXTENT_LOCKED | EXTENT_FINISHING_ORDERED;
-               __lock_extent(io_tree, start, end,
-                             EXTENT_LOCKED | EXTENT_FINISHING_ORDERED,
-                             &cached_state);
+               btrfs_lock_extent_bits(io_tree, start, end,
+                                      EXTENT_LOCKED | EXTENT_FINISHING_ORDERED,
+                                      &cached_state);
        }
 
        if (freespace_inode)