aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/data.c13
-rw-r--r--fs/f2fs/segment.c12
2 files changed, 10 insertions, 15 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index aa3438c571fa..a4949096cf4c 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -351,23 +351,20 @@ repeat:
351 351
352static void read_end_io(struct bio *bio, int err) 352static void read_end_io(struct bio *bio, int err)
353{ 353{
354 const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); 354 struct bio_vec *bvec;
355 struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; 355 int i;
356 356
357 do { 357 bio_for_each_segment_all(bvec, bio, i) {
358 struct page *page = bvec->bv_page; 358 struct page *page = bvec->bv_page;
359 359
360 if (--bvec >= bio->bi_io_vec) 360 if (!err) {
361 prefetchw(&bvec->bv_page->flags);
362
363 if (uptodate) {
364 SetPageUptodate(page); 361 SetPageUptodate(page);
365 } else { 362 } else {
366 ClearPageUptodate(page); 363 ClearPageUptodate(page);
367 SetPageError(page); 364 SetPageError(page);
368 } 365 }
369 unlock_page(page); 366 unlock_page(page);
370 } while (bvec >= bio->bi_io_vec); 367 }
371 bio_put(bio); 368 bio_put(bio);
372} 369}
373 370
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index fa284d397199..a90c6bc0d129 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -575,16 +575,14 @@ static const struct segment_allocation default_salloc_ops = {
575 575
576static void f2fs_end_io_write(struct bio *bio, int err) 576static void f2fs_end_io_write(struct bio *bio, int err)
577{ 577{
578 const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
579 struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
580 struct bio_private *p = bio->bi_private; 578 struct bio_private *p = bio->bi_private;
579 struct bio_vec *bvec;
580 int i;
581 581
582 do { 582 bio_for_each_segment_all(bvec, bio, i) {
583 struct page *page = bvec->bv_page; 583 struct page *page = bvec->bv_page;
584 584
585 if (--bvec >= bio->bi_io_vec) 585 if (err) {
586 prefetchw(&bvec->bv_page->flags);
587 if (!uptodate) {
588 SetPageError(page); 586 SetPageError(page);
589 if (page->mapping) 587 if (page->mapping)
590 set_bit(AS_EIO, &page->mapping->flags); 588 set_bit(AS_EIO, &page->mapping->flags);
@@ -593,7 +591,7 @@ static void f2fs_end_io_write(struct bio *bio, int err)
593 } 591 }
594 end_page_writeback(page); 592 end_page_writeback(page);
595 dec_page_count(p->sbi, F2FS_WRITEBACK); 593 dec_page_count(p->sbi, F2FS_WRITEBACK);
596 } while (bvec >= bio->bi_io_vec); 594 }
597 595
598 if (p->is_sync) 596 if (p->is_sync)
599 complete(p->wait); 597 complete(p->wait);