zoned.c (16beac87e95e2fb278b552397c8260637f8a63f7) zoned.c (29cbcf401793f4e2c871c846edc2191731df2c41)
1// SPDX-License-Identifier: GPL-2.0
2
3#include <linux/bitops.h>
4#include <linux/slab.h>
5#include <linux/blkdev.h>
6#include <linux/sched/mm.h>
7#include <linux/atomic.h>
8#include <linux/vmalloc.h>

--- 1140 unchanged lines hidden (view full) ---

1149 * for a block group consist of conventional zones. It is pointed to the
1150 * end of the highest addressed extent in the block group as an allocation
1151 * offset.
1152 */
1153static int calculate_alloc_pointer(struct btrfs_block_group *cache,
1154 u64 *offset_ret)
1155{
1156 struct btrfs_fs_info *fs_info = cache->fs_info;
1// SPDX-License-Identifier: GPL-2.0
2
3#include <linux/bitops.h>
4#include <linux/slab.h>
5#include <linux/blkdev.h>
6#include <linux/sched/mm.h>
7#include <linux/atomic.h>
8#include <linux/vmalloc.h>

--- 1140 unchanged lines hidden (view full) ---

1149 * for a block group consist of conventional zones. It is pointed to the
1150 * end of the highest addressed extent in the block group as an allocation
1151 * offset.
1152 */
1153static int calculate_alloc_pointer(struct btrfs_block_group *cache,
1154 u64 *offset_ret)
1155{
1156 struct btrfs_fs_info *fs_info = cache->fs_info;
1157 struct btrfs_root *root = fs_info->extent_root;
1157 struct btrfs_root *root;
1158 struct btrfs_path *path;
1159 struct btrfs_key key;
1160 struct btrfs_key found_key;
1161 int ret;
1162 u64 length;
1163
1164 path = btrfs_alloc_path();
1165 if (!path)
1166 return -ENOMEM;
1167
1168 key.objectid = cache->start + cache->length;
1169 key.type = 0;
1170 key.offset = 0;
1171
1158 struct btrfs_path *path;
1159 struct btrfs_key key;
1160 struct btrfs_key found_key;
1161 int ret;
1162 u64 length;
1163
1164 path = btrfs_alloc_path();
1165 if (!path)
1166 return -ENOMEM;
1167
1168 key.objectid = cache->start + cache->length;
1169 key.type = 0;
1170 key.offset = 0;
1171
1172 root = btrfs_extent_root(fs_info, key.objectid);
1172 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
1173 /* We should not find the exact match */
1174 if (!ret)
1175 ret = -EUCLEAN;
1176 if (ret < 0)
1177 goto out;
1178
1179 ret = btrfs_previous_extent_item(root, path, cache->start);

--- 866 unchanged lines hidden ---
1173 ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
1174 /* We should not find the exact match */
1175 if (!ret)
1176 ret = -EUCLEAN;
1177 if (ret < 0)
1178 goto out;
1179
1180 ret = btrfs_previous_extent_item(root, path, cache->start);

--- 866 unchanged lines hidden ---