Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e34a5b4f authored by Chris Mason's avatar Chris Mason
Browse files

Btrfs: Add some conditional schedules near the alloc_mutex



This helps prevent stalls, especially while the snapshot cleaner is
running hard

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 6dddcbeb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -937,6 +937,7 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
	level = btrfs_header_level(buf);
	nritems = btrfs_header_nritems(buf);
	for (i = 0; i < nritems; i++) {
		cond_resched();
		if (level == 0) {
			u64 disk_bytenr;
			btrfs_item_key_to_cpu(buf, &key, i);
@@ -2189,6 +2190,7 @@ static int noinline drop_leaf_ref(struct btrfs_trans_handle *trans,

	for (i = 0; i < nritems; i++) {
		u64 disk_bytenr;
		cond_resched();

		btrfs_item_key_to_cpu(leaf, &key, i);
		if (btrfs_key_type(&key) != BTRFS_EXTENT_DATA_KEY)