]> Git Repo - linux.git/blobdiff - block/bounce.c
Merge tag 'io_uring-20190323' of git://git.kernel.dk/linux-block
[linux.git] / block / bounce.c
index ffb9e9ecfa7ee78f1428390a30d0667a8f778cde..47eb7e936e22715cea56e9ec6d0c7cd84f8b35ee 100644 (file)
@@ -165,11 +165,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 iter_all;
 
        /*
         * free up bounce indirect pages used
         */
-       bio_for_each_segment_all(bvec, bio, i) {
+       bio_for_each_segment_all(bvec, bio, i, iter_all) {
                orig_vec = bio_iter_iovec(bio_orig, orig_iter);
                if (bvec->bv_page != orig_vec.bv_page) {
                        dec_zone_page_state(bvec->bv_page, NR_BOUNCE);
@@ -313,7 +314,12 @@ static void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig,
        bio = bounce_clone_bio(*bio_orig, GFP_NOIO, passthrough ? NULL :
                        &bounce_bio_set);
 
-       bio_for_each_segment_all(to, bio, i) {
+       /*
+        * Bvec table can't be updated by bio_for_each_segment_all(),
+        * so retrieve bvec from the table directly. This way is safe
+        * because the 'bio' is single-page bvec.
+        */
+       for (i = 0, to = bio->bi_io_vec; i < bio->bi_vcnt; to++, i++) {
                struct page *page = to->bv_page;
 
                if (page_to_pfn(page) <= q->limits.bounce_pfn)
This page took 0.026197 seconds and 4 git commands to generate.