When pin_down_bytes decides not to pin a block because it was from the
current transaction, make sure the in memory cache of free extents is updated
Signed-off-by: Chris Mason <chris.mason@oracle.com>
root->fs_info->running_transaction->transid;
if (btrfs_header_generation(buf) == transid) {
free_extent_buffer(buf);
- return 0;
+ return 1;
}
}
free_extent_buffer(buf);
if (pin) {
ret = pin_down_bytes(root, bytenr, num_bytes, 0);
- BUG_ON(ret);
+ if (ret > 0)
+ mark_free = 1;
+ BUG_ON(ret < 0);
}
/* block accounting for super block */