diff options
Diffstat (limited to 'fs/mpage.c')
-rw-r--r-- | fs/mpage.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/mpage.c b/fs/mpage.c index 0face1c4d4c6..4979ffa60aaa 100644 --- a/fs/mpage.c +++ b/fs/mpage.c | |||
@@ -43,16 +43,14 @@ | |||
43 | */ | 43 | */ |
44 | static void mpage_end_io(struct bio *bio, int err) | 44 | static void mpage_end_io(struct bio *bio, int err) |
45 | { | 45 | { |
46 | const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); | 46 | struct bio_vec *bv; |
47 | struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; | 47 | int i; |
48 | 48 | ||
49 | do { | 49 | bio_for_each_segment_all(bv, bio, i) { |
50 | struct page *page = bvec->bv_page; | 50 | struct page *page = bv->bv_page; |
51 | 51 | ||
52 | if (--bvec >= bio->bi_io_vec) | ||
53 | prefetchw(&bvec->bv_page->flags); | ||
54 | if (bio_data_dir(bio) == READ) { | 52 | if (bio_data_dir(bio) == READ) { |
55 | if (uptodate) { | 53 | if (!err) { |
56 | SetPageUptodate(page); | 54 | SetPageUptodate(page); |
57 | } else { | 55 | } else { |
58 | ClearPageUptodate(page); | 56 | ClearPageUptodate(page); |
@@ -60,14 +58,15 @@ static void mpage_end_io(struct bio *bio, int err) | |||
60 | } | 58 | } |
61 | unlock_page(page); | 59 | unlock_page(page); |
62 | } else { /* bio_data_dir(bio) == WRITE */ | 60 | } else { /* bio_data_dir(bio) == WRITE */ |
63 | if (!uptodate) { | 61 | if (err) { |
64 | SetPageError(page); | 62 | SetPageError(page); |
65 | if (page->mapping) | 63 | if (page->mapping) |
66 | set_bit(AS_EIO, &page->mapping->flags); | 64 | set_bit(AS_EIO, &page->mapping->flags); |
67 | } | 65 | } |
68 | end_page_writeback(page); | 66 | end_page_writeback(page); |
69 | } | 67 | } |
70 | } while (bvec >= bio->bi_io_vec); | 68 | } |
69 | |||
71 | bio_put(bio); | 70 | bio_put(bio); |
72 | } | 71 | } |
73 | 72 | ||
@@ -94,7 +93,7 @@ mpage_alloc(struct block_device *bdev, | |||
94 | 93 | ||
95 | if (bio) { | 94 | if (bio) { |
96 | bio->bi_bdev = bdev; | 95 | bio->bi_bdev = bdev; |
97 | bio->bi_sector = first_sector; | 96 | bio->bi_iter.bi_sector = first_sector; |
98 | } | 97 | } |
99 | return bio; | 98 | return bio; |
100 | } | 99 | } |