struct writeback_control *wbc)
{
int ret = 0;
- int flush_ret;
struct extent_page_data epd = {
.bio = NULL,
.tree = &BTRFS_I(mapping->host)->io_tree,
};
ret = extent_write_cache_pages(mapping, wbc, &epd);
- flush_ret = flush_write_bio(&epd);
- BUG_ON(flush_ret < 0);
+ ASSERT(ret <= 0);
+ if (ret < 0) {
+ end_write_bio(&epd, ret);
+ return ret;
+ }
+ ret = flush_write_bio(&epd);
return ret;
}