diff options
-rw-r--r-- | drivers/md/bcache/error.h | 2 | ||||
-rw-r--r-- | drivers/md/bcache/fs-io.c | 6 | ||||
-rw-r--r-- | drivers/md/bcache/io.c | 8 | ||||
-rw-r--r-- | drivers/md/bcache/request.c | 20 |
4 files changed, 21 insertions, 15 deletions
diff --git a/drivers/md/bcache/error.h b/drivers/md/bcache/error.h index 268c550f7f7c..5fb052a70b53 100644 --- a/drivers/md/bcache/error.h +++ b/drivers/md/bcache/error.h @@ -182,7 +182,7 @@ do { \ #define __bcache_io_error(c, fmt, ...) \ printk_ratelimited(KERN_ERR bch_fmt(c, \ - "IO error: " fmt, ##__VA_ARGS__)) + "IO error: " fmt), ##__VA_ARGS__) #define bcache_io_error(c, bio, fmt, ...) \ do { \ diff --git a/drivers/md/bcache/fs-io.c b/drivers/md/bcache/fs-io.c index 22f98df07cb7..ec460634aad1 100644 --- a/drivers/md/bcache/fs-io.c +++ b/drivers/md/bcache/fs-io.c @@ -618,6 +618,7 @@ static void bchfs_read(struct cache_set *c, struct bch_read_bio *rbio, u64 inode struct bkey_s_c k; struct bio_vec *bv; unsigned i; + int ret; bch_increment_clock(c, bio_sectors(bio), READ); @@ -698,8 +699,9 @@ static void bchfs_read(struct cache_set *c, struct bch_read_bio *rbio, u64 inode * If we get here, it better have been because there was an error * reading a btree node */ - BUG_ON(!bch_btree_iter_unlock(&iter)); - bcache_io_error(c, bio, "btree IO error"); + ret = bch_btree_iter_unlock(&iter); + BUG_ON(!ret); + bcache_io_error(c, bio, "btree IO error %i", ret); bio_endio(bio); } diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c index f373d95744da..c2829114f4f2 100644 --- a/drivers/md/bcache/io.c +++ b/drivers/md/bcache/io.c @@ -262,7 +262,7 @@ static void bch_write_index(struct closure *cl) op->written += sectors_start - keylist_sectors(keys); if (ret) { - __bcache_io_error(op->c, "btree IO error"); + __bcache_io_error(op->c, "btree IO error %i", ret); op->error = ret; } } @@ -1234,6 +1234,7 @@ static void bch_read_iter(struct cache_set *c, struct bch_read_bio *rbio, struct bio *bio = &rbio->bio; struct btree_iter iter; struct bkey_s_c k; + int ret; for_each_btree_key_with_holes(&iter, c, BTREE_ID_EXTENTS, POS(inode, bvec_iter.bi_sector), k) { @@ -1293,8 +1294,9 @@ static void bch_read_iter(struct cache_set *c, struct bch_read_bio *rbio, * If we get here, it better have been because there was an error * reading a btree node */ - BUG_ON(!bch_btree_iter_unlock(&iter)); - bcache_io_error(c, bio, "btree IO error"); + ret = bch_btree_iter_unlock(&iter); + BUG_ON(!ret); + bcache_io_error(c, bio, "btree IO error %i", ret); bio_endio(bio); } diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index a2006bfa9f0c..71883352abd8 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -460,14 +460,16 @@ nopromote: static void cached_dev_read(struct cached_dev *dc, struct search *s) { + struct cache_set *c = s->iop.c; struct closure *cl = &s->cl; struct bio *bio = &s->rbio.bio; struct btree_iter iter; struct bkey_s_c k; + int ret; - bch_increment_clock(s->iop.c, bio_sectors(bio), READ); + bch_increment_clock(c, bio_sectors(bio), READ); - for_each_btree_key_with_holes(&iter, s->iop.c, BTREE_ID_EXTENTS, + for_each_btree_key_with_holes(&iter, c, BTREE_ID_EXTENTS, POS(s->inode, bio->bi_iter.bi_sector), k) { BKEY_PADDED(k) tmp; struct extent_pick_ptr pick; @@ -478,10 +480,9 @@ retry: bch_btree_iter_unlock(&iter); k = bkey_i_to_s_c(&tmp.k); - bch_extent_pick_ptr(s->iop.c, k, &pick); + bch_extent_pick_ptr(c, k, &pick); if (IS_ERR(pick.ca)) { - bcache_io_error(s->iop.c, bio, - "no device to read from"); + bcache_io_error(c, bio, "no device to read from"); goto out; } @@ -493,12 +494,12 @@ retry: if (pick.ca) { PTR_BUCKET(pick.ca, &pick.ptr)->read_prio = - s->iop.c->prio_clock[READ].hand; + c->prio_clock[READ].hand; if (!bkey_extent_is_cached(k.k)) s->read_dirty_data = true; - bch_read_extent(s->iop.c, &s->rbio, k, &pick, + bch_read_extent(c, &s->rbio, k, &pick, BCH_READ_FORCE_BOUNCE| BCH_READ_RETRY_IF_STALE| (!s->bypass ? BCH_READ_PROMOTE : 0)| @@ -524,8 +525,9 @@ retry: * If we get here, it better have been because there was an error * reading a btree node */ - BUG_ON(!bch_btree_iter_unlock(&iter)); - bcache_io_error(s->iop.c, bio, "btree IO error"); + ret = bch_btree_iter_unlock(&iter); + BUG_ON(!ret); + bcache_io_error(c, bio, "btree IO error %i", ret); out: continue_at(cl, cached_dev_read_done_bh, NULL); } |