diff options
Diffstat (limited to 'fs/mpage.c')
-rw-r--r-- | fs/mpage.c | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/fs/mpage.c b/fs/mpage.c index fd56ca2ea556..d78455a81ec9 100644 --- a/fs/mpage.c +++ b/fs/mpage.c | |||
@@ -40,7 +40,7 @@ | |||
40 | * status of that page is hard. See end_buffer_async_read() for the details. | 40 | * status of that page is hard. See end_buffer_async_read() for the details. |
41 | * There is no point in duplicating all that complexity. | 41 | * There is no point in duplicating all that complexity. |
42 | */ | 42 | */ |
43 | static void mpage_end_io_read(struct bio *bio, int err) | 43 | static void mpage_end_io(struct bio *bio, int err) |
44 | { | 44 | { |
45 | const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); | 45 | const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); |
46 | struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; | 46 | struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; |
@@ -50,44 +50,29 @@ static void mpage_end_io_read(struct bio *bio, int err) | |||
50 | 50 | ||
51 | if (--bvec >= bio->bi_io_vec) | 51 | if (--bvec >= bio->bi_io_vec) |
52 | prefetchw(&bvec->bv_page->flags); | 52 | prefetchw(&bvec->bv_page->flags); |
53 | 53 | if (bio_data_dir(bio) == READ) { | |
54 | if (uptodate) { | 54 | if (uptodate) { |
55 | SetPageUptodate(page); | 55 | SetPageUptodate(page); |
56 | } else { | 56 | } else { |
57 | ClearPageUptodate(page); | 57 | ClearPageUptodate(page); |
58 | SetPageError(page); | 58 | SetPageError(page); |
59 | } | 59 | } |
60 | unlock_page(page); | 60 | unlock_page(page); |
61 | } while (bvec >= bio->bi_io_vec); | 61 | } else { /* bio_data_dir(bio) == WRITE */ |
62 | bio_put(bio); | 62 | if (!uptodate) { |
63 | } | 63 | SetPageError(page); |
64 | 64 | if (page->mapping) | |
65 | static void mpage_end_io_write(struct bio *bio, int err) | 65 | set_bit(AS_EIO, &page->mapping->flags); |
66 | { | 66 | } |
67 | const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); | 67 | end_page_writeback(page); |
68 | struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; | ||
69 | |||
70 | do { | ||
71 | struct page *page = bvec->bv_page; | ||
72 | |||
73 | if (--bvec >= bio->bi_io_vec) | ||
74 | prefetchw(&bvec->bv_page->flags); | ||
75 | |||
76 | if (!uptodate){ | ||
77 | SetPageError(page); | ||
78 | if (page->mapping) | ||
79 | set_bit(AS_EIO, &page->mapping->flags); | ||
80 | } | 68 | } |
81 | end_page_writeback(page); | ||
82 | } while (bvec >= bio->bi_io_vec); | 69 | } while (bvec >= bio->bi_io_vec); |
83 | bio_put(bio); | 70 | bio_put(bio); |
84 | } | 71 | } |
85 | 72 | ||
86 | static struct bio *mpage_bio_submit(int rw, struct bio *bio) | 73 | static struct bio *mpage_bio_submit(int rw, struct bio *bio) |
87 | { | 74 | { |
88 | bio->bi_end_io = mpage_end_io_read; | 75 | bio->bi_end_io = mpage_end_io; |
89 | if (rw == WRITE) | ||
90 | bio->bi_end_io = mpage_end_io_write; | ||
91 | submit_bio(rw, bio); | 76 | submit_bio(rw, bio); |
92 | return NULL; | 77 | return NULL; |
93 | } | 78 | } |