This helps prevent stalls, especially while the snapshot cleaner is
running hard
Signed-off-by: Chris Mason <chris.mason@oracle.com>
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);
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)