Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1547670

[PATCH v1 34/54] block: convert to singe/multi page version of bio_for_each_segment_all()

From Ming Lei <tom.leiming@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v1 34/54] block: convert to singe/multi page version of bio_for_each_segment_all()
Date 2016-12-27 17:20 +0100
Message-ID <sT2DM-4jR-27@gated-at.bofh.it> (permalink)
References <sT2u6-4eA-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 block/bio.c       | 17 +++++++++++------
 block/blk-zoned.c |  5 +++--
 block/bounce.c    |  6 ++++--
 3 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/block/bio.c b/block/bio.c
index e65de53acb9f..9acc3db0f2df 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -992,7 +992,7 @@ int bio_alloc_pages(struct bio *bio, gfp_t gfp_mask)
 	int i;
 	struct bio_vec *bv;
 
-	bio_for_each_segment_all(bv, bio, i) {
+	bio_for_each_segment_all_mp(bv, bio, i) {
 		bv->bv_page = alloc_page(gfp_mask);
 		if (!bv->bv_page) {
 			while (--bv >= bio->bi_io_vec)
@@ -1093,8 +1093,9 @@ static int bio_copy_from_iter(struct bio *bio, struct iov_iter iter)
 {
 	int i;
 	struct bio_vec *bvec;
+	struct bvec_iter_all bia;
 
-	bio_for_each_segment_all(bvec, bio, i) {
+	bio_for_each_segment_all_sp(bvec, bio, i, bia) {
 		ssize_t ret;
 
 		ret = copy_page_from_iter(bvec->bv_page,
@@ -1124,8 +1125,9 @@ static int bio_copy_to_iter(struct bio *bio, struct iov_iter iter)
 {
 	int i;
 	struct bio_vec *bvec;
+	struct bvec_iter_all bia;
 
-	bio_for_each_segment_all(bvec, bio, i) {
+	bio_for_each_segment_all_sp(bvec, bio, i, bia) {
 		ssize_t ret;
 
 		ret = copy_page_to_iter(bvec->bv_page,
@@ -1147,8 +1149,9 @@ void bio_free_pages(struct bio *bio)
 {
 	struct bio_vec *bvec;
 	int i;
+	struct bvec_iter_all bia;
 
-	bio_for_each_segment_all(bvec, bio, i)
+	bio_for_each_segment_all_sp(bvec, bio, i, bia)
 		__free_page(bvec->bv_page);
 }
 EXPORT_SYMBOL(bio_free_pages);
@@ -1448,11 +1451,12 @@ static void __bio_unmap_user(struct bio *bio)
 {
 	struct bio_vec *bvec;
 	int i;
+	struct bvec_iter_all bia;
 
 	/*
 	 * make sure we dirty pages we wrote to
 	 */
-	bio_for_each_segment_all(bvec, bio, i) {
+	bio_for_each_segment_all_sp(bvec, bio, i, bia) {
 		if (bio_data_dir(bio) == READ)
 			set_page_dirty_lock(bvec->bv_page);
 
@@ -1544,8 +1548,9 @@ static void bio_copy_kern_endio_read(struct bio *bio)
 	char *p = bio->bi_private;
 	struct bio_vec *bvec;
 	int i;
+	struct bvec_iter_all bia;
 
-	bio_for_each_segment_all(bvec, bio, i) {
+	bio_for_each_segment_all_sp(bvec, bio, i, bia) {
 		memcpy(p, page_address(bvec->bv_page), bvec->bv_len);
 		p += bvec->bv_len;
 	}
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 472211fa183a..68cf3054296c 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -81,6 +81,7 @@ int blkdev_report_zones(struct block_device *bdev,
 	unsigned int ofst;
 	void *addr;
 	int ret;
+	struct bvec_iter_all bia;
 
 	if (!q)
 		return -ENXIO;
@@ -148,7 +149,7 @@ int blkdev_report_zones(struct block_device *bdev,
 	n = 0;
 	nz = 0;
 	nr_rep = 0;
-	bio_for_each_segment_all(bv, bio, i) {
+	bio_for_each_segment_all_sp(bv, bio, i, bia) {
 
 		if (!bv->bv_page)
 			break;
@@ -181,7 +182,7 @@ int blkdev_report_zones(struct block_device *bdev,
 
 	*nr_zones = nz;
 out:
-	bio_for_each_segment_all(bv, bio, i)
+	bio_for_each_segment_all_sp(bv, bio, i, bia)
 		__free_page(bv->bv_page);
 	bio_put(bio);
 
diff --git a/block/bounce.c b/block/bounce.c
index 08841ed4cdae..871bb12be0c4 100644
--- a/block/bounce.c
+++ b/block/bounce.c
@@ -135,11 +135,12 @@ static void bounce_end_io(struct bio *bio, mempool_t *pool)
 	struct bio_vec *bvec, orig_vec;
 	int i;
 	struct bvec_iter orig_iter = bio_orig->bi_iter;
+	struct bvec_iter_all bia;
 
 	/*
 	 * free up bounce indirect pages used
 	 */
-	bio_for_each_segment_all(bvec, bio, i) {
+	bio_for_each_segment_all_sp(bvec, bio, i, bia) {
 
 		orig_vec = bio_iter_iovec(bio_orig, orig_iter);
 		if (bvec->bv_page == orig_vec.bv_page)
@@ -209,13 +210,14 @@ static void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig,
 	int rw = bio_data_dir(*bio_orig);
 	struct bio_vec *to;
 	unsigned i;
+	struct bvec_iter_all bia;
 
 	if (!need_bounce(q, *bio_orig))
 		return;
 
 	bio = bio_clone_bioset_sp(*bio_orig, GFP_NOIO, fs_bio_set);
 
-	bio_for_each_segment_all(to, bio, i) {
+	bio_for_each_segment_all_sp(to, bio, i, bia) {
 		struct page *page = to->bv_page;
 
 		if (page_to_pfn(page) <= queue_bounce_pfn(q))
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v1 32/54] block: introduce bvec_get_last_sp() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:10 +0100
  [PATCH v1 53/54] btrfs: comment on direct access bvec table Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:10 +0100
  [PATCH v1 46/54] fs: crypto: convert to bio_for_each_segment_all_sp() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:10 +0100
  [PATCH v1 36/54] dm-crypt: don't clear bvec->bv_page in crypt_free_buffer_pages() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:10 +0100
  [PATCH v1 50/54] fs/buffer.c: use bvec iterator to truncate the bio Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:10 +0100
  [PATCH v1 54/54] block: enable multipage bvecs Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:10 +0100
  [PATCH v1 47/54] fs/btrfs: convert to bio_for_each_segment_all_sp() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:10 +0100
  [PATCH v1 33/54] block: deal with dirtying pages for multipage bvec Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:10 +0100
  [PATCH v1 38/54] md/raid1.c: convert to bio_for_each_segment_all_sp() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:10 +0100
  [PATCH v1 51/54] btrfs: avoid access to .bi_vcnt directly Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:10 +0100
  [PATCH v1 52/54] btrfs: use bvec_get_last_sp to get the last singlepage bvec Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:10 +0100
  [PATCH v1 39/54] fs/mpage: convert to bio_for_each_segment_all_sp() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:10 +0100
  [PATCH v1 37/54] dm-crypt: convert to bio_for_each_segment_all_sp() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:10 +0100
  [PATCH v1 35/54] bcache: convert to bio_for_each_segment_all_sp() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:10 +0100
  [PATCH v1 49/54] fs/iomap.c: convert to bio_for_each_segment_all_sp() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:20 +0100
  [PATCH v1 44/54] f2fs: convert to bio_for_each_segment_all_sp() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:20 +0100
  [PATCH v1 48/54] fs/block_dev.c: convert to bio_for_each_segment_all_sp() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:20 +0100
  [PATCH v1 34/54] block: convert to singe/multi page version of bio_for_each_segment_all() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:20 +0100
  [PATCH v1 41/54] ext4: convert to bio_for_each_segment_all_sp() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:20 +0100
  [PATCH v1 43/54] gfs2: convert to bio_for_each_segment_all_sp() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:20 +0100
  [PATCH v1 40/54] fs/direct-io: convert to bio_for_each_segment_all_sp() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:20 +0100
  [PATCH v1 45/54] exofs: convert to bio_for_each_segment_all_sp() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:20 +0100
    Re: [PATCH v1 45/54] exofs: convert to bio_for_each_segment_all_sp() Boaz Harrosh <ooo@electrozaur.com> - 2017-01-03 16:10 +0100
  [PATCH v1 42/54] xfs: convert to bio_for_each_segment_all_sp() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:20 +0100

csiph-web