summaryrefslogtreecommitdiffstats
path: root/block/blk-merge.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2015-09-02 16:46:02 -0600
committerJens Axboe <axboe@fb.com>2015-09-02 16:46:02 -0600
commit5014c311baa2b21384321fa4a9f617a92e3e56f0 (patch)
treec9f2fab874651482e91185c8544ab9bd604e871a /block/blk-merge.c
parentd975f309a8b250e67b66eabeb56be6989c783629 (diff)
downloadtalos-obmc-linux-5014c311baa2b21384321fa4a9f617a92e3e56f0.tar.gz
talos-obmc-linux-5014c311baa2b21384321fa4a9f617a92e3e56f0.zip
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>
Diffstat (limited to 'block/blk-merge.c')
-rw-r--r--block/blk-merge.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c
index d088cffb8105..cce23ba1ae5f 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -67,10 +67,9 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
struct bio_set *bs)
{
struct bio *split;
- struct bio_vec bv, bvprv;
+ struct bio_vec bv, bvprv, *bvprvp = NULL;
struct bvec_iter iter;
unsigned seg_size = 0, nsegs = 0, sectors = 0;
- int prev = 0;
bio_for_each_segment(bv, bio, iter) {
sectors += bv.bv_len >> 9;
@@ -82,20 +81,20 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
* If the queue doesn't support SG gaps and adding this
* offset would create a gap, disallow it.
*/
- if (prev && bvec_gap_to_prev(q, &bvprv, bv.bv_offset))
+ if (bvprvp && bvec_gap_to_prev(q, bvprvp, bv.bv_offset))
goto split;
- if (prev && blk_queue_cluster(q)) {
+ if (bvprvp && blk_queue_cluster(q)) {
if (seg_size + bv.bv_len > queue_max_segment_size(q))
goto new_segment;
- if (!BIOVEC_PHYS_MERGEABLE(&bvprv, &bv))
+ if (!BIOVEC_PHYS_MERGEABLE(bvprvp, &bv))
goto new_segment;
- if (!BIOVEC_SEG_BOUNDARY(q, &bvprv, &bv))
+ if (!BIOVEC_SEG_BOUNDARY(q, bvprvp, &bv))
goto new_segment;
seg_size += bv.bv_len;
bvprv = bv;
- prev = 1;
+ bvprvp = &bv;
continue;
}
new_segment:
@@ -104,7 +103,7 @@ new_segment:
nsegs++;
bvprv = bv;
- prev = 1;
+ bvprvp = &bv;
seg_size = bv.bv_len;
}
OpenPOWER on IntegriCloud