diff options
| -rw-r--r-- | fs/btrfs/send.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index c96e879bcb16..4d31f72bdf41 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
| @@ -4573,17 +4573,25 @@ static int process_all_extents(struct send_ctx *sctx) | |||
| 4573 | key.objectid = sctx->cmp_key->objectid; | 4573 | key.objectid = sctx->cmp_key->objectid; |
| 4574 | key.type = BTRFS_EXTENT_DATA_KEY; | 4574 | key.type = BTRFS_EXTENT_DATA_KEY; |
| 4575 | key.offset = 0; | 4575 | key.offset = 0; |
| 4576 | while (1) { | 4576 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); |
| 4577 | ret = btrfs_search_slot_for_read(root, &key, path, 1, 0); | 4577 | if (ret < 0) |
| 4578 | if (ret < 0) | 4578 | goto out; |
| 4579 | goto out; | ||
| 4580 | if (ret) { | ||
| 4581 | ret = 0; | ||
| 4582 | goto out; | ||
| 4583 | } | ||
| 4584 | 4579 | ||
| 4580 | while (1) { | ||
| 4585 | eb = path->nodes[0]; | 4581 | eb = path->nodes[0]; |
| 4586 | slot = path->slots[0]; | 4582 | slot = path->slots[0]; |
| 4583 | |||
| 4584 | if (slot >= btrfs_header_nritems(eb)) { | ||
| 4585 | ret = btrfs_next_leaf(root, path); | ||
| 4586 | if (ret < 0) { | ||
| 4587 | goto out; | ||
| 4588 | } else if (ret > 0) { | ||
| 4589 | ret = 0; | ||
| 4590 | break; | ||
| 4591 | } | ||
| 4592 | continue; | ||
| 4593 | } | ||
| 4594 | |||
| 4587 | btrfs_item_key_to_cpu(eb, &found_key, slot); | 4595 | btrfs_item_key_to_cpu(eb, &found_key, slot); |
| 4588 | 4596 | ||
| 4589 | if (found_key.objectid != key.objectid || | 4597 | if (found_key.objectid != key.objectid || |
| @@ -4596,8 +4604,7 @@ static int process_all_extents(struct send_ctx *sctx) | |||
| 4596 | if (ret < 0) | 4604 | if (ret < 0) |
| 4597 | goto out; | 4605 | goto out; |
| 4598 | 4606 | ||
| 4599 | btrfs_release_path(path); | 4607 | path->slots[0]++; |
| 4600 | key.offset = found_key.offset + 1; | ||
| 4601 | } | 4608 | } |
| 4602 | 4609 | ||
| 4603 | out: | 4610 | out: |
