/* Writeback already completed */
if (ret == 0)
return 1;
+ BUG_ON(ret < 0);
}
if (!uptodate) {
if (ret == 0)
goto error_handled;
}
+ BUG_ON(ret < 0);
}
if (uptodate) {
return bio;
}
-static int submit_one_bio(int rw, struct bio *bio, int mirror_num,
- unsigned long bio_flags)
+static int __must_check submit_one_bio(int rw, struct bio *bio,
+ int mirror_num, unsigned long bio_flags)
{
int ret = 0;
struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
bio_add_page(bio, page, page_size, offset) < page_size) {
ret = submit_one_bio(rw, bio, mirror_num,
prev_bio_flags);
+ BUG_ON(ret < 0);
bio = NULL;
} else {
return 0;
if (bio_ret)
*bio_ret = bio;
- else
+ else {
ret = submit_one_bio(rw, bio, mirror_num, bio_flags);
+ BUG_ON(ret < 0);
+ }
return ret;
}
ret = __extent_read_full_page(tree, page, get_extent, &bio, mirror_num,
&bio_flags);
- if (bio)
+ if (bio) {
ret = submit_one_bio(READ, bio, mirror_num, bio_flags);
+ BUG_ON(ret < 0);
+ }
return ret;
}
static void flush_epd_write_bio(struct extent_page_data *epd)
{
if (epd->bio) {
+ int rw = WRITE;
+ int ret;
+
if (epd->sync_io)
- submit_one_bio(WRITE_SYNC, epd->bio, 0, 0);
- else
- submit_one_bio(WRITE, epd->bio, 0, 0);
+ rw = WRITE_SYNC;
+
+ ret = submit_one_bio(rw, epd->bio, 0, 0);
+ BUG_ON(ret < 0);
epd->bio = NULL;
}
}
page_cache_release(page);
}
BUG_ON(!list_empty(pages));
- if (bio)
- submit_one_bio(READ, bio, 0, bio_flags);
+ if (bio) {
+ int ret = submit_one_bio(READ, bio, 0, bio_flags);
+ BUG_ON(ret < 0);
+ }
return 0;
}
}
}
- if (bio)
- submit_one_bio(READ, bio, mirror_num, bio_flags);
+ if (bio) {
+ err = submit_one_bio(READ, bio, mirror_num, bio_flags);
+ BUG_ON(err < 0);
+ }
if (ret || wait != WAIT_COMPLETE)
return ret;