diff options
| -rw-r--r-- | fs/btrfs/extent-tree.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 36af54bec111..1d49694e6ae3 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -8764,6 +8764,8 @@ struct walk_control { | |||
| 8764 | u64 refs[BTRFS_MAX_LEVEL]; | 8764 | u64 refs[BTRFS_MAX_LEVEL]; |
| 8765 | u64 flags[BTRFS_MAX_LEVEL]; | 8765 | u64 flags[BTRFS_MAX_LEVEL]; |
| 8766 | struct btrfs_key update_progress; | 8766 | struct btrfs_key update_progress; |
| 8767 | struct btrfs_key drop_progress; | ||
| 8768 | int drop_level; | ||
| 8767 | int stage; | 8769 | int stage; |
| 8768 | int level; | 8770 | int level; |
| 8769 | int shared_level; | 8771 | int shared_level; |
| @@ -9147,6 +9149,16 @@ skip: | |||
| 9147 | ret); | 9149 | ret); |
| 9148 | } | 9150 | } |
| 9149 | } | 9151 | } |
| 9152 | |||
| 9153 | /* | ||
| 9154 | * We need to update the next key in our walk control so we can | ||
| 9155 | * update the drop_progress key accordingly. We don't care if | ||
| 9156 | * find_next_key doesn't find a key because that means we're at | ||
| 9157 | * the end and are going to clean up now. | ||
| 9158 | */ | ||
| 9159 | wc->drop_level = level; | ||
| 9160 | find_next_key(path, level, &wc->drop_progress); | ||
| 9161 | |||
| 9150 | ret = btrfs_free_extent(trans, root, bytenr, fs_info->nodesize, | 9162 | ret = btrfs_free_extent(trans, root, bytenr, fs_info->nodesize, |
| 9151 | parent, root->root_key.objectid, | 9163 | parent, root->root_key.objectid, |
| 9152 | level - 1, 0); | 9164 | level - 1, 0); |
| @@ -9498,12 +9510,14 @@ int btrfs_drop_snapshot(struct btrfs_root *root, | |||
| 9498 | } | 9510 | } |
| 9499 | 9511 | ||
| 9500 | if (wc->stage == DROP_REFERENCE) { | 9512 | if (wc->stage == DROP_REFERENCE) { |
| 9501 | level = wc->level; | 9513 | wc->drop_level = wc->level; |
| 9502 | btrfs_node_key(path->nodes[level], | 9514 | btrfs_node_key_to_cpu(path->nodes[wc->drop_level], |
| 9503 | &root_item->drop_progress, | 9515 | &wc->drop_progress, |
| 9504 | path->slots[level]); | 9516 | path->slots[wc->drop_level]); |
| 9505 | root_item->drop_level = level; | 9517 | } |
| 9506 | } | 9518 | btrfs_cpu_key_to_disk(&root_item->drop_progress, |
| 9519 | &wc->drop_progress); | ||
| 9520 | root_item->drop_level = wc->drop_level; | ||
| 9507 | 9521 | ||
| 9508 | BUG_ON(wc->level == 0); | 9522 | BUG_ON(wc->level == 0); |
| 9509 | if (btrfs_should_end_transaction(trans) || | 9523 | if (btrfs_should_end_transaction(trans) || |
