From e201068c0031e4a3e762f1468f5e558bd8e167c1 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Thu, 9 Aug 2012 10:33:25 -0700 Subject: [PATCH] --- yaml --- r: 331647 b: refs/heads/master c: 542582fce1700c01b12e7945aaf173074e008e3e h: refs/heads/master i: 331645: 06942e99f09d918bf93f466c21969a43234a9ff4 331643: da6c6072078e7304d6032f392ab84025e20a58a2 331639: afe8ab0cc648cec95f8ab6702e59b57022bc69d7 331631: 170869446c6dc87be40d0d63c278323228e52d26 331615: 96a7865545194d650ae549ada261f1d8a9c46950 331583: 6c7fb254fd282d1ba1d34b2fa3283eb7d22da331 331519: 37a487763bbd5bb8d0efc5b187ceca33ecae96c7 v: v3 --- [refs] | 2 +- trunk/drivers/block/rbd.c | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/[refs] b/[refs] index 2a7639479c48..02174764f68b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 84d34dcc116e117a41c6fc8be13430529fc2d9e7 +refs/heads/master: 542582fce1700c01b12e7945aaf173074e008e3e diff --git a/trunk/drivers/block/rbd.c b/trunk/drivers/block/rbd.c index cf44da832ca1..43f6ef8d696f 100644 --- a/trunk/drivers/block/rbd.c +++ b/trunk/drivers/block/rbd.c @@ -754,7 +754,9 @@ static struct bio *bio_chain_clone(struct bio **old, struct bio **next, struct bio_pair **bp, int len, gfp_t gfpmask) { - struct bio *tmp, *old_chain = *old, *new_chain = NULL, *tail = NULL; + struct bio *old_chain = *old; + struct bio *new_chain = NULL; + struct bio *tail; int total = 0; if (*bp) { @@ -763,9 +765,12 @@ static struct bio *bio_chain_clone(struct bio **old, struct bio **next, } while (old_chain && (total < len)) { + struct bio *tmp; + tmp = bio_kmalloc(gfpmask, old_chain->bi_max_vecs); if (!tmp) goto err_out; + gfpmask &= ~__GFP_WAIT; /* can't wait after the first */ if (total + old_chain->bi_size > len) { struct bio_pair *bp; @@ -793,15 +798,12 @@ static struct bio *bio_chain_clone(struct bio **old, struct bio **next, } tmp->bi_bdev = NULL; - gfpmask &= ~__GFP_WAIT; tmp->bi_next = NULL; - - if (!new_chain) { - new_chain = tail = tmp; - } else { + if (new_chain) tail->bi_next = tmp; - tail = tmp; - } + else + new_chain = tmp; + tail = tmp; old_chain = old_chain->bi_next; total += tmp->bi_size; @@ -809,9 +811,6 @@ static struct bio *bio_chain_clone(struct bio **old, struct bio **next, BUG_ON(total < len); - if (tail) - tail->bi_next = NULL; - *old = old_chain; return new_chain;