diff options
author | Kent Overstreet <kmo@daterainc.com> | 2013-11-07 15:20:26 -0500 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2013-11-24 01:33:46 -0500 |
commit | 2c30c71bd653afcbed7f6754e8fe3d16e0e708a1 (patch) | |
tree | a6b1147e4302b7216600c397cb47ca7f7f375a43 /fs/f2fs | |
parent | 33879d4512c021ae65be9706608dacb36b4687b1 (diff) |
block: Convert various code to bio_for_each_segment()
With immutable biovecs we don't want code accessing bi_io_vec directly -
the uses this patch changes weren't incorrect since they all own the
bio, but it makes the code harder to audit for no good reason - also,
this will help with multipage bvecs later.
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Chris Mason <chris.mason@fusionio.com>
Cc: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Cc: Joern Engel <joern@logfs.org>
Cc: Prasad Joshi <prasadjoshi.linux@gmail.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/data.c | 13 | ||||
-rw-r--r-- | fs/f2fs/segment.c | 12 |
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 | ||
352 | static void read_end_io(struct bio *bio, int err) | 352 | static 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 | ||
576 | static void f2fs_end_io_write(struct bio *bio, int err) | 576 | static 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); |