Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 331647
b: refs/heads/master
c: 542582f
h: refs/heads/master
i:
  331645: 06942e9
  331643: da6c607
  331639: afe8ab0
  331631: 1708694
  331615: 96a7865
  331583: 6c7fb25
  331519: 37a4877
v: v3
  • Loading branch information
Alex Elder committed Oct 1, 2012
1 parent 94e895a commit e201068
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 84d34dcc116e117a41c6fc8be13430529fc2d9e7
refs/heads/master: 542582fce1700c01b12e7945aaf173074e008e3e
21 changes: 10 additions & 11 deletions trunk/drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -793,25 +798,19 @@ 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;
}

BUG_ON(total < len);

if (tail)
tail->bi_next = NULL;

*old = old_chain;

return new_chain;
Expand Down

0 comments on commit e201068

Please sign in to comment.