block: fix bogus compiler warnings in blk-merge.c

The compiler can't figure out that bvprv is initialized whenever 'prev'
is set to 1 as well. Use a pointer to bvprv instead, setting it to NULL
initially, and get rid of the 'prev' tracking. This dumbs it down
enough that gcc is happy.

Signed-off-by: Jens Axboe <axboe@fb.com>

+7 -8
+7 -8
block/blk-merge.c
··· 67 struct bio_set *bs) 68 { 69 struct bio *split; 70 - struct bio_vec bv, bvprv; 71 struct bvec_iter iter; 72 unsigned seg_size = 0, nsegs = 0, sectors = 0; 73 - int prev = 0; 74 75 bio_for_each_segment(bv, bio, iter) { 76 sectors += bv.bv_len >> 9; ··· 81 * If the queue doesn't support SG gaps and adding this 82 * offset would create a gap, disallow it. 83 */ 84 - if (prev && bvec_gap_to_prev(q, &bvprv, bv.bv_offset)) 85 goto split; 86 87 - if (prev && blk_queue_cluster(q)) { 88 if (seg_size + bv.bv_len > queue_max_segment_size(q)) 89 goto new_segment; 90 - if (!BIOVEC_PHYS_MERGEABLE(&bvprv, &bv)) 91 goto new_segment; 92 - if (!BIOVEC_SEG_BOUNDARY(q, &bvprv, &bv)) 93 goto new_segment; 94 95 seg_size += bv.bv_len; 96 bvprv = bv; 97 - prev = 1; 98 continue; 99 } 100 new_segment: ··· 103 104 nsegs++; 105 bvprv = bv; 106 - prev = 1; 107 seg_size = bv.bv_len; 108 } 109
··· 67 struct bio_set *bs) 68 { 69 struct bio *split; 70 + struct bio_vec bv, bvprv, *bvprvp = NULL; 71 struct bvec_iter iter; 72 unsigned seg_size = 0, nsegs = 0, sectors = 0; 73 74 bio_for_each_segment(bv, bio, iter) { 75 sectors += bv.bv_len >> 9; ··· 82 * If the queue doesn't support SG gaps and adding this 83 * offset would create a gap, disallow it. 84 */ 85 + if (bvprvp && bvec_gap_to_prev(q, bvprvp, bv.bv_offset)) 86 goto split; 87 88 + if (bvprvp && blk_queue_cluster(q)) { 89 if (seg_size + bv.bv_len > queue_max_segment_size(q)) 90 goto new_segment; 91 + if (!BIOVEC_PHYS_MERGEABLE(bvprvp, &bv)) 92 goto new_segment; 93 + if (!BIOVEC_SEG_BOUNDARY(q, bvprvp, &bv)) 94 goto new_segment; 95 96 seg_size += bv.bv_len; 97 bvprv = bv; 98 + bvprvp = &bv; 99 continue; 100 } 101 new_segment: ··· 104 105 nsegs++; 106 bvprv = bv; 107 + bvprvp = &bv; 108 seg_size = bv.bv_len; 109 } 110