提交 4f2ac93c 编写于 作者: K Kent Overstreet

block: Remove bi_idx references

For immutable bvecs, all bi_idx usage needs to be audited - so here
we're removing all the unnecessary uses.

Most of these are places where it was being initialized on a bio that
was just allocated, a few others are conversions to standard macros.
Signed-off-by: NKent Overstreet <koverstreet@google.com>
CC: Jens Axboe <axboe@kernel.dk>
上级 5b83636a
...@@ -927,7 +927,7 @@ bufinit(struct buf *buf, struct request *rq, struct bio *bio) ...@@ -927,7 +927,7 @@ bufinit(struct buf *buf, struct request *rq, struct bio *bio)
buf->resid = bio->bi_size; buf->resid = bio->bi_size;
buf->sector = bio->bi_sector; buf->sector = bio->bi_sector;
bio_pageinc(bio); bio_pageinc(bio);
buf->bv = bv = &bio->bi_io_vec[bio->bi_idx]; buf->bv = bio_iovec(bio);
buf->bv_resid = bv->bv_len; buf->bv_resid = bv->bv_len;
WARN_ON(buf->bv_resid == 0); WARN_ON(buf->bv_resid == 0);
} }
......
...@@ -3777,7 +3777,6 @@ static int __floppy_read_block_0(struct block_device *bdev) ...@@ -3777,7 +3777,6 @@ static int __floppy_read_block_0(struct block_device *bdev)
bio_vec.bv_len = size; bio_vec.bv_len = size;
bio_vec.bv_offset = 0; bio_vec.bv_offset = 0;
bio.bi_vcnt = 1; bio.bi_vcnt = 1;
bio.bi_idx = 0;
bio.bi_size = size; bio.bi_size = size;
bio.bi_bdev = bdev; bio.bi_bdev = bdev;
bio.bi_sector = 0; bio.bi_sector = 0;
......
...@@ -490,7 +490,7 @@ static int verity_map(struct dm_target *ti, struct bio *bio) ...@@ -490,7 +490,7 @@ static int verity_map(struct dm_target *ti, struct bio *bio)
bio->bi_end_io = verity_end_io; bio->bi_end_io = verity_end_io;
bio->bi_private = io; bio->bi_private = io;
io->io_vec_size = bio->bi_vcnt - bio->bi_idx; io->io_vec_size = bio_segments(bio);
if (io->io_vec_size < DM_VERITY_IO_VEC_INLINE) if (io->io_vec_size < DM_VERITY_IO_VEC_INLINE)
io->io_vec = io->io_vec_inline; io->io_vec = io->io_vec_inline;
else else
......
...@@ -4386,7 +4386,6 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, ...@@ -4386,7 +4386,6 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr,
read_bio->bi_flags &= ~(BIO_POOL_MASK - 1); read_bio->bi_flags &= ~(BIO_POOL_MASK - 1);
read_bio->bi_flags |= 1 << BIO_UPTODATE; read_bio->bi_flags |= 1 << BIO_UPTODATE;
read_bio->bi_vcnt = 0; read_bio->bi_vcnt = 0;
read_bio->bi_idx = 0;
read_bio->bi_size = 0; read_bio->bi_size = 0;
r10_bio->master_bio = read_bio; r10_bio->master_bio = read_bio;
r10_bio->read_slot = r10_bio->devs[r10_bio->read_slot].devnum; r10_bio->read_slot = r10_bio->devs[r10_bio->read_slot].devnum;
......
...@@ -2979,7 +2979,6 @@ int submit_bh(int rw, struct buffer_head * bh) ...@@ -2979,7 +2979,6 @@ int submit_bh(int rw, struct buffer_head * bh)
bio->bi_io_vec[0].bv_offset = bh_offset(bh); bio->bi_io_vec[0].bv_offset = bh_offset(bh);
bio->bi_vcnt = 1; bio->bi_vcnt = 1;
bio->bi_idx = 0;
bio->bi_size = bh->b_size; bio->bi_size = bh->b_size;
bio->bi_end_io = end_bio_bh_io_sync; bio->bi_end_io = end_bio_bh_io_sync;
......
...@@ -2004,7 +2004,6 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp) ...@@ -2004,7 +2004,6 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp)
bio->bi_io_vec[0].bv_offset = bp->l_offset; bio->bi_io_vec[0].bv_offset = bp->l_offset;
bio->bi_vcnt = 1; bio->bi_vcnt = 1;
bio->bi_idx = 0;
bio->bi_size = LOGPSIZE; bio->bi_size = LOGPSIZE;
bio->bi_end_io = lbmIODone; bio->bi_end_io = lbmIODone;
...@@ -2145,7 +2144,6 @@ static void lbmStartIO(struct lbuf * bp) ...@@ -2145,7 +2144,6 @@ static void lbmStartIO(struct lbuf * bp)
bio->bi_io_vec[0].bv_offset = bp->l_offset; bio->bi_io_vec[0].bv_offset = bp->l_offset;
bio->bi_vcnt = 1; bio->bi_vcnt = 1;
bio->bi_idx = 0;
bio->bi_size = LOGPSIZE; bio->bi_size = LOGPSIZE;
bio->bi_end_io = lbmIODone; bio->bi_end_io = lbmIODone;
......
...@@ -32,7 +32,6 @@ static int sync_request(struct page *page, struct block_device *bdev, int rw) ...@@ -32,7 +32,6 @@ static int sync_request(struct page *page, struct block_device *bdev, int rw)
bio_vec.bv_len = PAGE_SIZE; bio_vec.bv_len = PAGE_SIZE;
bio_vec.bv_offset = 0; bio_vec.bv_offset = 0;
bio.bi_vcnt = 1; bio.bi_vcnt = 1;
bio.bi_idx = 0;
bio.bi_size = PAGE_SIZE; bio.bi_size = PAGE_SIZE;
bio.bi_bdev = bdev; bio.bi_bdev = bdev;
bio.bi_sector = page->index * (PAGE_SIZE >> 9); bio.bi_sector = page->index * (PAGE_SIZE >> 9);
...@@ -108,7 +107,6 @@ static int __bdev_writeseg(struct super_block *sb, u64 ofs, pgoff_t index, ...@@ -108,7 +107,6 @@ static int __bdev_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
if (i >= max_pages) { if (i >= max_pages) {
/* Block layer cannot split bios :( */ /* Block layer cannot split bios :( */
bio->bi_vcnt = i; bio->bi_vcnt = i;
bio->bi_idx = 0;
bio->bi_size = i * PAGE_SIZE; bio->bi_size = i * PAGE_SIZE;
bio->bi_bdev = super->s_bdev; bio->bi_bdev = super->s_bdev;
bio->bi_sector = ofs >> 9; bio->bi_sector = ofs >> 9;
...@@ -136,7 +134,6 @@ static int __bdev_writeseg(struct super_block *sb, u64 ofs, pgoff_t index, ...@@ -136,7 +134,6 @@ static int __bdev_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
unlock_page(page); unlock_page(page);
} }
bio->bi_vcnt = nr_pages; bio->bi_vcnt = nr_pages;
bio->bi_idx = 0;
bio->bi_size = nr_pages * PAGE_SIZE; bio->bi_size = nr_pages * PAGE_SIZE;
bio->bi_bdev = super->s_bdev; bio->bi_bdev = super->s_bdev;
bio->bi_sector = ofs >> 9; bio->bi_sector = ofs >> 9;
...@@ -202,7 +199,6 @@ static int do_erase(struct super_block *sb, u64 ofs, pgoff_t index, ...@@ -202,7 +199,6 @@ static int do_erase(struct super_block *sb, u64 ofs, pgoff_t index,
if (i >= max_pages) { if (i >= max_pages) {
/* Block layer cannot split bios :( */ /* Block layer cannot split bios :( */
bio->bi_vcnt = i; bio->bi_vcnt = i;
bio->bi_idx = 0;
bio->bi_size = i * PAGE_SIZE; bio->bi_size = i * PAGE_SIZE;
bio->bi_bdev = super->s_bdev; bio->bi_bdev = super->s_bdev;
bio->bi_sector = ofs >> 9; bio->bi_sector = ofs >> 9;
...@@ -224,7 +220,6 @@ static int do_erase(struct super_block *sb, u64 ofs, pgoff_t index, ...@@ -224,7 +220,6 @@ static int do_erase(struct super_block *sb, u64 ofs, pgoff_t index,
bio->bi_io_vec[i].bv_offset = 0; bio->bi_io_vec[i].bv_offset = 0;
} }
bio->bi_vcnt = nr_pages; bio->bi_vcnt = nr_pages;
bio->bi_idx = 0;
bio->bi_size = nr_pages * PAGE_SIZE; bio->bi_size = nr_pages * PAGE_SIZE;
bio->bi_bdev = super->s_bdev; bio->bi_bdev = super->s_bdev;
bio->bi_sector = ofs >> 9; bio->bi_sector = ofs >> 9;
......
...@@ -35,7 +35,6 @@ static struct bio *get_swap_bio(gfp_t gfp_flags, ...@@ -35,7 +35,6 @@ static struct bio *get_swap_bio(gfp_t gfp_flags,
bio->bi_io_vec[0].bv_len = PAGE_SIZE; bio->bi_io_vec[0].bv_len = PAGE_SIZE;
bio->bi_io_vec[0].bv_offset = 0; bio->bi_io_vec[0].bv_offset = 0;
bio->bi_vcnt = 1; bio->bi_vcnt = 1;
bio->bi_idx = 0;
bio->bi_size = PAGE_SIZE; bio->bi_size = PAGE_SIZE;
bio->bi_end_io = end_io; bio->bi_end_io = end_io;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册