提交 dd3cc16b 编写于 作者: R Ross Kirk 提交者: Chris Mason

btrfs: drop unused parameter from btrfs_item_nr

Remove unused eb parameter from btrfs_item_nr
Signed-off-by: NRoss Kirk <ross.kirk@gmail.com>
Reviewed-by: NDavid Sterba <dsterba@suse.cz>
Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
Signed-off-by: NChris Mason <chris.mason@fusionio.com>
上级 f06becc4
...@@ -1619,7 +1619,7 @@ static int iterate_inode_refs(u64 inum, struct btrfs_root *fs_root, ...@@ -1619,7 +1619,7 @@ static int iterate_inode_refs(u64 inum, struct btrfs_root *fs_root,
btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK);
btrfs_release_path(path); btrfs_release_path(path);
item = btrfs_item_nr(eb, slot); item = btrfs_item_nr(slot);
iref = btrfs_item_ptr(eb, slot, struct btrfs_inode_ref); iref = btrfs_item_ptr(eb, slot, struct btrfs_inode_ref);
for (cur = 0; cur < btrfs_item_size(eb, item); cur += len) { for (cur = 0; cur < btrfs_item_size(eb, item); cur += len) {
......
...@@ -3337,8 +3337,8 @@ static int leaf_space_used(struct extent_buffer *l, int start, int nr) ...@@ -3337,8 +3337,8 @@ static int leaf_space_used(struct extent_buffer *l, int start, int nr)
if (!nr) if (!nr)
return 0; return 0;
btrfs_init_map_token(&token); btrfs_init_map_token(&token);
start_item = btrfs_item_nr(l, start); start_item = btrfs_item_nr(start);
end_item = btrfs_item_nr(l, end); end_item = btrfs_item_nr(end);
data_len = btrfs_token_item_offset(l, start_item, &token) + data_len = btrfs_token_item_offset(l, start_item, &token) +
btrfs_token_item_size(l, start_item, &token); btrfs_token_item_size(l, start_item, &token);
data_len = data_len - btrfs_token_item_offset(l, end_item, &token); data_len = data_len - btrfs_token_item_offset(l, end_item, &token);
...@@ -3406,7 +3406,7 @@ static noinline int __push_leaf_right(struct btrfs_trans_handle *trans, ...@@ -3406,7 +3406,7 @@ static noinline int __push_leaf_right(struct btrfs_trans_handle *trans,
slot = path->slots[1]; slot = path->slots[1];
i = left_nritems - 1; i = left_nritems - 1;
while (i >= nr) { while (i >= nr) {
item = btrfs_item_nr(left, i); item = btrfs_item_nr(i);
if (!empty && push_items > 0) { if (!empty && push_items > 0) {
if (path->slots[0] > i) if (path->slots[0] > i)
...@@ -3470,7 +3470,7 @@ static noinline int __push_leaf_right(struct btrfs_trans_handle *trans, ...@@ -3470,7 +3470,7 @@ static noinline int __push_leaf_right(struct btrfs_trans_handle *trans,
btrfs_set_header_nritems(right, right_nritems); btrfs_set_header_nritems(right, right_nritems);
push_space = BTRFS_LEAF_DATA_SIZE(root); push_space = BTRFS_LEAF_DATA_SIZE(root);
for (i = 0; i < right_nritems; i++) { for (i = 0; i < right_nritems; i++) {
item = btrfs_item_nr(right, i); item = btrfs_item_nr(i);
push_space -= btrfs_token_item_size(right, item, &token); push_space -= btrfs_token_item_size(right, item, &token);
btrfs_set_token_item_offset(right, item, push_space, &token); btrfs_set_token_item_offset(right, item, push_space, &token);
} }
...@@ -3612,7 +3612,7 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans, ...@@ -3612,7 +3612,7 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
nr = min(right_nritems - 1, max_slot); nr = min(right_nritems - 1, max_slot);
for (i = 0; i < nr; i++) { for (i = 0; i < nr; i++) {
item = btrfs_item_nr(right, i); item = btrfs_item_nr(i);
if (!empty && push_items > 0) { if (!empty && push_items > 0) {
if (path->slots[0] < i) if (path->slots[0] < i)
...@@ -3663,7 +3663,7 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans, ...@@ -3663,7 +3663,7 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
for (i = old_left_nritems; i < old_left_nritems + push_items; i++) { for (i = old_left_nritems; i < old_left_nritems + push_items; i++) {
u32 ioff; u32 ioff;
item = btrfs_item_nr(left, i); item = btrfs_item_nr(i);
ioff = btrfs_token_item_offset(left, item, &token); ioff = btrfs_token_item_offset(left, item, &token);
btrfs_set_token_item_offset(left, item, btrfs_set_token_item_offset(left, item,
...@@ -3694,7 +3694,7 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans, ...@@ -3694,7 +3694,7 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
btrfs_set_header_nritems(right, right_nritems); btrfs_set_header_nritems(right, right_nritems);
push_space = BTRFS_LEAF_DATA_SIZE(root); push_space = BTRFS_LEAF_DATA_SIZE(root);
for (i = 0; i < right_nritems; i++) { for (i = 0; i < right_nritems; i++) {
item = btrfs_item_nr(right, i); item = btrfs_item_nr(i);
push_space = push_space - btrfs_token_item_size(right, push_space = push_space - btrfs_token_item_size(right,
item, &token); item, &token);
...@@ -3835,7 +3835,7 @@ static noinline void copy_for_split(struct btrfs_trans_handle *trans, ...@@ -3835,7 +3835,7 @@ static noinline void copy_for_split(struct btrfs_trans_handle *trans,
btrfs_item_end_nr(l, mid); btrfs_item_end_nr(l, mid);
for (i = 0; i < nritems; i++) { for (i = 0; i < nritems; i++) {
struct btrfs_item *item = btrfs_item_nr(right, i); struct btrfs_item *item = btrfs_item_nr(i);
u32 ioff; u32 ioff;
ioff = btrfs_token_item_offset(right, item, &token); ioff = btrfs_token_item_offset(right, item, &token);
...@@ -4177,7 +4177,7 @@ static noinline int split_item(struct btrfs_trans_handle *trans, ...@@ -4177,7 +4177,7 @@ static noinline int split_item(struct btrfs_trans_handle *trans,
btrfs_set_path_blocking(path); btrfs_set_path_blocking(path);
item = btrfs_item_nr(leaf, path->slots[0]); item = btrfs_item_nr(path->slots[0]);
orig_offset = btrfs_item_offset(leaf, item); orig_offset = btrfs_item_offset(leaf, item);
item_size = btrfs_item_size(leaf, item); item_size = btrfs_item_size(leaf, item);
...@@ -4200,7 +4200,7 @@ static noinline int split_item(struct btrfs_trans_handle *trans, ...@@ -4200,7 +4200,7 @@ static noinline int split_item(struct btrfs_trans_handle *trans,
btrfs_cpu_key_to_disk(&disk_key, new_key); btrfs_cpu_key_to_disk(&disk_key, new_key);
btrfs_set_item_key(leaf, &disk_key, slot); btrfs_set_item_key(leaf, &disk_key, slot);
new_item = btrfs_item_nr(leaf, slot); new_item = btrfs_item_nr(slot);
btrfs_set_item_offset(leaf, new_item, orig_offset); btrfs_set_item_offset(leaf, new_item, orig_offset);
btrfs_set_item_size(leaf, new_item, item_size - split_offset); btrfs_set_item_size(leaf, new_item, item_size - split_offset);
...@@ -4339,7 +4339,7 @@ void btrfs_truncate_item(struct btrfs_root *root, struct btrfs_path *path, ...@@ -4339,7 +4339,7 @@ void btrfs_truncate_item(struct btrfs_root *root, struct btrfs_path *path,
/* first correct the data pointers */ /* first correct the data pointers */
for (i = slot; i < nritems; i++) { for (i = slot; i < nritems; i++) {
u32 ioff; u32 ioff;
item = btrfs_item_nr(leaf, i); item = btrfs_item_nr(i);
ioff = btrfs_token_item_offset(leaf, item, &token); ioff = btrfs_token_item_offset(leaf, item, &token);
btrfs_set_token_item_offset(leaf, item, btrfs_set_token_item_offset(leaf, item,
...@@ -4387,7 +4387,7 @@ void btrfs_truncate_item(struct btrfs_root *root, struct btrfs_path *path, ...@@ -4387,7 +4387,7 @@ void btrfs_truncate_item(struct btrfs_root *root, struct btrfs_path *path,
fixup_low_keys(root, path, &disk_key, 1); fixup_low_keys(root, path, &disk_key, 1);
} }
item = btrfs_item_nr(leaf, slot); item = btrfs_item_nr(slot);
btrfs_set_item_size(leaf, item, new_size); btrfs_set_item_size(leaf, item, new_size);
btrfs_mark_buffer_dirty(leaf); btrfs_mark_buffer_dirty(leaf);
...@@ -4441,7 +4441,7 @@ void btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path, ...@@ -4441,7 +4441,7 @@ void btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path,
/* first correct the data pointers */ /* first correct the data pointers */
for (i = slot; i < nritems; i++) { for (i = slot; i < nritems; i++) {
u32 ioff; u32 ioff;
item = btrfs_item_nr(leaf, i); item = btrfs_item_nr(i);
ioff = btrfs_token_item_offset(leaf, item, &token); ioff = btrfs_token_item_offset(leaf, item, &token);
btrfs_set_token_item_offset(leaf, item, btrfs_set_token_item_offset(leaf, item,
...@@ -4455,7 +4455,7 @@ void btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path, ...@@ -4455,7 +4455,7 @@ void btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path,
data_end = old_data; data_end = old_data;
old_size = btrfs_item_size_nr(leaf, slot); old_size = btrfs_item_size_nr(leaf, slot);
item = btrfs_item_nr(leaf, slot); item = btrfs_item_nr(slot);
btrfs_set_item_size(leaf, item, old_size + data_size); btrfs_set_item_size(leaf, item, old_size + data_size);
btrfs_mark_buffer_dirty(leaf); btrfs_mark_buffer_dirty(leaf);
...@@ -4514,7 +4514,7 @@ void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path, ...@@ -4514,7 +4514,7 @@ void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path,
for (i = slot; i < nritems; i++) { for (i = slot; i < nritems; i++) {
u32 ioff; u32 ioff;
item = btrfs_item_nr(leaf, i); item = btrfs_item_nr( i);
ioff = btrfs_token_item_offset(leaf, item, &token); ioff = btrfs_token_item_offset(leaf, item, &token);
btrfs_set_token_item_offset(leaf, item, btrfs_set_token_item_offset(leaf, item,
ioff - total_data, &token); ioff - total_data, &token);
...@@ -4535,7 +4535,7 @@ void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path, ...@@ -4535,7 +4535,7 @@ void setup_items_for_insert(struct btrfs_root *root, struct btrfs_path *path,
for (i = 0; i < nr; i++) { for (i = 0; i < nr; i++) {
btrfs_cpu_key_to_disk(&disk_key, cpu_key + i); btrfs_cpu_key_to_disk(&disk_key, cpu_key + i);
btrfs_set_item_key(leaf, &disk_key, slot + i); btrfs_set_item_key(leaf, &disk_key, slot + i);
item = btrfs_item_nr(leaf, slot + i); item = btrfs_item_nr(slot + i);
btrfs_set_token_item_offset(leaf, item, btrfs_set_token_item_offset(leaf, item,
data_end - data_size[i], &token); data_end - data_size[i], &token);
data_end -= data_size[i]; data_end -= data_size[i];
...@@ -4730,7 +4730,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root, ...@@ -4730,7 +4730,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
for (i = slot + nr; i < nritems; i++) { for (i = slot + nr; i < nritems; i++) {
u32 ioff; u32 ioff;
item = btrfs_item_nr(leaf, i); item = btrfs_item_nr(i);
ioff = btrfs_token_item_offset(leaf, item, &token); ioff = btrfs_token_item_offset(leaf, item, &token);
btrfs_set_token_item_offset(leaf, item, btrfs_set_token_item_offset(leaf, item,
ioff + dsize, &token); ioff + dsize, &token);
......
...@@ -2461,8 +2461,7 @@ static inline unsigned long btrfs_item_nr_offset(int nr) ...@@ -2461,8 +2461,7 @@ static inline unsigned long btrfs_item_nr_offset(int nr)
sizeof(struct btrfs_item) * nr; sizeof(struct btrfs_item) * nr;
} }
static inline struct btrfs_item *btrfs_item_nr(struct extent_buffer *eb, static inline struct btrfs_item *btrfs_item_nr(int nr)
int nr)
{ {
return (struct btrfs_item *)btrfs_item_nr_offset(nr); return (struct btrfs_item *)btrfs_item_nr_offset(nr);
} }
...@@ -2475,30 +2474,30 @@ static inline u32 btrfs_item_end(struct extent_buffer *eb, ...@@ -2475,30 +2474,30 @@ static inline u32 btrfs_item_end(struct extent_buffer *eb,
static inline u32 btrfs_item_end_nr(struct extent_buffer *eb, int nr) static inline u32 btrfs_item_end_nr(struct extent_buffer *eb, int nr)
{ {
return btrfs_item_end(eb, btrfs_item_nr(eb, nr)); return btrfs_item_end(eb, btrfs_item_nr(nr));
} }
static inline u32 btrfs_item_offset_nr(struct extent_buffer *eb, int nr) static inline u32 btrfs_item_offset_nr(struct extent_buffer *eb, int nr)
{ {
return btrfs_item_offset(eb, btrfs_item_nr(eb, nr)); return btrfs_item_offset(eb, btrfs_item_nr(nr));
} }
static inline u32 btrfs_item_size_nr(struct extent_buffer *eb, int nr) static inline u32 btrfs_item_size_nr(struct extent_buffer *eb, int nr)
{ {
return btrfs_item_size(eb, btrfs_item_nr(eb, nr)); return btrfs_item_size(eb, btrfs_item_nr(nr));
} }
static inline void btrfs_item_key(struct extent_buffer *eb, static inline void btrfs_item_key(struct extent_buffer *eb,
struct btrfs_disk_key *disk_key, int nr) struct btrfs_disk_key *disk_key, int nr)
{ {
struct btrfs_item *item = btrfs_item_nr(eb, nr); struct btrfs_item *item = btrfs_item_nr(nr);
read_eb_member(eb, item, struct btrfs_item, key, disk_key); read_eb_member(eb, item, struct btrfs_item, key, disk_key);
} }
static inline void btrfs_set_item_key(struct extent_buffer *eb, static inline void btrfs_set_item_key(struct extent_buffer *eb,
struct btrfs_disk_key *disk_key, int nr) struct btrfs_disk_key *disk_key, int nr)
{ {
struct btrfs_item *item = btrfs_item_nr(eb, nr); struct btrfs_item *item = btrfs_item_nr(nr);
write_eb_member(eb, item, struct btrfs_item, key, disk_key); write_eb_member(eb, item, struct btrfs_item, key, disk_key);
} }
......
...@@ -58,7 +58,7 @@ static struct btrfs_dir_item *insert_with_overflow(struct btrfs_trans_handle ...@@ -58,7 +58,7 @@ static struct btrfs_dir_item *insert_with_overflow(struct btrfs_trans_handle
return ERR_PTR(ret); return ERR_PTR(ret);
WARN_ON(ret > 0); WARN_ON(ret > 0);
leaf = path->nodes[0]; leaf = path->nodes[0];
item = btrfs_item_nr(leaf, path->slots[0]); item = btrfs_item_nr(path->slots[0]);
ptr = btrfs_item_ptr(leaf, path->slots[0], char); ptr = btrfs_item_ptr(leaf, path->slots[0], char);
BUG_ON(data_size > btrfs_item_size(leaf, item)); BUG_ON(data_size > btrfs_item_size(leaf, item));
ptr += btrfs_item_size(leaf, item) - data_size; ptr += btrfs_item_size(leaf, item) - data_size;
......
...@@ -369,7 +369,7 @@ static int btrfs_insert_inode_extref(struct btrfs_trans_handle *trans, ...@@ -369,7 +369,7 @@ static int btrfs_insert_inode_extref(struct btrfs_trans_handle *trans,
goto out; goto out;
leaf = path->nodes[0]; leaf = path->nodes[0];
item = btrfs_item_nr(leaf, path->slots[0]); item = btrfs_item_nr(path->slots[0]);
ptr = (unsigned long)btrfs_item_ptr(leaf, path->slots[0], char); ptr = (unsigned long)btrfs_item_ptr(leaf, path->slots[0], char);
ptr += btrfs_item_size(leaf, item) - ins_len; ptr += btrfs_item_size(leaf, item) - ins_len;
extref = (struct btrfs_inode_extref *)ptr; extref = (struct btrfs_inode_extref *)ptr;
......
...@@ -5044,7 +5044,7 @@ static int btrfs_real_readdir(struct file *file, struct dir_context *ctx) ...@@ -5044,7 +5044,7 @@ static int btrfs_real_readdir(struct file *file, struct dir_context *ctx)
continue; continue;
} }
item = btrfs_item_nr(leaf, slot); item = btrfs_item_nr(slot);
btrfs_item_key_to_cpu(leaf, &found_key, slot); btrfs_item_key_to_cpu(leaf, &found_key, slot);
if (found_key.objectid != key.objectid) if (found_key.objectid != key.objectid)
...@@ -5856,7 +5856,7 @@ static noinline int uncompress_inline(struct btrfs_path *path, ...@@ -5856,7 +5856,7 @@ static noinline int uncompress_inline(struct btrfs_path *path,
compress_type = btrfs_file_extent_compression(leaf, item); compress_type = btrfs_file_extent_compression(leaf, item);
max_size = btrfs_file_extent_ram_bytes(leaf, item); max_size = btrfs_file_extent_ram_bytes(leaf, item);
inline_size = btrfs_file_extent_inline_item_len(leaf, inline_size = btrfs_file_extent_inline_item_len(leaf,
btrfs_item_nr(leaf, path->slots[0])); btrfs_item_nr(path->slots[0]));
tmp = kmalloc(inline_size, GFP_NOFS); tmp = kmalloc(inline_size, GFP_NOFS);
if (!tmp) if (!tmp)
return -ENOMEM; return -ENOMEM;
......
...@@ -193,7 +193,7 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l) ...@@ -193,7 +193,7 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
btrfs_info(root->fs_info, "leaf %llu total ptrs %d free space %d", btrfs_info(root->fs_info, "leaf %llu total ptrs %d free space %d",
btrfs_header_bytenr(l), nr, btrfs_leaf_free_space(root, l)); btrfs_header_bytenr(l), nr, btrfs_leaf_free_space(root, l));
for (i = 0 ; i < nr ; i++) { for (i = 0 ; i < nr ; i++) {
item = btrfs_item_nr(l, i); item = btrfs_item_nr(i);
btrfs_item_key_to_cpu(l, &key, i); btrfs_item_key_to_cpu(l, &key, i);
type = btrfs_key_type(&key); type = btrfs_key_type(&key);
printk(KERN_INFO "\titem %d key (%llu %u %llu) itemoff %d " printk(KERN_INFO "\titem %d key (%llu %u %llu) itemoff %d "
......
...@@ -791,7 +791,7 @@ static int iterate_inode_ref(struct btrfs_root *root, struct btrfs_path *path, ...@@ -791,7 +791,7 @@ static int iterate_inode_ref(struct btrfs_root *root, struct btrfs_path *path,
if (found_key->type == BTRFS_INODE_REF_KEY) { if (found_key->type == BTRFS_INODE_REF_KEY) {
ptr = (unsigned long)btrfs_item_ptr(eb, slot, ptr = (unsigned long)btrfs_item_ptr(eb, slot,
struct btrfs_inode_ref); struct btrfs_inode_ref);
item = btrfs_item_nr(eb, slot); item = btrfs_item_nr(slot);
total = btrfs_item_size(eb, item); total = btrfs_item_size(eb, item);
elem_size = sizeof(*iref); elem_size = sizeof(*iref);
} else { } else {
...@@ -905,7 +905,7 @@ static int iterate_dir_item(struct btrfs_root *root, struct btrfs_path *path, ...@@ -905,7 +905,7 @@ static int iterate_dir_item(struct btrfs_root *root, struct btrfs_path *path,
eb = path->nodes[0]; eb = path->nodes[0];
slot = path->slots[0]; slot = path->slots[0];
item = btrfs_item_nr(eb, slot); item = btrfs_item_nr(slot);
di = btrfs_item_ptr(eb, slot, struct btrfs_dir_item); di = btrfs_item_ptr(eb, slot, struct btrfs_dir_item);
cur = 0; cur = 0;
len = 0; len = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册