aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-30 14:19:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-30 14:19:05 -0500
commitf568849edac8611d603e00bd6cbbcfea09395ae6 (patch)
treeb9472d640fe5d87426d38c9d81d946cf197ad3fb /fs/f2fs
parentd9894c228b11273e720bb63ba120d1d326fe9d94 (diff)
parent675675ada486dde5bf9aa51665e90706bff11a35 (diff)
Merge branch 'for-3.14/core' of git://git.kernel.dk/linux-block
Pull core block IO changes from Jens Axboe: "The major piece in here is the immutable bio_ve series from Kent, the rest is fairly minor. It was supposed to go in last round, but various issues pushed it to this release instead. The pull request contains: - Various smaller blk-mq fixes from different folks. Nothing major here, just minor fixes and cleanups. - Fix for a memory leak in the error path in the block ioctl code from Christian Engelmayer. - Header export fix from CaiZhiyong. - Finally the immutable biovec changes from Kent Overstreet. This enables some nice future work on making arbitrarily sized bios possible, and splitting more efficient. Related fixes to immutable bio_vecs: - dm-cache immutable fixup from Mike Snitzer. - btrfs immutable fixup from Muthu Kumar. - bio-integrity fix from Nic Bellinger, which is also going to stable" * 'for-3.14/core' of git://git.kernel.dk/linux-block: (44 commits) xtensa: fixup simdisk driver to work with immutable bio_vecs block/blk-mq-cpu.c: use hotcpu_notifier() blk-mq: for_each_* macro correctness block: Fix memory leak in rw_copy_check_uvector() handling bio-integrity: Fix bio_integrity_verify segment start bug block: remove unrelated header files and export symbol blk-mq: uses page->list incorrectly blk-mq: use __smp_call_function_single directly btrfs: fix missing increment of bi_remaining Revert "block: Warn and free bio if bi_end_io is not set" block: Warn and free bio if bi_end_io is not set blk-mq: fix initializing request's start time block: blk-mq: don't export blk_mq_free_queue() block: blk-mq: make blk_sync_queue support mq block: blk-mq: support draining mq queue dm cache: increment bi_remaining when bi_end_io is restored block: fixup for generic bio chaining block: Really silence spurious compiler warnings block: Silence spurious compiler warnings block: Kill bio_pair_split() ...
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/data.c35
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 @@
26 26
27static void f2fs_read_end_io(struct bio *bio, int err) 27static void f2fs_read_end_io(struct bio *bio, int err)
28{ 28{
29 const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); 29 struct bio_vec *bvec;
30 struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; 30 int i;
31 31
32 do { 32 bio_for_each_segment_all(bvec, bio, i) {
33 struct page *page = bvec->bv_page; 33 struct page *page = bvec->bv_page;
34 34
35 if (--bvec >= bio->bi_io_vec) 35 if (!err) {
36 prefetchw(&bvec->bv_page->flags); 36 SetPageUptodate(page);
37 37 } else {
38 if (unlikely(!uptodate)) {
39 ClearPageUptodate(page); 38 ClearPageUptodate(page);
40 SetPageError(page); 39 SetPageError(page);
41 } else {
42 SetPageUptodate(page);
43 } 40 }
44 unlock_page(page); 41 unlock_page(page);
45 } while (bvec >= bio->bi_io_vec); 42 }
46
47 bio_put(bio); 43 bio_put(bio);
48} 44}
49 45
50static void f2fs_write_end_io(struct bio *bio, int err) 46static void f2fs_write_end_io(struct bio *bio, int err)
51{ 47{
52 const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); 48 struct f2fs_sb_info *sbi = F2FS_SB(bio->bi_io_vec->bv_page->mapping->host->i_sb);
53 struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; 49 struct bio_vec *bvec;
54 struct f2fs_sb_info *sbi = F2FS_SB(bvec->bv_page->mapping->host->i_sb); 50 int i;
55 51
56 do { 52 bio_for_each_segment_all(bvec, bio, i) {
57 struct page *page = bvec->bv_page; 53 struct page *page = bvec->bv_page;
58 54
59 if (--bvec >= bio->bi_io_vec) 55 if (unlikely(err)) {
60 prefetchw(&bvec->bv_page->flags);
61
62 if (unlikely(!uptodate)) {
63 SetPageError(page); 56 SetPageError(page);
64 set_bit(AS_EIO, &page->mapping->flags); 57 set_bit(AS_EIO, &page->mapping->flags);
65 set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG); 58 set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG);
@@ -67,7 +60,7 @@ static void f2fs_write_end_io(struct bio *bio, int err)
67 } 60 }
68 end_page_writeback(page); 61 end_page_writeback(page);
69 dec_page_count(sbi, F2FS_WRITEBACK); 62 dec_page_count(sbi, F2FS_WRITEBACK);
70 } while (bvec >= bio->bi_io_vec); 63 }
71 64
72 if (bio->bi_private) 65 if (bio->bi_private)
73 complete(bio->bi_private); 66 complete(bio->bi_private);
@@ -91,7 +84,7 @@ static struct bio *__bio_alloc(struct f2fs_sb_info *sbi, block_t blk_addr,
91 bio = bio_alloc(GFP_NOIO, npages); 84 bio = bio_alloc(GFP_NOIO, npages);
92 85
93 bio->bi_bdev = sbi->sb->s_bdev; 86 bio->bi_bdev = sbi->sb->s_bdev;
94 bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr); 87 bio->bi_iter.bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
95 bio->bi_end_io = is_read ? f2fs_read_end_io : f2fs_write_end_io; 88 bio->bi_end_io = is_read ? f2fs_read_end_io : f2fs_write_end_io;
96 89
97 return bio; 90 return bio;