mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2025-01-07 11:33:51 +08:00
btrfs-progs: rename btrfs_item_end_nr to btrfs_item_end
All callers use the btrfs_item_end_nr() variation, simply drop btrfs_item_end() and make btrfs_item_end_nr() use the _nr() variations of the item get helpers. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
49539423fa
commit
f3be0ff01a
12
check/main.c
12
check/main.c
@ -4327,9 +4327,9 @@ again:
|
||||
for (i = 0; i < btrfs_header_nritems(buf); i++) {
|
||||
unsigned int shift = 0, offset;
|
||||
|
||||
if (i == 0 && btrfs_item_end_nr(buf, i) !=
|
||||
if (i == 0 && btrfs_item_end(buf, i) !=
|
||||
BTRFS_LEAF_DATA_SIZE(gfs_info)) {
|
||||
if (btrfs_item_end_nr(buf, i) >
|
||||
if (btrfs_item_end(buf, i) >
|
||||
BTRFS_LEAF_DATA_SIZE(gfs_info)) {
|
||||
ret = delete_bogus_item(root, path, buf, i);
|
||||
if (!ret)
|
||||
@ -4340,10 +4340,10 @@ again:
|
||||
break;
|
||||
}
|
||||
shift = BTRFS_LEAF_DATA_SIZE(gfs_info) -
|
||||
btrfs_item_end_nr(buf, i);
|
||||
} else if (i > 0 && btrfs_item_end_nr(buf, i) !=
|
||||
btrfs_item_end(buf, i);
|
||||
} else if (i > 0 && btrfs_item_end(buf, i) !=
|
||||
btrfs_item_offset_nr(buf, i - 1)) {
|
||||
if (btrfs_item_end_nr(buf, i) >
|
||||
if (btrfs_item_end(buf, i) >
|
||||
btrfs_item_offset_nr(buf, i - 1)) {
|
||||
ret = delete_bogus_item(root, path, buf, i);
|
||||
if (!ret)
|
||||
@ -4353,7 +4353,7 @@ again:
|
||||
break;
|
||||
}
|
||||
shift = btrfs_item_offset_nr(buf, i - 1) -
|
||||
btrfs_item_end_nr(buf, i);
|
||||
btrfs_item_end(buf, i);
|
||||
}
|
||||
if (!shift)
|
||||
continue;
|
||||
|
@ -730,10 +730,10 @@ btrfs_check_leaf(struct btrfs_fs_info *fs_info,
|
||||
else
|
||||
item_end_expected = btrfs_item_offset_nr(leaf,
|
||||
slot - 1);
|
||||
if (btrfs_item_end_nr(leaf, slot) != item_end_expected) {
|
||||
if (btrfs_item_end(leaf, slot) != item_end_expected) {
|
||||
generic_err(leaf, slot,
|
||||
"unexpected item end, have %u expect %u",
|
||||
btrfs_item_end_nr(leaf, slot),
|
||||
btrfs_item_end(leaf, slot),
|
||||
item_end_expected);
|
||||
ret = BTRFS_TREE_BLOCK_INVALID_OFFSETS;
|
||||
goto fail;
|
||||
@ -744,11 +744,11 @@ btrfs_check_leaf(struct btrfs_fs_info *fs_info,
|
||||
* just in case all the items are consistent to each other, but
|
||||
* all point outside of the leaf.
|
||||
*/
|
||||
if (btrfs_item_end_nr(leaf, slot) >
|
||||
if (btrfs_item_end(leaf, slot) >
|
||||
BTRFS_LEAF_DATA_SIZE(fs_info)) {
|
||||
generic_err(leaf, slot,
|
||||
"slot end outside of leaf, have %u expect range [0, %u]",
|
||||
btrfs_item_end_nr(leaf, slot),
|
||||
btrfs_item_end(leaf, slot),
|
||||
BTRFS_LEAF_DATA_SIZE(fs_info));
|
||||
ret = BTRFS_TREE_BLOCK_INVALID_OFFSETS;
|
||||
goto fail;
|
||||
@ -1931,7 +1931,7 @@ static int leaf_space_used(struct extent_buffer *l, int start, int nr)
|
||||
|
||||
if (!nr)
|
||||
return 0;
|
||||
data_len = btrfs_item_end_nr(l, start);
|
||||
data_len = btrfs_item_end(l, start);
|
||||
data_len = data_len - btrfs_item_offset_nr(l, end);
|
||||
data_len += sizeof(struct btrfs_item) * nr;
|
||||
WARN_ON(data_len < 0);
|
||||
@ -2059,7 +2059,7 @@ static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root
|
||||
/* push left to right */
|
||||
right_nritems = btrfs_header_nritems(right);
|
||||
|
||||
push_space = btrfs_item_end_nr(left, left_nritems - push_items);
|
||||
push_space = btrfs_item_end(left, left_nritems - push_items);
|
||||
push_space -= leaf_data_end(left);
|
||||
|
||||
/* make room in the right data area */
|
||||
@ -2294,7 +2294,7 @@ static noinline int copy_for_split(struct btrfs_trans_handle *trans,
|
||||
|
||||
nritems = nritems - mid;
|
||||
btrfs_set_header_nritems(right, nritems);
|
||||
data_copy_size = btrfs_item_end_nr(l, mid) - leaf_data_end(l);
|
||||
data_copy_size = btrfs_item_end(l, mid) - leaf_data_end(l);
|
||||
|
||||
copy_extent_buffer(right, l, btrfs_item_nr_offset(0),
|
||||
btrfs_item_nr_offset(mid),
|
||||
@ -2306,7 +2306,7 @@ static noinline int copy_for_split(struct btrfs_trans_handle *trans,
|
||||
btrfs_leaf_data(l) + leaf_data_end(l), data_copy_size);
|
||||
|
||||
rt_data_off = BTRFS_LEAF_DATA_SIZE(root->fs_info) -
|
||||
btrfs_item_end_nr(l, mid);
|
||||
btrfs_item_end(l, mid);
|
||||
|
||||
for (i = 0; i < nritems; i++) {
|
||||
u32 ioff = btrfs_item_offset_nr(right, i);
|
||||
@ -2727,7 +2727,7 @@ int btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path,
|
||||
BUG();
|
||||
}
|
||||
slot = path->slots[0];
|
||||
old_data = btrfs_item_end_nr(leaf, slot);
|
||||
old_data = btrfs_item_end(leaf, slot);
|
||||
|
||||
BUG_ON(slot < 0);
|
||||
if (slot >= nritems) {
|
||||
@ -2816,7 +2816,7 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
|
||||
BUG_ON(slot < 0);
|
||||
|
||||
if (slot < nritems) {
|
||||
unsigned int old_data = btrfs_item_end_nr(leaf, slot);
|
||||
unsigned int old_data = btrfs_item_end(leaf, slot);
|
||||
|
||||
if (old_data < data_end) {
|
||||
btrfs_print_leaf(leaf, BTRFS_PRINT_TREE_DEFAULT);
|
||||
|
@ -1994,17 +1994,6 @@ static inline struct btrfs_item *btrfs_item_nr(int nr)
|
||||
return (struct btrfs_item *)btrfs_item_nr_offset(nr);
|
||||
}
|
||||
|
||||
static inline u32 btrfs_item_end(struct extent_buffer *eb,
|
||||
struct btrfs_item *item)
|
||||
{
|
||||
return btrfs_item_offset(eb, item) + btrfs_item_size(eb, item);
|
||||
}
|
||||
|
||||
static inline u32 btrfs_item_end_nr(struct extent_buffer *eb, int nr)
|
||||
{
|
||||
return btrfs_item_end(eb, btrfs_item_nr(nr));
|
||||
}
|
||||
|
||||
static inline void btrfs_set_item_size_nr(struct extent_buffer *eb, int nr,
|
||||
u32 size)
|
||||
{
|
||||
@ -2027,6 +2016,11 @@ static inline u32 btrfs_item_size_nr(struct extent_buffer *eb, int nr)
|
||||
return btrfs_item_size(eb, btrfs_item_nr(nr));
|
||||
}
|
||||
|
||||
static inline u32 btrfs_item_end(struct extent_buffer *eb, int nr)
|
||||
{
|
||||
return btrfs_item_offset_nr(eb, nr) + btrfs_item_size_nr(eb, nr);
|
||||
}
|
||||
|
||||
static inline void btrfs_item_key(struct extent_buffer *eb,
|
||||
struct btrfs_disk_key *disk_key, int nr)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user