Commit 310712b2 authored by Omar Sandoval's avatar Omar Sandoval Committed by David Sterba

Btrfs: constify struct btrfs_{,disk_}key wherever possible

In a lot of places, it's unclear when it's safe to reuse a struct
btrfs_key after it has been passed to a helper function. Constify these
arguments wherever possible to make it obvious.
Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 4aaedfb0
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root
*root, struct btrfs_path *path, int level); *root, struct btrfs_path *path, int level);
static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root *root,
*root, struct btrfs_key *ins_key, const struct btrfs_key *ins_key, struct btrfs_path *path,
struct btrfs_path *path, int data_size, int extend); int data_size, int extend);
static int push_node_left(struct btrfs_trans_handle *trans, static int push_node_left(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, struct btrfs_fs_info *fs_info,
struct extent_buffer *dst, struct extent_buffer *dst,
...@@ -1580,7 +1580,8 @@ static int close_blocks(u64 blocknr, u64 other, u32 blocksize) ...@@ -1580,7 +1580,8 @@ static int close_blocks(u64 blocknr, u64 other, u32 blocksize)
/* /*
* compare two keys in a memcmp fashion * compare two keys in a memcmp fashion
*/ */
static int comp_keys(struct btrfs_disk_key *disk, struct btrfs_key *k2) static int comp_keys(const struct btrfs_disk_key *disk,
const struct btrfs_key *k2)
{ {
struct btrfs_key k1; struct btrfs_key k1;
...@@ -1592,7 +1593,7 @@ static int comp_keys(struct btrfs_disk_key *disk, struct btrfs_key *k2) ...@@ -1592,7 +1593,7 @@ static int comp_keys(struct btrfs_disk_key *disk, struct btrfs_key *k2)
/* /*
* same as comp_keys only with two btrfs_key's * same as comp_keys only with two btrfs_key's
*/ */
int btrfs_comp_cpu_keys(struct btrfs_key *k1, struct btrfs_key *k2) int btrfs_comp_cpu_keys(const struct btrfs_key *k1, const struct btrfs_key *k2)
{ {
if (k1->objectid > k2->objectid) if (k1->objectid > k2->objectid)
return 1; return 1;
...@@ -1732,8 +1733,8 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, ...@@ -1732,8 +1733,8 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
* slot may point to max if the key is bigger than all of the keys * slot may point to max if the key is bigger than all of the keys
*/ */
static noinline int generic_bin_search(struct extent_buffer *eb, static noinline int generic_bin_search(struct extent_buffer *eb,
unsigned long p, unsigned long p, int item_size,
int item_size, struct btrfs_key *key, const struct btrfs_key *key,
int max, int *slot) int max, int *slot)
{ {
int low = 0; int low = 0;
...@@ -1802,7 +1803,7 @@ static noinline int generic_bin_search(struct extent_buffer *eb, ...@@ -1802,7 +1803,7 @@ static noinline int generic_bin_search(struct extent_buffer *eb,
* simple bin_search frontend that does the right thing for * simple bin_search frontend that does the right thing for
* leaves vs nodes * leaves vs nodes
*/ */
static int bin_search(struct extent_buffer *eb, struct btrfs_key *key, static int bin_search(struct extent_buffer *eb, const struct btrfs_key *key,
int level, int *slot) int level, int *slot)
{ {
if (level == 0) if (level == 0)
...@@ -1819,7 +1820,7 @@ static int bin_search(struct extent_buffer *eb, struct btrfs_key *key, ...@@ -1819,7 +1820,7 @@ static int bin_search(struct extent_buffer *eb, struct btrfs_key *key,
slot); slot);
} }
int btrfs_bin_search(struct extent_buffer *eb, struct btrfs_key *key, int btrfs_bin_search(struct extent_buffer *eb, const struct btrfs_key *key,
int level, int *slot) int level, int *slot)
{ {
return bin_search(eb, key, level, slot); return bin_search(eb, key, level, slot);
...@@ -2440,7 +2441,7 @@ static int ...@@ -2440,7 +2441,7 @@ static int
read_block_for_search(struct btrfs_trans_handle *trans, read_block_for_search(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_path *p, struct btrfs_root *root, struct btrfs_path *p,
struct extent_buffer **eb_ret, int level, int slot, struct extent_buffer **eb_ret, int level, int slot,
struct btrfs_key *key, u64 time_seq) const struct btrfs_key *key, u64 time_seq)
{ {
struct btrfs_fs_info *fs_info = root->fs_info; struct btrfs_fs_info *fs_info = root->fs_info;
u64 blocknr; u64 blocknr;
...@@ -2587,7 +2588,7 @@ setup_nodes_for_search(struct btrfs_trans_handle *trans, ...@@ -2587,7 +2588,7 @@ setup_nodes_for_search(struct btrfs_trans_handle *trans,
} }
static void key_search_validate(struct extent_buffer *b, static void key_search_validate(struct extent_buffer *b,
struct btrfs_key *key, const struct btrfs_key *key,
int level) int level)
{ {
#ifdef CONFIG_BTRFS_ASSERT #ifdef CONFIG_BTRFS_ASSERT
...@@ -2606,7 +2607,7 @@ static void key_search_validate(struct extent_buffer *b, ...@@ -2606,7 +2607,7 @@ static void key_search_validate(struct extent_buffer *b,
#endif #endif
} }
static int key_search(struct extent_buffer *b, struct btrfs_key *key, static int key_search(struct extent_buffer *b, const struct btrfs_key *key,
int level, int *prev_cmp, int *slot) int level, int *prev_cmp, int *slot)
{ {
if (*prev_cmp != 0) { if (*prev_cmp != 0) {
...@@ -2668,9 +2669,9 @@ int btrfs_find_item(struct btrfs_root *fs_root, struct btrfs_path *path, ...@@ -2668,9 +2669,9 @@ int btrfs_find_item(struct btrfs_root *fs_root, struct btrfs_path *path,
* tree. if ins_len < 0, nodes will be merged as we walk down the tree (if * tree. if ins_len < 0, nodes will be merged as we walk down the tree (if
* possible) * possible)
*/ */
int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root,
*root, struct btrfs_key *key, struct btrfs_path *p, int const struct btrfs_key *key, struct btrfs_path *p,
ins_len, int cow) int ins_len, int cow)
{ {
struct btrfs_fs_info *fs_info = root->fs_info; struct btrfs_fs_info *fs_info = root->fs_info;
struct extent_buffer *b; struct extent_buffer *b;
...@@ -2953,7 +2954,7 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -2953,7 +2954,7 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
* The resulting path and return value will be set up as if we called * The resulting path and return value will be set up as if we called
* btrfs_search_slot at that point in time with ins_len and cow both set to 0. * btrfs_search_slot at that point in time with ins_len and cow both set to 0.
*/ */
int btrfs_search_old_slot(struct btrfs_root *root, struct btrfs_key *key, int btrfs_search_old_slot(struct btrfs_root *root, const struct btrfs_key *key,
struct btrfs_path *p, u64 time_seq) struct btrfs_path *p, u64 time_seq)
{ {
struct btrfs_fs_info *fs_info = root->fs_info; struct btrfs_fs_info *fs_info = root->fs_info;
...@@ -3067,8 +3068,9 @@ int btrfs_search_old_slot(struct btrfs_root *root, struct btrfs_key *key, ...@@ -3067,8 +3068,9 @@ int btrfs_search_old_slot(struct btrfs_root *root, struct btrfs_key *key,
* < 0 on error * < 0 on error
*/ */
int btrfs_search_slot_for_read(struct btrfs_root *root, int btrfs_search_slot_for_read(struct btrfs_root *root,
struct btrfs_key *key, struct btrfs_path *p, const struct btrfs_key *key,
int find_higher, int return_any) struct btrfs_path *p, int find_higher,
int return_any)
{ {
int ret; int ret;
struct extent_buffer *leaf; struct extent_buffer *leaf;
...@@ -3166,7 +3168,7 @@ static void fixup_low_keys(struct btrfs_fs_info *fs_info, ...@@ -3166,7 +3168,7 @@ static void fixup_low_keys(struct btrfs_fs_info *fs_info,
*/ */
void btrfs_set_item_key_safe(struct btrfs_fs_info *fs_info, void btrfs_set_item_key_safe(struct btrfs_fs_info *fs_info,
struct btrfs_path *path, struct btrfs_path *path,
struct btrfs_key *new_key) const struct btrfs_key *new_key)
{ {
struct btrfs_disk_key disk_key; struct btrfs_disk_key disk_key;
struct extent_buffer *eb; struct extent_buffer *eb;
...@@ -4180,7 +4182,7 @@ static noinline int push_for_double_split(struct btrfs_trans_handle *trans, ...@@ -4180,7 +4182,7 @@ static noinline int push_for_double_split(struct btrfs_trans_handle *trans,
*/ */
static noinline int split_leaf(struct btrfs_trans_handle *trans, static noinline int split_leaf(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct btrfs_key *ins_key, const struct btrfs_key *ins_key,
struct btrfs_path *path, int data_size, struct btrfs_path *path, int data_size,
int extend) int extend)
{ {
...@@ -4415,7 +4417,7 @@ static noinline int setup_leaf_for_split(struct btrfs_trans_handle *trans, ...@@ -4415,7 +4417,7 @@ static noinline int setup_leaf_for_split(struct btrfs_trans_handle *trans,
static noinline int split_item(struct btrfs_trans_handle *trans, static noinline int split_item(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, struct btrfs_fs_info *fs_info,
struct btrfs_path *path, struct btrfs_path *path,
struct btrfs_key *new_key, const struct btrfs_key *new_key,
unsigned long split_offset) unsigned long split_offset)
{ {
struct extent_buffer *leaf; struct extent_buffer *leaf;
...@@ -4501,7 +4503,7 @@ static noinline int split_item(struct btrfs_trans_handle *trans, ...@@ -4501,7 +4503,7 @@ static noinline int split_item(struct btrfs_trans_handle *trans,
int btrfs_split_item(struct btrfs_trans_handle *trans, int btrfs_split_item(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct btrfs_path *path, struct btrfs_path *path,
struct btrfs_key *new_key, const struct btrfs_key *new_key,
unsigned long split_offset) unsigned long split_offset)
{ {
int ret; int ret;
...@@ -4525,7 +4527,7 @@ int btrfs_split_item(struct btrfs_trans_handle *trans, ...@@ -4525,7 +4527,7 @@ int btrfs_split_item(struct btrfs_trans_handle *trans,
int btrfs_duplicate_item(struct btrfs_trans_handle *trans, int btrfs_duplicate_item(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct btrfs_path *path, struct btrfs_path *path,
struct btrfs_key *new_key) const struct btrfs_key *new_key)
{ {
struct extent_buffer *leaf; struct extent_buffer *leaf;
int ret; int ret;
...@@ -4726,7 +4728,7 @@ void btrfs_extend_item(struct btrfs_fs_info *fs_info, struct btrfs_path *path, ...@@ -4726,7 +4728,7 @@ void btrfs_extend_item(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
* that doesn't call btrfs_search_slot * that doesn't call btrfs_search_slot
*/ */
void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path, void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path,
struct btrfs_key *cpu_key, u32 *data_size, const struct btrfs_key *cpu_key, u32 *data_size,
u32 total_data, u32 total_size, int nr) u32 total_data, u32 total_size, int nr)
{ {
struct btrfs_fs_info *fs_info = root->fs_info; struct btrfs_fs_info *fs_info = root->fs_info;
...@@ -4820,7 +4822,7 @@ void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path, ...@@ -4820,7 +4822,7 @@ void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path,
int btrfs_insert_empty_items(struct btrfs_trans_handle *trans, int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct btrfs_path *path, struct btrfs_path *path,
struct btrfs_key *cpu_key, u32 *data_size, const struct btrfs_key *cpu_key, u32 *data_size,
int nr) int nr)
{ {
int ret = 0; int ret = 0;
...@@ -4851,9 +4853,9 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans, ...@@ -4851,9 +4853,9 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
* Given a key and some data, insert an item into the tree. * Given a key and some data, insert an item into the tree.
* This does all the path init required, making room in the tree if needed. * This does all the path init required, making room in the tree if needed.
*/ */
int btrfs_insert_item(struct btrfs_trans_handle *trans, struct btrfs_root int btrfs_insert_item(struct btrfs_trans_handle *trans, struct btrfs_root *root,
*root, struct btrfs_key *cpu_key, void *data, u32 const struct btrfs_key *cpu_key, void *data,
data_size) u32 data_size)
{ {
int ret = 0; int ret = 0;
struct btrfs_path *path; struct btrfs_path *path;
......
...@@ -1961,7 +1961,7 @@ BTRFS_SETGET_STACK_FUNCS(disk_key_offset, struct btrfs_disk_key, offset, 64); ...@@ -1961,7 +1961,7 @@ BTRFS_SETGET_STACK_FUNCS(disk_key_offset, struct btrfs_disk_key, offset, 64);
BTRFS_SETGET_STACK_FUNCS(disk_key_type, struct btrfs_disk_key, type, 8); BTRFS_SETGET_STACK_FUNCS(disk_key_type, struct btrfs_disk_key, type, 8);
static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu, static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu,
struct btrfs_disk_key *disk) const struct btrfs_disk_key *disk)
{ {
cpu->offset = le64_to_cpu(disk->offset); cpu->offset = le64_to_cpu(disk->offset);
cpu->type = disk->type; cpu->type = disk->type;
...@@ -1969,7 +1969,7 @@ static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu, ...@@ -1969,7 +1969,7 @@ static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu,
} }
static inline void btrfs_cpu_key_to_disk(struct btrfs_disk_key *disk, static inline void btrfs_cpu_key_to_disk(struct btrfs_disk_key *disk,
struct btrfs_key *cpu) const struct btrfs_key *cpu)
{ {
disk->offset = cpu_to_le64(cpu->offset); disk->offset = cpu_to_le64(cpu->offset);
disk->type = cpu->type; disk->type = cpu->type;
...@@ -2001,8 +2001,7 @@ static inline void btrfs_dir_item_key_to_cpu(struct extent_buffer *eb, ...@@ -2001,8 +2001,7 @@ static inline void btrfs_dir_item_key_to_cpu(struct extent_buffer *eb,
btrfs_disk_key_to_cpu(key, &disk_key); btrfs_disk_key_to_cpu(key, &disk_key);
} }
static inline u8 btrfs_key_type(const struct btrfs_key *key)
static inline u8 btrfs_key_type(struct btrfs_key *key)
{ {
return key->type; return key->type;
} }
...@@ -2595,10 +2594,11 @@ void btrfs_get_block_group(struct btrfs_block_group_cache *cache); ...@@ -2595,10 +2594,11 @@ void btrfs_get_block_group(struct btrfs_block_group_cache *cache);
void btrfs_put_block_group(struct btrfs_block_group_cache *cache); void btrfs_put_block_group(struct btrfs_block_group_cache *cache);
int get_block_group_index(struct btrfs_block_group_cache *cache); int get_block_group_index(struct btrfs_block_group_cache *cache);
struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans, struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans,
struct btrfs_root *root, u64 parent, struct btrfs_root *root,
u64 root_objectid, u64 parent, u64 root_objectid,
struct btrfs_disk_key *key, int level, const struct btrfs_disk_key *key,
u64 hint, u64 empty_size); int level, u64 hint,
u64 empty_size);
void btrfs_free_tree_block(struct btrfs_trans_handle *trans, void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct extent_buffer *buf, struct extent_buffer *buf,
...@@ -2758,9 +2758,9 @@ u64 add_new_free_space(struct btrfs_block_group_cache *block_group, ...@@ -2758,9 +2758,9 @@ u64 add_new_free_space(struct btrfs_block_group_cache *block_group,
struct btrfs_fs_info *info, u64 start, u64 end); struct btrfs_fs_info *info, u64 start, u64 end);
/* ctree.c */ /* ctree.c */
int btrfs_bin_search(struct extent_buffer *eb, struct btrfs_key *key, int btrfs_bin_search(struct extent_buffer *eb, const struct btrfs_key *key,
int level, int *slot); int level, int *slot);
int btrfs_comp_cpu_keys(struct btrfs_key *k1, struct btrfs_key *k2); int btrfs_comp_cpu_keys(const struct btrfs_key *k1, const struct btrfs_key *k2);
int btrfs_previous_item(struct btrfs_root *root, int btrfs_previous_item(struct btrfs_root *root,
struct btrfs_path *path, u64 min_objectid, struct btrfs_path *path, u64 min_objectid,
int type); int type);
...@@ -2768,7 +2768,7 @@ int btrfs_previous_extent_item(struct btrfs_root *root, ...@@ -2768,7 +2768,7 @@ int btrfs_previous_extent_item(struct btrfs_root *root,
struct btrfs_path *path, u64 min_objectid); struct btrfs_path *path, u64 min_objectid);
void btrfs_set_item_key_safe(struct btrfs_fs_info *fs_info, void btrfs_set_item_key_safe(struct btrfs_fs_info *fs_info,
struct btrfs_path *path, struct btrfs_path *path,
struct btrfs_key *new_key); const struct btrfs_key *new_key);
struct extent_buffer *btrfs_root_node(struct btrfs_root *root); struct extent_buffer *btrfs_root_node(struct btrfs_root *root);
struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root); struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root);
int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path, int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path,
...@@ -2810,22 +2810,23 @@ void btrfs_truncate_item(struct btrfs_fs_info *fs_info, ...@@ -2810,22 +2810,23 @@ void btrfs_truncate_item(struct btrfs_fs_info *fs_info,
int btrfs_split_item(struct btrfs_trans_handle *trans, int btrfs_split_item(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct btrfs_path *path, struct btrfs_path *path,
struct btrfs_key *new_key, const struct btrfs_key *new_key,
unsigned long split_offset); unsigned long split_offset);
int btrfs_duplicate_item(struct btrfs_trans_handle *trans, int btrfs_duplicate_item(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct btrfs_path *path, struct btrfs_path *path,
struct btrfs_key *new_key); const struct btrfs_key *new_key);
int btrfs_find_item(struct btrfs_root *fs_root, struct btrfs_path *path, int btrfs_find_item(struct btrfs_root *fs_root, struct btrfs_path *path,
u64 inum, u64 ioff, u8 key_type, struct btrfs_key *found_key); u64 inum, u64 ioff, u8 key_type, struct btrfs_key *found_key);
int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root,
*root, struct btrfs_key *key, struct btrfs_path *p, int const struct btrfs_key *key, struct btrfs_path *p,
ins_len, int cow); int ins_len, int cow);
int btrfs_search_old_slot(struct btrfs_root *root, struct btrfs_key *key, int btrfs_search_old_slot(struct btrfs_root *root, const struct btrfs_key *key,
struct btrfs_path *p, u64 time_seq); struct btrfs_path *p, u64 time_seq);
int btrfs_search_slot_for_read(struct btrfs_root *root, int btrfs_search_slot_for_read(struct btrfs_root *root,
struct btrfs_key *key, struct btrfs_path *p, const struct btrfs_key *key,
int find_higher, int return_any); struct btrfs_path *p, int find_higher,
int return_any);
int btrfs_realloc_node(struct btrfs_trans_handle *trans, int btrfs_realloc_node(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct extent_buffer *parent, struct btrfs_root *root, struct extent_buffer *parent,
int start_slot, u64 *last_ret, int start_slot, u64 *last_ret,
...@@ -2848,19 +2849,20 @@ static inline int btrfs_del_item(struct btrfs_trans_handle *trans, ...@@ -2848,19 +2849,20 @@ static inline int btrfs_del_item(struct btrfs_trans_handle *trans,
} }
void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path, void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path,
struct btrfs_key *cpu_key, u32 *data_size, const struct btrfs_key *cpu_key, u32 *data_size,
u32 total_data, u32 total_size, int nr); u32 total_data, u32 total_size, int nr);
int btrfs_insert_item(struct btrfs_trans_handle *trans, struct btrfs_root int btrfs_insert_item(struct btrfs_trans_handle *trans, struct btrfs_root *root,
*root, struct btrfs_key *key, void *data, u32 data_size); const struct btrfs_key *key, void *data, u32 data_size);
int btrfs_insert_empty_items(struct btrfs_trans_handle *trans, int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct btrfs_path *path, struct btrfs_path *path,
struct btrfs_key *cpu_key, u32 *data_size, int nr); const struct btrfs_key *cpu_key, u32 *data_size,
int nr);
static inline int btrfs_insert_empty_item(struct btrfs_trans_handle *trans, static inline int btrfs_insert_empty_item(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct btrfs_path *path, struct btrfs_path *path,
struct btrfs_key *key, const struct btrfs_key *key,
u32 data_size) u32 data_size)
{ {
return btrfs_insert_empty_items(trans, root, path, key, &data_size, 1); return btrfs_insert_empty_items(trans, root, path, key, &data_size, 1);
...@@ -2949,15 +2951,15 @@ int btrfs_del_root_ref(struct btrfs_trans_handle *trans, ...@@ -2949,15 +2951,15 @@ int btrfs_del_root_ref(struct btrfs_trans_handle *trans,
u64 root_id, u64 ref_id, u64 dirid, u64 *sequence, u64 root_id, u64 ref_id, u64 dirid, u64 *sequence,
const char *name, int name_len); const char *name, int name_len);
int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
struct btrfs_key *key); const struct btrfs_key *key);
int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
*root, struct btrfs_key *key, struct btrfs_root_item const struct btrfs_key *key,
*item); struct btrfs_root_item *item);
int __must_check btrfs_update_root(struct btrfs_trans_handle *trans, int __must_check btrfs_update_root(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct btrfs_key *key, struct btrfs_key *key,
struct btrfs_root_item *item); struct btrfs_root_item *item);
int btrfs_find_root(struct btrfs_root *root, struct btrfs_key *search_key, int btrfs_find_root(struct btrfs_root *root, const struct btrfs_key *search_key,
struct btrfs_path *path, struct btrfs_root_item *root_item, struct btrfs_path *path, struct btrfs_root_item *root_item,
struct btrfs_key *root_key); struct btrfs_key *root_key);
int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info); int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info);
......
...@@ -8346,10 +8346,11 @@ static void unuse_block_rsv(struct btrfs_fs_info *fs_info, ...@@ -8346,10 +8346,11 @@ static void unuse_block_rsv(struct btrfs_fs_info *fs_info,
* returns the tree buffer or an ERR_PTR on error. * returns the tree buffer or an ERR_PTR on error.
*/ */
struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans, struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
u64 parent, u64 root_objectid, u64 parent, u64 root_objectid,
struct btrfs_disk_key *key, int level, const struct btrfs_disk_key *key,
u64 hint, u64 empty_size) int level, u64 hint,
u64 empty_size)
{ {
struct btrfs_fs_info *fs_info = root->fs_info; struct btrfs_fs_info *fs_info = root->fs_info;
struct btrfs_key ins; struct btrfs_key ins;
......
...@@ -74,7 +74,7 @@ static void btrfs_read_root_item(struct extent_buffer *eb, int slot, ...@@ -74,7 +74,7 @@ static void btrfs_read_root_item(struct extent_buffer *eb, int slot,
* *
* If we find something return 0, otherwise > 0, < 0 on error. * If we find something return 0, otherwise > 0, < 0 on error.
*/ */
int btrfs_find_root(struct btrfs_root *root, struct btrfs_key *search_key, int btrfs_find_root(struct btrfs_root *root, const struct btrfs_key *search_key,
struct btrfs_path *path, struct btrfs_root_item *root_item, struct btrfs_path *path, struct btrfs_root_item *root_item,
struct btrfs_key *root_key) struct btrfs_key *root_key)
{ {
...@@ -207,7 +207,7 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -207,7 +207,7 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
} }
int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
struct btrfs_key *key, struct btrfs_root_item *item) const struct btrfs_key *key, struct btrfs_root_item *item)
{ {
/* /*
* Make sure generation v1 and v2 match. See update_root for details. * Make sure generation v1 and v2 match. See update_root for details.
...@@ -337,7 +337,7 @@ int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info) ...@@ -337,7 +337,7 @@ int btrfs_find_orphan_roots(struct btrfs_fs_info *fs_info)
/* drop the root item for 'key' from 'root' */ /* drop the root item for 'key' from 'root' */
int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
struct btrfs_key *key) const struct btrfs_key *key)
{ {
struct btrfs_path *path; struct btrfs_path *path;
int ret; int ret;
......
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