summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-bufio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm-bufio.c')
-rw-r--r--drivers/md/dm-bufio.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index cd8139593ccd..0902d2fd1743 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -145,8 +145,8 @@ struct dm_buffer {
145 enum data_mode data_mode; 145 enum data_mode data_mode;
146 unsigned char list_mode; /* LIST_* */ 146 unsigned char list_mode; /* LIST_* */
147 unsigned hold_count; 147 unsigned hold_count;
148 int read_error; 148 blk_status_t read_error;
149 int write_error; 149 blk_status_t write_error;
150 unsigned long state; 150 unsigned long state;
151 unsigned long last_accessed; 151 unsigned long last_accessed;
152 struct dm_bufio_client *c; 152 struct dm_bufio_client *c;
@@ -555,7 +555,7 @@ static void dmio_complete(unsigned long error, void *context)
555{ 555{
556 struct dm_buffer *b = context; 556 struct dm_buffer *b = context;
557 557
558 b->bio.bi_error = error ? -EIO : 0; 558 b->bio.bi_status = error ? BLK_STS_IOERR : 0;
559 b->bio.bi_end_io(&b->bio); 559 b->bio.bi_end_io(&b->bio);
560} 560}
561 561
@@ -588,7 +588,7 @@ static void use_dmio(struct dm_buffer *b, int rw, sector_t sector,
588 588
589 r = dm_io(&io_req, 1, &region, NULL); 589 r = dm_io(&io_req, 1, &region, NULL);
590 if (r) { 590 if (r) {
591 b->bio.bi_error = r; 591 b->bio.bi_status = errno_to_blk_status(r);
592 end_io(&b->bio); 592 end_io(&b->bio);
593 } 593 }
594} 594}
@@ -596,7 +596,7 @@ static void use_dmio(struct dm_buffer *b, int rw, sector_t sector,
596static void inline_endio(struct bio *bio) 596static void inline_endio(struct bio *bio)
597{ 597{
598 bio_end_io_t *end_fn = bio->bi_private; 598 bio_end_io_t *end_fn = bio->bi_private;
599 int error = bio->bi_error; 599 blk_status_t status = bio->bi_status;
600 600
601 /* 601 /*
602 * Reset the bio to free any attached resources 602 * Reset the bio to free any attached resources
@@ -604,7 +604,7 @@ static void inline_endio(struct bio *bio)
604 */ 604 */
605 bio_reset(bio); 605 bio_reset(bio);
606 606
607 bio->bi_error = error; 607 bio->bi_status = status;
608 end_fn(bio); 608 end_fn(bio);
609} 609}
610 610
@@ -685,11 +685,12 @@ static void write_endio(struct bio *bio)
685{ 685{
686 struct dm_buffer *b = container_of(bio, struct dm_buffer, bio); 686 struct dm_buffer *b = container_of(bio, struct dm_buffer, bio);
687 687
688 b->write_error = bio->bi_error; 688 b->write_error = bio->bi_status;
689 if (unlikely(bio->bi_error)) { 689 if (unlikely(bio->bi_status)) {
690 struct dm_bufio_client *c = b->c; 690 struct dm_bufio_client *c = b->c;
691 int error = bio->bi_error; 691
692 (void)cmpxchg(&c->async_write_error, 0, error); 692 (void)cmpxchg(&c->async_write_error, 0,
693 blk_status_to_errno(bio->bi_status));
693 } 694 }
694 695
695 BUG_ON(!test_bit(B_WRITING, &b->state)); 696 BUG_ON(!test_bit(B_WRITING, &b->state));
@@ -1063,7 +1064,7 @@ static void read_endio(struct bio *bio)
1063{ 1064{
1064 struct dm_buffer *b = container_of(bio, struct dm_buffer, bio); 1065 struct dm_buffer *b = container_of(bio, struct dm_buffer, bio);
1065 1066
1066 b->read_error = bio->bi_error; 1067 b->read_error = bio->bi_status;
1067 1068
1068 BUG_ON(!test_bit(B_READING, &b->state)); 1069 BUG_ON(!test_bit(B_READING, &b->state));
1069 1070
@@ -1107,7 +1108,7 @@ static void *new_read(struct dm_bufio_client *c, sector_t block,
1107 wait_on_bit_io(&b->state, B_READING, TASK_UNINTERRUPTIBLE); 1108 wait_on_bit_io(&b->state, B_READING, TASK_UNINTERRUPTIBLE);
1108 1109
1109 if (b->read_error) { 1110 if (b->read_error) {
1110 int error = b->read_error; 1111 int error = blk_status_to_errno(b->read_error);
1111 1112
1112 dm_bufio_release(b); 1113 dm_bufio_release(b);
1113 1114
@@ -1257,7 +1258,8 @@ EXPORT_SYMBOL_GPL(dm_bufio_write_dirty_buffers_async);
1257 */ 1258 */
1258int dm_bufio_write_dirty_buffers(struct dm_bufio_client *c) 1259int dm_bufio_write_dirty_buffers(struct dm_bufio_client *c)
1259{ 1260{
1260 int a, f; 1261 blk_status_t a;
1262 int f;
1261 unsigned long buffers_processed = 0; 1263 unsigned long buffers_processed = 0;
1262 struct dm_buffer *b, *tmp; 1264 struct dm_buffer *b, *tmp;
1263 1265