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