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/btrfs/disk-io.c | |
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/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8072cfa8a3b1..5a10c61adafc 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -842,20 +842,17 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode, | |||
842 | 842 | ||
843 | static int btree_csum_one_bio(struct bio *bio) | 843 | static int btree_csum_one_bio(struct bio *bio) |
844 | { | 844 | { |
845 | struct bio_vec *bvec = bio->bi_io_vec; | 845 | struct bio_vec *bvec; |
846 | int bio_index = 0; | ||
847 | struct btrfs_root *root; | 846 | struct btrfs_root *root; |
848 | int ret = 0; | 847 | int i, ret = 0; |
849 | 848 | ||
850 | WARN_ON(bio->bi_vcnt <= 0); | 849 | bio_for_each_segment_all(bvec, bio, i) { |
851 | while (bio_index < bio->bi_vcnt) { | ||
852 | root = BTRFS_I(bvec->bv_page->mapping->host)->root; | 850 | root = BTRFS_I(bvec->bv_page->mapping->host)->root; |
853 | ret = csum_dirty_buffer(root, bvec->bv_page); | 851 | ret = csum_dirty_buffer(root, bvec->bv_page); |
854 | if (ret) | 852 | if (ret) |
855 | break; | 853 | break; |
856 | bio_index++; | ||
857 | bvec++; | ||
858 | } | 854 | } |
855 | |||
859 | return ret; | 856 | return ret; |
860 | } | 857 | } |
861 | 858 | ||