Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297877
b: refs/heads/master
c: 0678b61
h: refs/heads/master
i:
  297875: 2b52378
v: v3
  • Loading branch information
Mark Fasheh authored and David Sterba committed Mar 22, 2012
1 parent ce549d8 commit 8f2779c
Show file tree
Hide file tree
Showing 2 changed files with 14 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: be1a5564fd39fa2ca6adbb41c75fb08f96a1ffcb
refs/heads/master: 0678b61851b510ba68341dff59cd9b47e1712e91
15 changes: 13 additions & 2 deletions trunk/fs/btrfs/file-item.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
struct btrfs_ordered_sum *sums;
struct btrfs_sector_sum *sector_sum;
struct btrfs_csum_item *item;
LIST_HEAD(tmplist);
unsigned long offset;
int ret;
size_t size;
Expand Down Expand Up @@ -358,7 +359,10 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
MAX_ORDERED_SUM_BYTES(root));
sums = kzalloc(btrfs_ordered_sum_size(root, size),
GFP_NOFS);
BUG_ON(!sums);
if (!sums) {
ret = -ENOMEM;
goto fail;
}

sector_sum = sums->sums;
sums->bytenr = start;
Expand All @@ -380,12 +384,19 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end,
offset += csum_size;
sector_sum++;
}
list_add_tail(&sums->list, list);
list_add_tail(&sums->list, &tmplist);
}
path->slots[0]++;
}
ret = 0;
fail:
while (ret < 0 && !list_empty(&tmplist)) {
sums = list_entry(&tmplist, struct btrfs_ordered_sum, list);
list_del(&sums->list);
kfree(sums);
}
list_splice_tail(&tmplist, list);

btrfs_free_path(path);
return ret;
}
Expand Down

0 comments on commit 8f2779c

Please sign in to comment.