Since backref resolution is CPU-intensive, the cond_resched calls
should help alleviate soft lockup occurences.

Signed-off-by: Edmund Nadolski <[email protected]>
Signed-off-by: Jeff Mahoney <[email protected]>
---
 fs/btrfs/backref.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 54180f4..3cd4f05 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -656,6 +656,7 @@ static int resolve_indirect_refs(struct btrfs_fs_info 
*fs_info,
                prelim_ref_insert(fs_info, &preftrees->direct, ref);
 
                ulist_reinit(parents);
+               cond_resched();
        }
 out:
        ulist_free(parents);
@@ -698,6 +699,7 @@ static int add_missing_keys(struct btrfs_fs_info *fs_info,
                btrfs_tree_read_unlock(eb);
                free_extent_buffer(eb);
                prelim_ref_insert(fs_info, &preftrees->indirect, ref);
+               cond_resched();
        }
        return 0;
 }
@@ -1239,6 +1241,7 @@ static int find_parent_nodes(struct btrfs_trans_handle 
*trans,
                        }
                        eie = NULL;
                }
+               cond_resched();
        }
 
 out:
-- 
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to