diff options
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r-- | fs/f2fs/data.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 0ae558723506..2261ccdd0b5f 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -26,40 +26,33 @@ static void f2fs_read_end_io(struct bio *bio, int err) { - const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); - struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; + struct bio_vec *bvec; + int i; - do { + bio_for_each_segment_all(bvec, bio, i) { struct page *page = bvec->bv_page; - if (--bvec >= bio->bi_io_vec) - prefetchw(&bvec->bv_page->flags); - - if (unlikely(!uptodate)) { + if (!err) { + SetPageUptodate(page); + } else { ClearPageUptodate(page); SetPageError(page); - } else { - SetPageUptodate(page); } unlock_page(page); - } while (bvec >= bio->bi_io_vec); - + } bio_put(bio); } static void f2fs_write_end_io(struct bio *bio, int err) { - const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); - struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; - struct f2fs_sb_info *sbi = F2FS_SB(bvec->bv_page->mapping->host->i_sb); + struct f2fs_sb_info *sbi = F2FS_SB(bio->bi_io_vec->bv_page->mapping->host->i_sb); + struct bio_vec *bvec; + int i; - do { + bio_for_each_segment_all(bvec, bio, i) { struct page *page = bvec->bv_page; - if (--bvec >= bio->bi_io_vec) - prefetchw(&bvec->bv_page->flags); - - if (unlikely(!uptodate)) { + if (unlikely(err)) { SetPageError(page); set_bit(AS_EIO, &page->mapping->flags); set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG); @@ -67,7 +60,7 @@ static void f2fs_write_end_io(struct bio *bio, int err) } end_page_writeback(page); dec_page_count(sbi, F2FS_WRITEBACK); - } while (bvec >= bio->bi_io_vec); + } if (bio->bi_private) complete(bio->bi_private); @@ -91,7 +84,7 @@ static struct bio *__bio_alloc(struct f2fs_sb_info *sbi, block_t blk_addr, bio = bio_alloc(GFP_NOIO, npages); bio->bi_bdev = sbi->sb->s_bdev; - bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr); + bio->bi_iter.bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr); bio->bi_end_io = is_read ? f2fs_read_end_io : f2fs_write_end_io; return bio; |