Commit 453e4873 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: rename btrfs_find_highest_objectid to btrfs_init_root_free_objectid

This function is used to initialize the in-memory
btrfs_root::highest_objectid member, which is used to get an available
objectid. Rename it to better reflect its semantics.
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 14971657
...@@ -1367,8 +1367,7 @@ static int btrfs_init_fs_root(struct btrfs_root *root, dev_t anon_dev) ...@@ -1367,8 +1367,7 @@ static int btrfs_init_fs_root(struct btrfs_root *root, dev_t anon_dev)
} }
mutex_lock(&root->objectid_mutex); mutex_lock(&root->objectid_mutex);
ret = btrfs_find_highest_objectid(root, ret = btrfs_init_root_free_objectid(root);
&root->highest_objectid);
if (ret) { if (ret) {
mutex_unlock(&root->objectid_mutex); mutex_unlock(&root->objectid_mutex);
goto fail; goto fail;
...@@ -2646,8 +2645,7 @@ static int __cold init_tree_roots(struct btrfs_fs_info *fs_info) ...@@ -2646,8 +2645,7 @@ static int __cold init_tree_roots(struct btrfs_fs_info *fs_info)
* No need to hold btrfs_root::objectid_mutex since the fs * No need to hold btrfs_root::objectid_mutex since the fs
* hasn't been fully initialised and we are the only user * hasn't been fully initialised and we are the only user
*/ */
ret = btrfs_find_highest_objectid(tree_root, ret = btrfs_init_root_free_objectid(tree_root);
&tree_root->highest_objectid);
if (ret < 0) { if (ret < 0) {
handle_error = true; handle_error = true;
continue; continue;
...@@ -4745,7 +4743,7 @@ static int btrfs_cleanup_transaction(struct btrfs_fs_info *fs_info) ...@@ -4745,7 +4743,7 @@ static int btrfs_cleanup_transaction(struct btrfs_fs_info *fs_info)
return 0; return 0;
} }
int btrfs_find_highest_objectid(struct btrfs_root *root, u64 *objectid) int btrfs_init_root_free_objectid(struct btrfs_root *root)
{ {
struct btrfs_path *path; struct btrfs_path *path;
int ret; int ret;
...@@ -4769,10 +4767,10 @@ int btrfs_find_highest_objectid(struct btrfs_root *root, u64 *objectid) ...@@ -4769,10 +4767,10 @@ int btrfs_find_highest_objectid(struct btrfs_root *root, u64 *objectid)
slot = path->slots[0] - 1; slot = path->slots[0] - 1;
l = path->nodes[0]; l = path->nodes[0];
btrfs_item_key_to_cpu(l, &found_key, slot); btrfs_item_key_to_cpu(l, &found_key, slot);
*objectid = max_t(u64, found_key.objectid, root->highest_objectid = max_t(u64, found_key.objectid,
BTRFS_FIRST_FREE_OBJECTID - 1); BTRFS_FIRST_FREE_OBJECTID - 1);
} else { } else {
*objectid = BTRFS_FIRST_FREE_OBJECTID - 1; root->highest_objectid = BTRFS_FIRST_FREE_OBJECTID - 1;
} }
ret = 0; ret = 0;
error: error:
......
...@@ -134,7 +134,7 @@ int btree_lock_page_hook(struct page *page, void *data, ...@@ -134,7 +134,7 @@ int btree_lock_page_hook(struct page *page, void *data,
void (*flush_fn)(void *)); void (*flush_fn)(void *));
int btrfs_get_num_tolerated_disk_barrier_failures(u64 flags); int btrfs_get_num_tolerated_disk_barrier_failures(u64 flags);
int btrfs_find_free_objectid(struct btrfs_root *root, u64 *objectid); int btrfs_find_free_objectid(struct btrfs_root *root, u64 *objectid);
int btrfs_find_highest_objectid(struct btrfs_root *root, u64 *objectid); int btrfs_init_root_free_objectid(struct btrfs_root *root);
int __init btrfs_end_io_wq_init(void); int __init btrfs_end_io_wq_init(void);
void __cold btrfs_end_io_wq_exit(void); void __cold btrfs_end_io_wq_exit(void);
......
...@@ -6307,8 +6307,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree) ...@@ -6307,8 +6307,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
* root->objectid_mutex is not acquired as log replay * root->objectid_mutex is not acquired as log replay
* could only happen during mount. * could only happen during mount.
*/ */
ret = btrfs_find_highest_objectid(root, ret = btrfs_init_root_free_objectid(root);
&root->highest_objectid);
} }
wc.replay_dest->log_root = NULL; wc.replay_dest->log_root = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment