Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346745
b: refs/heads/master
c: 41be1f3
h: refs/heads/master
i:
  346743: b33c1f5
v: v3
  • Loading branch information
Josef Bacik authored and Chris Mason committed Dec 17, 2012
1 parent 09dbe71 commit ea1e086
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ad9145596986b672d8c8235c92ed5307f82d045d
refs/heads/master: 41be1f3b40b87de33cd2e7463dce88596dbdccc4
11 changes: 9 additions & 2 deletions trunk/fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3298,14 +3298,21 @@ static noinline int split_node(struct btrfs_trans_handle *trans,
*/
static int leaf_space_used(struct extent_buffer *l, int start, int nr)
{
struct btrfs_item *start_item;
struct btrfs_item *end_item;
struct btrfs_map_token token;
int data_len;
int nritems = btrfs_header_nritems(l);
int end = min(nritems, start + nr) - 1;

if (!nr)
return 0;
data_len = btrfs_item_end_nr(l, start);
data_len = data_len - btrfs_item_offset_nr(l, end);
btrfs_init_map_token(&token);
start_item = btrfs_item_nr(l, start);
end_item = btrfs_item_nr(l, end);
data_len = btrfs_token_item_offset(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 += sizeof(struct btrfs_item) * nr;
WARN_ON(data_len < 0);
return data_len;
Expand Down

0 comments on commit ea1e086

Please sign in to comment.