Commit 9dd14fd6 authored by Edmund Nadolski's avatar Edmund Nadolski Committed by David Sterba

btrfs: add cond_resched() calls when resolving backrefs

Since backref resolution is CPU-intensive, the cond_resched calls
should help alleviate soft lockup occurences.
Signed-off-by: default avatarEdmund Nadolski <enadolski@suse.com>
Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 00142756
...@@ -660,6 +660,7 @@ static int resolve_indirect_refs(struct btrfs_fs_info *fs_info, ...@@ -660,6 +660,7 @@ static int resolve_indirect_refs(struct btrfs_fs_info *fs_info,
prelim_ref_insert(fs_info, &preftrees->direct, ref); prelim_ref_insert(fs_info, &preftrees->direct, ref);
ulist_reinit(parents); ulist_reinit(parents);
cond_resched();
} }
out: out:
ulist_free(parents); ulist_free(parents);
...@@ -702,6 +703,7 @@ static int add_missing_keys(struct btrfs_fs_info *fs_info, ...@@ -702,6 +703,7 @@ static int add_missing_keys(struct btrfs_fs_info *fs_info,
btrfs_tree_read_unlock(eb); btrfs_tree_read_unlock(eb);
free_extent_buffer(eb); free_extent_buffer(eb);
prelim_ref_insert(fs_info, &preftrees->indirect, ref); prelim_ref_insert(fs_info, &preftrees->indirect, ref);
cond_resched();
} }
return 0; return 0;
} }
...@@ -1243,6 +1245,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, ...@@ -1243,6 +1245,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
} }
eie = NULL; eie = NULL;
} }
cond_resched();
} }
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment