aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/aoe/aoecmd.c2
-rw-r--r--drivers/md/bcache/io.c13
-rw-r--r--drivers/md/dm-verity.c2
-rw-r--r--drivers/scsi/sd.c2
-rw-r--r--fs/bio.c20
-rw-r--r--include/linux/bio.h10
6 files changed, 26 insertions, 23 deletions
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 877ba119b3f8..77c24ab1898a 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -932,7 +932,7 @@ bufinit(struct buf *buf, struct request *rq, struct bio *bio)
932 buf->resid = bio->bi_iter.bi_size; 932 buf->resid = bio->bi_iter.bi_size;
933 buf->sector = bio->bi_iter.bi_sector; 933 buf->sector = bio->bi_iter.bi_sector;
934 bio_pageinc(bio); 934 bio_pageinc(bio);
935 buf->bv = bio_iovec(bio); 935 buf->bv = __bio_iovec(bio);
936 buf->bv_resid = buf->bv->bv_len; 936 buf->bv_resid = buf->bv->bv_len;
937 WARN_ON(buf->bv_resid == 0); 937 WARN_ON(buf->bv_resid == 0);
938} 938}
diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c
index cc4ba2da5fb6..dc44f0689eb7 100644
--- a/drivers/md/bcache/io.c
+++ b/drivers/md/bcache/io.c
@@ -22,11 +22,12 @@ static void bch_bi_idx_hack_endio(struct bio *bio, int error)
22static void bch_generic_make_request_hack(struct bio *bio) 22static void bch_generic_make_request_hack(struct bio *bio)
23{ 23{
24 if (bio->bi_iter.bi_idx) { 24 if (bio->bi_iter.bi_idx) {
25 int i;
26 struct bio_vec *bv;
25 struct bio *clone = bio_alloc(GFP_NOIO, bio_segments(bio)); 27 struct bio *clone = bio_alloc(GFP_NOIO, bio_segments(bio));
26 28
27 memcpy(clone->bi_io_vec, 29 bio_for_each_segment(bv, bio, i)
28 bio_iovec(bio), 30 clone->bi_io_vec[clone->bi_vcnt++] = *bv;
29 bio_segments(bio) * sizeof(struct bio_vec));
30 31
31 clone->bi_iter.bi_sector = bio->bi_iter.bi_sector; 32 clone->bi_iter.bi_sector = bio->bi_iter.bi_sector;
32 clone->bi_bdev = bio->bi_bdev; 33 clone->bi_bdev = bio->bi_bdev;
@@ -97,7 +98,7 @@ struct bio *bch_bio_split(struct bio *bio, int sectors,
97 if (!ret) 98 if (!ret)
98 return NULL; 99 return NULL;
99 100
100 memcpy(ret->bi_io_vec, bio_iovec(bio), 101 memcpy(ret->bi_io_vec, __bio_iovec(bio),
101 sizeof(struct bio_vec) * vcnt); 102 sizeof(struct bio_vec) * vcnt);
102 103
103 break; 104 break;
@@ -106,7 +107,7 @@ struct bio *bch_bio_split(struct bio *bio, int sectors,
106 if (!ret) 107 if (!ret)
107 return NULL; 108 return NULL;
108 109
109 memcpy(ret->bi_io_vec, bio_iovec(bio), 110 memcpy(ret->bi_io_vec, __bio_iovec(bio),
110 sizeof(struct bio_vec) * vcnt); 111 sizeof(struct bio_vec) * vcnt);
111 112
112 ret->bi_io_vec[vcnt - 1].bv_len = nbytes; 113 ret->bi_io_vec[vcnt - 1].bv_len = nbytes;
@@ -182,7 +183,7 @@ static unsigned bch_bio_max_sectors(struct bio *bio)
182 ret = min(ret, queue_max_sectors(q)); 183 ret = min(ret, queue_max_sectors(q));
183 184
184 WARN_ON(!ret); 185 WARN_ON(!ret);
185 ret = max_t(int, ret, bio_iovec(bio)->bv_len >> 9); 186 ret = max_t(int, ret, bio_iovec(bio).bv_len >> 9);
186 187
187 return ret; 188 return ret;
188} 189}
diff --git a/drivers/md/dm-verity.c b/drivers/md/dm-verity.c
index 132b3154d466..5392135924ca 100644
--- a/drivers/md/dm-verity.c
+++ b/drivers/md/dm-verity.c
@@ -524,7 +524,7 @@ static int verity_map(struct dm_target *ti, struct bio *bio)
524 io->io_vec = io->io_vec_inline; 524 io->io_vec = io->io_vec_inline;
525 else 525 else
526 io->io_vec = mempool_alloc(v->vec_mempool, GFP_NOIO); 526 io->io_vec = mempool_alloc(v->vec_mempool, GFP_NOIO);
527 memcpy(io->io_vec, bio_iovec(bio), 527 memcpy(io->io_vec, __bio_iovec(bio),
528 io->io_vec_size * sizeof(struct bio_vec)); 528 io->io_vec_size * sizeof(struct bio_vec));
529 529
530 verity_submit_prefetch(v, io); 530 verity_submit_prefetch(v, io);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index e6c4bff04339..200d6bc81240 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -801,7 +801,7 @@ static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq)
801 if (sdkp->device->no_write_same) 801 if (sdkp->device->no_write_same)
802 return BLKPREP_KILL; 802 return BLKPREP_KILL;
803 803
804 BUG_ON(bio_offset(bio) || bio_iovec(bio)->bv_len != sdp->sector_size); 804 BUG_ON(bio_offset(bio) || bio_iovec(bio).bv_len != sdp->sector_size);
805 805
806 sector >>= ilog2(sdp->sector_size) - 9; 806 sector >>= ilog2(sdp->sector_size) - 9;
807 nr_sectors >>= ilog2(sdp->sector_size) - 9; 807 nr_sectors >>= ilog2(sdp->sector_size) - 9;
diff --git a/fs/bio.c b/fs/bio.c
index a402ad6e753f..7bb281fc3d5c 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -821,12 +821,12 @@ void bio_advance(struct bio *bio, unsigned bytes)
821 break; 821 break;
822 } 822 }
823 823
824 if (bytes >= bio_iovec(bio)->bv_len) { 824 if (bytes >= bio_iovec(bio).bv_len) {
825 bytes -= bio_iovec(bio)->bv_len; 825 bytes -= bio_iovec(bio).bv_len;
826 bio->bi_iter.bi_idx++; 826 bio->bi_iter.bi_idx++;
827 } else { 827 } else {
828 bio_iovec(bio)->bv_len -= bytes; 828 bio_iovec(bio).bv_len -= bytes;
829 bio_iovec(bio)->bv_offset += bytes; 829 bio_iovec(bio).bv_offset += bytes;
830 bytes = 0; 830 bytes = 0;
831 } 831 }
832 } 832 }
@@ -879,8 +879,8 @@ void bio_copy_data(struct bio *dst, struct bio *src)
879 unsigned src_offset, dst_offset, bytes; 879 unsigned src_offset, dst_offset, bytes;
880 void *src_p, *dst_p; 880 void *src_p, *dst_p;
881 881
882 src_bv = bio_iovec(src); 882 src_bv = __bio_iovec(src);
883 dst_bv = bio_iovec(dst); 883 dst_bv = __bio_iovec(dst);
884 884
885 src_offset = src_bv->bv_offset; 885 src_offset = src_bv->bv_offset;
886 dst_offset = dst_bv->bv_offset; 886 dst_offset = dst_bv->bv_offset;
@@ -893,7 +893,7 @@ void bio_copy_data(struct bio *dst, struct bio *src)
893 if (!src) 893 if (!src)
894 break; 894 break;
895 895
896 src_bv = bio_iovec(src); 896 src_bv = __bio_iovec(src);
897 } 897 }
898 898
899 src_offset = src_bv->bv_offset; 899 src_offset = src_bv->bv_offset;
@@ -906,7 +906,7 @@ void bio_copy_data(struct bio *dst, struct bio *src)
906 if (!dst) 906 if (!dst)
907 break; 907 break;
908 908
909 dst_bv = bio_iovec(dst); 909 dst_bv = __bio_iovec(dst);
910 } 910 }
911 911
912 dst_offset = dst_bv->bv_offset; 912 dst_offset = dst_bv->bv_offset;
@@ -1776,8 +1776,8 @@ struct bio_pair *bio_split(struct bio *bi, int first_sectors)
1776 bp->bio1.bi_iter.bi_size = first_sectors << 9; 1776 bp->bio1.bi_iter.bi_size = first_sectors << 9;
1777 1777
1778 if (bi->bi_vcnt != 0) { 1778 if (bi->bi_vcnt != 0) {
1779 bp->bv1 = *bio_iovec(bi); 1779 bp->bv1 = bio_iovec(bi);
1780 bp->bv2 = *bio_iovec(bi); 1780 bp->bv2 = bio_iovec(bi);
1781 1781
1782 if (bio_is_rw(bi)) { 1782 if (bio_is_rw(bi)) {
1783 bp->bv2.bv_offset += first_sectors << 9; 1783 bp->bv2.bv_offset += first_sectors << 9;
diff --git a/include/linux/bio.h b/include/linux/bio.h
index e2e0bc642ed1..9f182fcbe714 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -62,9 +62,11 @@
62 * on highmem page vectors 62 * on highmem page vectors
63 */ 63 */
64#define bio_iovec_idx(bio, idx) (&((bio)->bi_io_vec[(idx)])) 64#define bio_iovec_idx(bio, idx) (&((bio)->bi_io_vec[(idx)]))
65#define bio_iovec(bio) bio_iovec_idx((bio), (bio)->bi_iter.bi_idx) 65#define __bio_iovec(bio) bio_iovec_idx((bio), (bio)->bi_iter.bi_idx)
66#define bio_page(bio) bio_iovec((bio))->bv_page 66#define bio_iovec(bio) (*__bio_iovec(bio))
67#define bio_offset(bio) bio_iovec((bio))->bv_offset 67
68#define bio_page(bio) (bio_iovec((bio)).bv_page)
69#define bio_offset(bio) (bio_iovec((bio)).bv_offset)
68#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_iter.bi_idx) 70#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_iter.bi_idx)
69#define bio_sectors(bio) ((bio)->bi_iter.bi_size >> 9) 71#define bio_sectors(bio) ((bio)->bi_iter.bi_size >> 9)
70#define bio_end_sector(bio) ((bio)->bi_iter.bi_sector + bio_sectors((bio))) 72#define bio_end_sector(bio) ((bio)->bi_iter.bi_sector + bio_sectors((bio)))
@@ -72,7 +74,7 @@
72static inline unsigned int bio_cur_bytes(struct bio *bio) 74static inline unsigned int bio_cur_bytes(struct bio *bio)
73{ 75{
74 if (bio->bi_vcnt) 76 if (bio->bi_vcnt)
75 return bio_iovec(bio)->bv_len; 77 return bio_iovec(bio).bv_len;
76 else /* dataless requests such as discard */ 78 else /* dataless requests such as discard */
77 return bio->bi_iter.bi_size; 79 return bio->bi_iter.bi_size;
78} 80}