Use block_add_extd retval to detect success or error
authorXiao Jia <stfairy@gmail.com>
Wed, 7 Oct 2015 21:29:30 +0000 (14:29 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 8 Oct 2015 14:35:55 +0000 (10:35 -0400)
Signed-off-by: Xiao Jia <stfairy@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/src/ns/qio.c

index 28c2455..8f9457a 100644 (file)
@@ -1022,8 +1022,7 @@ static int __blist_clone_to(struct block *blist, struct block *newb, int len,
                nr_bufs += 1 + b->nr_extra_bufs;        /* 1 for the main body */
        }
        /* we might be holding a spinlock here, so we won't wait for kmalloc */
-       block_add_extd(newb, nr_bufs, 0);
-       if (newb->nr_extra_bufs < nr_bufs) {
+       if (block_add_extd(newb, nr_bufs, 0) != 0) {
                /* caller will need to alloc these, then re-call us */
                return nr_bufs;
        }