Commit 6b8fad57 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: rename btrfs_root::highest_objectid to free_objectid

This reflects the true purpose of the member as it's being used solely
in context where a new objectid is being allocated. Future changes will
also change the way it's being used to closely follow this 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 543068a2
...@@ -1104,7 +1104,7 @@ struct btrfs_root { ...@@ -1104,7 +1104,7 @@ struct btrfs_root {
u32 type; u32 type;
u64 highest_objectid; u64 free_objectid;
struct btrfs_key defrag_progress; struct btrfs_key defrag_progress;
struct btrfs_key defrag_max; struct btrfs_key defrag_max;
......
...@@ -1016,7 +1016,7 @@ static void __setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info, ...@@ -1016,7 +1016,7 @@ static void __setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info,
root->orphan_cleanup_state = 0; root->orphan_cleanup_state = 0;
root->last_trans = 0; root->last_trans = 0;
root->highest_objectid = 0; root->free_objectid = 0;
root->nr_delalloc_inodes = 0; root->nr_delalloc_inodes = 0;
root->nr_ordered_extents = 0; root->nr_ordered_extents = 0;
root->inode_tree = RB_ROOT; root->inode_tree = RB_ROOT;
...@@ -1373,7 +1373,7 @@ static int btrfs_init_fs_root(struct btrfs_root *root, dev_t anon_dev) ...@@ -1373,7 +1373,7 @@ static int btrfs_init_fs_root(struct btrfs_root *root, dev_t anon_dev)
goto fail; goto fail;
} }
ASSERT(root->highest_objectid <= BTRFS_LAST_FREE_OBJECTID); ASSERT(root->free_objectid <= BTRFS_LAST_FREE_OBJECTID);
mutex_unlock(&root->objectid_mutex); mutex_unlock(&root->objectid_mutex);
...@@ -2651,7 +2651,7 @@ static int __cold init_tree_roots(struct btrfs_fs_info *fs_info) ...@@ -2651,7 +2651,7 @@ static int __cold init_tree_roots(struct btrfs_fs_info *fs_info)
continue; continue;
} }
ASSERT(tree_root->highest_objectid <= BTRFS_LAST_FREE_OBJECTID); ASSERT(tree_root->free_objectid <= BTRFS_LAST_FREE_OBJECTID);
ret = btrfs_read_roots(fs_info); ret = btrfs_read_roots(fs_info);
if (ret < 0) { if (ret < 0) {
...@@ -4767,10 +4767,10 @@ int btrfs_init_root_free_objectid(struct btrfs_root *root) ...@@ -4767,10 +4767,10 @@ int btrfs_init_root_free_objectid(struct btrfs_root *root)
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);
root->highest_objectid = max_t(u64, found_key.objectid, root->free_objectid = max_t(u64, found_key.objectid,
BTRFS_FIRST_FREE_OBJECTID - 1); BTRFS_FIRST_FREE_OBJECTID - 1);
} else { } else {
root->highest_objectid = BTRFS_FIRST_FREE_OBJECTID - 1; root->free_objectid = BTRFS_FIRST_FREE_OBJECTID - 1;
} }
ret = 0; ret = 0;
error: error:
...@@ -4783,7 +4783,7 @@ int btrfs_get_free_objectid(struct btrfs_root *root, u64 *objectid) ...@@ -4783,7 +4783,7 @@ int btrfs_get_free_objectid(struct btrfs_root *root, u64 *objectid)
int ret; int ret;
mutex_lock(&root->objectid_mutex); mutex_lock(&root->objectid_mutex);
if (unlikely(root->highest_objectid >= BTRFS_LAST_FREE_OBJECTID)) { if (unlikely(root->free_objectid >= BTRFS_LAST_FREE_OBJECTID)) {
btrfs_warn(root->fs_info, btrfs_warn(root->fs_info,
"the objectid of root %llu reaches its highest value", "the objectid of root %llu reaches its highest value",
root->root_key.objectid); root->root_key.objectid);
...@@ -4791,7 +4791,7 @@ int btrfs_get_free_objectid(struct btrfs_root *root, u64 *objectid) ...@@ -4791,7 +4791,7 @@ int btrfs_get_free_objectid(struct btrfs_root *root, u64 *objectid)
goto out; goto out;
} }
*objectid = ++root->highest_objectid; *objectid = ++root->free_objectid;
ret = 0; ret = 0;
out: out:
mutex_unlock(&root->objectid_mutex); mutex_unlock(&root->objectid_mutex);
......
...@@ -725,7 +725,7 @@ static noinline int create_subvol(struct inode *dir, ...@@ -725,7 +725,7 @@ static noinline int create_subvol(struct inode *dir,
} }
mutex_lock(&new_root->objectid_mutex); mutex_lock(&new_root->objectid_mutex);
new_root->highest_objectid = new_dirid; new_root->free_objectid = new_dirid;
mutex_unlock(&new_root->objectid_mutex); mutex_unlock(&new_root->objectid_mutex);
/* /*
......
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