Commit 96acb375 authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba

btrfs: voluntarily relinquish cpu when doing a full fsync

Doing a full fsync may require processing many leaves of metadata, which
can take some time and result in a task monopolizing a cpu for too long.
So add a cond_resched() after processing a leaf when doing a full fsync,
while not holding any locks on any tree (a subvolume or a log tree).
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 5b7ce5e2
...@@ -5712,6 +5712,13 @@ static int copy_inode_items_to_log(struct btrfs_trans_handle *trans, ...@@ -5712,6 +5712,13 @@ static int copy_inode_items_to_log(struct btrfs_trans_handle *trans,
} else { } else {
break; break;
} }
/*
* We may process many leaves full of items for our inode, so
* avoid monopolizing a cpu for too long by rescheduling while
* not holding locks on any tree.
*/
cond_resched();
} }
if (ins_nr) { if (ins_nr) {
ret = copy_items(trans, inode, dst_path, path, ins_start_slot, ret = copy_items(trans, inode, dst_path, path, ins_start_slot,
......
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