btrfs: Make reada_tree_block_flagged private
authorNikolay Borisov <nborisov@suse.com>
Wed, 21 Aug 2019 13:38:15 +0000 (16:38 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 9 Sep 2019 12:59:11 +0000 (14:59 +0200)
This function is used only for the readahead machinery. It makes no
sense to keep it external to reada.c file. Place it above its sole
caller and make it static. No functional changes.

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/reada.c

index 589405eeb80fe563d6ed3428904b314bcffb041d..99dfd889b9f73748c4a18f92e57cd9e302253308 100644 (file)
@@ -1038,35 +1038,6 @@ void readahead_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr)
                free_extent_buffer(buf);
 }
 
-int reada_tree_block_flagged(struct btrfs_fs_info *fs_info, u64 bytenr,
-                        int mirror_num, struct extent_buffer **eb)
-{
-       struct extent_buffer *buf = NULL;
-       int ret;
-
-       buf = btrfs_find_create_tree_block(fs_info, bytenr);
-       if (IS_ERR(buf))
-               return 0;
-
-       set_bit(EXTENT_BUFFER_READAHEAD, &buf->bflags);
-
-       ret = read_extent_buffer_pages(buf, WAIT_PAGE_LOCK, mirror_num);
-       if (ret) {
-               free_extent_buffer_stale(buf);
-               return ret;
-       }
-
-       if (test_bit(EXTENT_BUFFER_CORRUPT, &buf->bflags)) {
-               free_extent_buffer_stale(buf);
-               return -EIO;
-       } else if (extent_buffer_uptodate(buf)) {
-               *eb = buf;
-       } else {
-               free_extent_buffer(buf);
-       }
-       return 0;
-}
-
 struct extent_buffer *btrfs_find_create_tree_block(
                                                struct btrfs_fs_info *fs_info,
                                                u64 bytenr)
index e80f7c45a3072bacd3f2480d1e15c3599565bb85..a6958103d87e74fc190770056e181940121e5185 100644 (file)
@@ -45,8 +45,6 @@ struct extent_buffer *read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
                                      u64 parent_transid, int level,
                                      struct btrfs_key *first_key);
 void readahead_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr);
-int reada_tree_block_flagged(struct btrfs_fs_info *fs_info, u64 bytenr,
-                        int mirror_num, struct extent_buffer **eb);
 struct extent_buffer *btrfs_find_create_tree_block(
                                                struct btrfs_fs_info *fs_info,
                                                u64 bytenr);
index 0b034c4943556bb2b4e1d27542afdf475b925049..ee6f60547a8d9eeb67d593bc76ce3f1c197524fa 100644 (file)
@@ -639,6 +639,35 @@ static int reada_pick_zone(struct btrfs_device *dev)
        return 1;
 }
 
+static int reada_tree_block_flagged(struct btrfs_fs_info *fs_info, u64 bytenr,
+                                   int mirror_num, struct extent_buffer **eb)
+{
+       struct extent_buffer *buf = NULL;
+       int ret;
+
+       buf = btrfs_find_create_tree_block(fs_info, bytenr);
+       if (IS_ERR(buf))
+               return 0;
+
+       set_bit(EXTENT_BUFFER_READAHEAD, &buf->bflags);
+
+       ret = read_extent_buffer_pages(buf, WAIT_PAGE_LOCK, mirror_num);
+       if (ret) {
+               free_extent_buffer_stale(buf);
+               return ret;
+       }
+
+       if (test_bit(EXTENT_BUFFER_CORRUPT, &buf->bflags)) {
+               free_extent_buffer_stale(buf);
+               return -EIO;
+       } else if (extent_buffer_uptodate(buf)) {
+               *eb = buf;
+       } else {
+               free_extent_buffer(buf);
+       }
+       return 0;
+}
+
 static int reada_start_machine_dev(struct btrfs_device *dev)
 {
        struct btrfs_fs_info *fs_info = dev->fs_info;